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: Andrew Haley <aph at redhat dot com>
- To: Ranjit Mathew <rmathew at hotmail dot com>
- Cc: java-patches at gcc dot gnu dot org
- Date: Sun, 2 Mar 2003 12:42:54 +0000 (GMT)
- Subject: Patch: jcf-path.c and filename case-insensitivity on Win32
- References: <3E591729.9FEFF8B1@hotmail.com>
Ranjit Mathew writes:
> 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
See Tom's comment -- declare COMPARE_FILENAMES appropriately. We
don't want HAVE_DOS_BASED_FILE_SYSTEM all over the place if we can
possibly avoid it.
Otherwise this is fine.
Andrew.