This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: jcf-path.c and filename case-insensitivity on Win32
- From: Ranjit Mathew <rmathew at hotmail dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Mon, 24 Feb 2003 00:17:05 +0530
- Subject: Patch: jcf-path.c and filename case-insensitivity on Win32
Hi,
This patch makes jcf-path.c use IS_DIR_SEPARATOR instead of
directly comparing against DIR_SEPARATOR. It also makes it
compare ZIP and JAR files in a case-insensitive manner if we
have a DOS-based filesystem as on Windows.
Ranjit.
Index: ChangeLog
from Ranjit Mathew <rmathew at hotmail dot com>
* jcf-path.c (add_entry): Compare ZIP and JAR files in a
case-insensitive way if we have a DOS-based filesystem.
Use IS_DIR_SEPARATOR instead of explicit checking against
DIR_SEPARATOR.
(jcf_path_extdirs_arg): Use IS_DIR_SEPARATOR instead of
explicitly checking against DIR_SEPARATOR.
Index: jcf-path.c
===================================================================
*** jcf-path.c Mon Jan 27 21:43:44 2003
--- jcf-path.c Tue Jan 28 20:28:07 2003
*************** add_entry (entp, filename, is_system)
*** 149,154 ****
--- 149,160 ----
len = strlen (filename);
+
+ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) && defined (HAVE_STRCASECMP)
+ if (len > 4 && (strcasecmp (filename + len - 4, ".zip") == 0
+ || strcasecmp (filename + len - 4, ".jar") == 0))
+ #else
if (len > 4 && (strcmp (filename + len - 4, ".zip") == 0
|| strcmp (filename + len - 4, ".jar") == 0))
+ #endif
{
n->flags |= FLAG_ZIP;
*************** add_entry (entp, filename, is_system)
*** 157,161 ****
--- 163,171 ----
way. Symlinks will fool this test. This is only used for
-MM and -MMD, so it probably isn't terribly important. */
+ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) && defined (HAVE_STRCASECMP)
+ if (! strcasecmp (filename, LIBGCJ_ZIP_FILE))
+ #else
if (! strcmp (filename, LIBGCJ_ZIP_FILE))
+ #endif
n->flags |= FLAG_SYSTEM;
}
*************** add_entry (entp, filename, is_system)
*** 164,168 ****
This is a little hack that lets the searching code in jcf-io.c
work more easily. Eww. */
! if (filename[len - 1] != '/' && filename[len - 1] != DIR_SEPARATOR)
{
char *f2 = alloca (len + 2);
--- 174,178 ----
This is a little hack that lets the searching code in jcf-io.c
work more easily. Eww. */
! if (! IS_DIR_SEPARATOR (filename[len - 1]))
{
char *f2 = alloca (len + 2);
*************** jcf_path_extdirs_arg (cp)
*** 379,383 ****
+ strlen (direntp->d_name) + 2);
strcpy (name, buf);
! if (name[dirname_length-1] != DIR_SEPARATOR)
{
name[dirname_length] = DIR_SEPARATOR;
--- 389,393 ----
+ strlen (direntp->d_name) + 2);
strcpy (name, buf);
! if (! IS_DIR_SEPARATOR (name[dirname_length-1]))
{
name[dirname_length] = DIR_SEPARATOR;