This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: correct handling of `.zip' files


I'm committing the appended patch.  It changes the java front end to
correctly handle .zip files.  It also adds a comment explaining an
apparent oddity in jcf-io.c.

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.

Tom

Index: jcf-path.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/java/jcf-path.c,v
retrieving revision 1.2
diff -u -r1.2 jcf-path.c
--- jcf-path.c	1998/10/22 16:30:33	1.2
+++ jcf-path.c	1998/11/12 19:41:02
@@ -141,7 +141,7 @@
   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 @@
 	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);
Index: jcf-io.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/java/jcf-io.c,v
retrieving revision 1.8
diff -u -r1.8 jcf-io.c
--- jcf-io.c	1998/10/22 13:06:53	1.8
+++ jcf-io.c	1998/11/12 19:41:09
@@ -282,6 +282,8 @@
       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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]