jcf-io.c (find_class): Added explanatory comment.
authorTom Tromey <tromey@cygnus.com>
Thu, 12 Nov 1998 11:43:19 +0000 (11:43 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Thu, 12 Nov 1998 11:43:19 +0000 (11:43 +0000)
* jcf-io.c (find_class): Added explanatory comment.
* jcf-path.c (add_entry): Look for `.zip' at end of filename.  Add
trailing slash to `.zip' entries.

From-SVN: r23615

gcc/java/ChangeLog
gcc/java/jcf-io.c
gcc/java/jcf-path.c

index 8e331ee630ab319ad3bcbf41bfd73c4f1d853f53..e7e48b6db7871d9ff08d847885956153067984d4 100644 (file)
@@ -1,5 +1,10 @@
 1998-11-12  Tom Tromey  <tromey@cygnus.com>
 
+       * jcf-io.c (find_class): Added explanatory comment.
+
+       * jcf-path.c (add_entry): Look for `.zip' at end of filename.  Add
+       trailing slash to `.zip' entries.
+
        * jvspec.c (lang_specific_driver): Correctly handle case where
        GC_NAME not defined.
 
index 43e96cf94c022f2749b0cc41744633ae04f0e09e..c1c5b7aa783b0cb7ab9aa85643cc709dccdf5bf1 100644 (file)
@@ -282,6 +282,8 @@ DEFUN(find_class, (classname, classname_length, jcf, do_class_file),
       strcpy (buffer, jcf_path_name (entry));
       i = strlen (buffer);
 
+      /* This is right because we know that `.zip' entries will have a
+        trailing slash.  See jcf-path.c.  */
       dir_len = i - 1;
 
       for (k = 0; k < classname_length; k++, i++)
index 829f99a194777204e91c90d15718b8fd521d254f..159b09f9f71f110330a58a1b1cf1049392078b98 100644 (file)
@@ -141,7 +141,7 @@ add_entry (entp, filename, is_system)
   n->next = NULL;
 
   len = strlen (filename);
-  if (len > 4 && ! strcmp (filename - 4, ".zip"))
+  if (len > 4 && ! strcmp (filename + len - 4, ".zip"))
     {
       n->flags |= FLAG_ZIP;
       /* If the user uses -classpath then he'll have to include
@@ -152,9 +152,10 @@ add_entry (entp, filename, is_system)
        n->flags |= FLAG_SYSTEM;
     }
 
-  if (! (n->flags & FLAG_ZIP)
-      && filename[len - 1] != '/'
-      && filename[len - 1] != DIR_SEPARATOR)
+  /* Note that we add a trailing separator to `.zip' names as well.
+     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 = (char *) alloca (len + 1);
       strcpy (f2, filename);