[evolution-patches] const fix for camel-charset-map.c's autogenerated camel-charset-map-private.h



This patch fixes Ross Burton's previous const fixes to the charset map
tables by doing it the right way :)

I did, however, notice that the resulting table data is now different
after re-generating the table:

--- camel-charset-map-private.h	2005-08-23 22:35:14.000000000 -0400
+++ foo.h	2006-04-04 11:13:57.000000000 -0400
@@ -16,7 +16,7 @@
 	0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 
 	0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 
 	0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 
-	0xbf, 0xbf, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 
+	0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0x9f, 0x9f, 0x9f, 
 	0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 
 	0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 
 	0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 
@@ -191,7 +191,7 @@
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 
 	0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x00, 
 	0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x20, 0x20, 
 	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
@@ -337,7 +337,7 @@
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+	0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
@@ -560,7 +560,7 @@
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 };
 
-struct {
+static const struct {
 	const unsigned char *bits0;
 	const unsigned char *bits1;
 } camel_charmap[256] = {
@@ -598,7 +598,7 @@
 	{ 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, 
 };
 
-struct {
+static const struct {
 	const char *name;
 	unsigned int bit;
 } camel_charinfo[] = {



kinda worrying that the table data changed, but looking over the
vc-annotate for camel-charset-map.c and camel-charset-map-private.h, I
can't find what could have caused this difference :\

perhaps the iconv data changed?

-- 
Jeffrey Stedfast
Evolution Hacker - Novell, Inc.
fejj ximian com  - www.novell.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/ChangeLog,v
retrieving revision 1.2530
diff -u -r1.2530 ChangeLog
--- ChangeLog	29 Mar 2006 15:40:09 -0000	1.2530
+++ ChangeLog	4 Apr 2006 15:09:06 -0000
@@ -1,3 +1,8 @@
+2006-04-04  Jeffrey Stedfast  <fejj novell com>
+
+	* camel-charset-map.c (main): Set appropriate structs/struct
+	elements to static/const.
+
 2006-03-20  Parthasarathi Susarla <sparthasarathi novell com>
 	
 	** See bug 272307
Index: camel-charset-map.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-charset-map.c,v
retrieving revision 1.45
diff -u -r1.45 camel-charset-map.c
--- camel-charset-map.c	31 Aug 2005 04:21:56 -0000	1.45
+++ camel-charset-map.c	4 Apr 2006 15:09:06 -0000
@@ -141,7 +141,7 @@
 			}
 			if (j < 256) {
 				/* yes, dump it */
-				printf("static unsigned char m%02x%x[256] = {\n\t", i, k);
+				printf("static const unsigned char m%02x%x[256] = {\n\t", i, k);
 				for (j=0;j<256;j++) {
 					printf("0x%02x, ", (encoding_map[i*256+j] >> (k*8)) & 0xff );
 					if (((j+1)&7) == 0 && j<255)
@@ -152,9 +152,9 @@
 		}
 	}
 
-	printf("struct {\n");
+	printf("static const struct {\n");
 	for (k=0;k<bytes;k++) {
-		printf("\tunsigned char *bits%d;\n", k);
+		printf("\tconst unsigned char *bits%d;\n", k);
 	}
 	printf("} camel_charmap[256] = {\n\t");
 	for (i=0;i<256;i++) {
@@ -177,7 +177,7 @@
 	}
 	printf("\n};\n\n");
 
-	printf("struct {\n\tconst char *name;\n\tunsigned int bit;\n} camel_charinfo[] = {\n");
+	printf("static const struct {\n\tconst char *name;\n\tunsigned int bit;\n} camel_charinfo[] = {\n");
 	for (j=0;tables[j].name;j++) {
 		printf("\t{ \"%s\", 0x%04x },\n", tables[j].name, tables[j].bit);
 	}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]