This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

[PATCH, libjava] gen-from-JIS nits


This fixes warnings about implicit declarations of strcmp, exit, enter,
print_table, an extra argument to fprintf, and a missing argc check.
And a typo.

Bootstrapped, regtested i686-pc-linux-gnu.  OK for trunk?

Thanks,
Ralf

libjava/ChangeLog:
2008-07-06  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* gnu/gcj/convert/make-trie.h: New.
	* gnu/gcj/convert/gen-from-JIS.c: Include it.
	* gnu/gcj/convert/make-trie.c: Likewise.
	Fix typos and compiler warnings, diagnose a missing argument.
	* Makefile.am (gen_from_JIS_SOURCES): Add gnu/gcj/convert/make-trie.h.
	* Makefile.in: Regenerate.

diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 5790104..ac5b7e1 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -589,7 +589,8 @@ noinst_PROGRAMS = gen-from-JIS
 
 gen_from_JIS_SOURCES = \
 	gnu/gcj/convert/gen-from-JIS.c \
-	gnu/gcj/convert/make-trie.c
+	gnu/gcj/convert/make-trie.c \
+	gnu/gcj/convert/make-trie.h
 
 gen_from_JIS_DEPENDENCIES = \
 	gnu/gcj/convert/JIS0201.h \
diff --git a/libjava/gnu/gcj/convert/gen-from-JIS.c b/libjava/gnu/gcj/convert/gen-from-JIS.c
index 1374580..d4cca14 100644
--- a/libjava/gnu/gcj/convert/gen-from-JIS.c
+++ b/libjava/gnu/gcj/convert/gen-from-JIS.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999  Free Software Foundation
+/* Copyright (C) 1999, 2008  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -7,6 +7,10 @@ Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
 details.  */
 
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "make-trie.h"
+
 struct chval
 {
   unsigned char b1;            /* 1st byte */
@@ -59,6 +63,11 @@ main(int argc, char** argv)
   int low1_uc = 0xFFFF, high1_uc = 0;
   int low2_uc = 0xFFFF, high2_uc = 0;
   int i;  int row, col;
+  if (argc < 2)
+    {
+      fprintf (stderr, "missing argument!\n");
+      exit (-1);
+    }
   if (strcmp (argv[1], "JIS0208") == 0)
     chtab = chtab_0208;
   else if (strcmp (argv[1], "JIS0212") == 0)
@@ -106,8 +115,7 @@ main(int argc, char** argv)
 
   fprintf(out,"/* This file is automatically generated from %s.TXT. */\n",
 	  argv[1]);
-  fprintf(out,"#pragma GCC java_exceptions\n",
-	  argv[1]);
+  fprintf(out,"#pragma GCC java_exceptions\n");
   fprintf(out, "unsigned short %s_to_Unicode[%d][%d] = {\n",
 	  argv[1], max1 - min1 + 1,  max2 - min2 + 1);
   i = 0;
@@ -156,7 +164,7 @@ main(int argc, char** argv)
 		}
 	      else
 		{
-		  fprintf (stderr, "error - char table our of order!\n");
+		  fprintf (stderr, "error - char table out of order!\n");
 		  exit (-1);
 		}
 	      if (col != max2)
diff --git a/libjava/gnu/gcj/convert/make-trie.c b/libjava/gnu/gcj/convert/make-trie.c
index e89f70c..fe2d789 100644
--- a/libjava/gnu/gcj/convert/make-trie.c
+++ b/libjava/gnu/gcj/convert/make-trie.c
@@ -8,6 +8,7 @@ details.  */
 
 #include <stdio.h>
 #include <stdlib.h>
+#include "make-trie.h"
 
 typedef struct trie_node
 {
diff --git a/libjava/gnu/gcj/convert/make-trie.h b/libjava/gnu/gcj/convert/make-trie.h
new file mode 100644
index 0000000..bbe20a5
--- /dev/null
+++ b/libjava/gnu/gcj/convert/make-trie.h
@@ -0,0 +1,13 @@
+/* Copyright (C) 2008  Free Software Foundation
+
+   This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
+details.  */
+
+#include <stddef.h>
+
+extern void print_table (char *name, FILE *out);
+
+extern void enter (int key, int value);


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