This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: fastjar question


Tom Tromey wrote:

"Andreas" == Andreas Tobler <toa@pop.agri.ch> writes:


Andreas> Second, this thing is much more annoying, the fastjar jar
Andreas> creates a ^@ entry as last 'character' in the MANIFEST. This
Andreas> is in my opinion wrong.

I'm not all that familiar with the manifest file specification.

Hehe, neither am I.


Could you look it up and see if this character is or is not required?

I compared the output of jar -cvf|xvf from the MANIFEST.MF with different jar versions. The sun one doesn't contain this @. (The apple one also not, but who wonders, also sun based)
I'll dig in the sun docs. But I guess we simply have a string which is to short or in otherwords we reserve to much for it.



Andreas> - int mf_len = 37 + strlen(VERSION); Andreas> + int mf_len = 36 + strlen(VERSION);

Could you rewrite this patch to avoid a magic constant altogether?

Like this below?


(Certainly with ChangeLog if it comes that far :)

Andreas

RCS file: /cvs/gcc/gcc/fastjar/jartool.c,v
retrieving revision 1.24
diff -u -r1.24 jartool.c
--- jartool.c   2 Jul 2003 17:20:54 -0000       1.24
+++ jartool.c   5 Jan 2004 22:04:22 -0000
@@ -313,6 +313,12 @@
 /* This holds all options.  */
 #define OPTION_STRING "-ctxuvVf:m:C:0ME@"

+/* This defines the length of the following string:
+   "Manifest-Version: 1.0\nCreated-By: %s\n\n".
+   The \n is counted as one character and the %s isn't counted.
+   The version string length is added below.  */
+#define MANIFEST_STR_LENGTH 36
+
 static const struct option options[] =
 {
   { "help", no_argument, NULL, OPT_HELP },
@@ -732,7 +738,8 @@

   /* if the user didn't specify an external manifest file... */
   if(mf_name == NULL){
-    int mf_len = 37 + strlen(VERSION);
+
+    int mf_len = MANIFEST_STR_LENGTH + strlen(VERSION);
     char *mf;

if((mf = (char *) malloc(mf_len + 1))) {


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