[PATCH] Make array initialization of pj_units_copy ANSI C
Petter Reinholdtsen
pere at HUNGRY.COM
Mon Jan 24 04:01:54 EST 2005
The array initializer in mapprojhack.c fail to group each array member
into a block. I have no idea how the code in question could work at
all, probably by pure luck and because of a flexible compiler. This
patch bring the construct in line with ANSI C. Please include in a
future version of mapserver.
Why are you using '(char *)0' by the way? I believe 'NULL' is more
commonly used as the null pointer.
Index: mapprojhack.c
===================================================================
RCS file: /data2/cvsroot/mapserver/mapprojhack.c,v
retrieving revision 1.5
diff -u -r1.5 mapprojhack.c
--- mapprojhack.c 21 Oct 2004 04:30:55 -0000 1.5
+++ mapprojhack.c 24 Jan 2005 08:53:21 -0000
@@ -108,28 +108,28 @@
#ifdef USE_PROJ
struct PJ_UNITS
pj_units_copy[] = {
- "km", "1000.", "Kilometer",
- "m", "1.", "Meter",
- "dm", "1/10", "Decimeter",
- "cm", "1/100", "Centimeter",
- "mm", "1/1000", "Millimeter",
- "kmi", "1852.0", "International Nautical Mile",
- "in", "0.0254", "International Inch",
- "ft", "0.3048", "International Foot",
- "yd", "0.9144", "International Yard",
- "mi", "1609.344", "International Statute Mile",
- "fath", "1.8288", "International Fathom",
- "ch", "20.1168", "International Chain",
- "link", "0.201168", "International Link",
- "us-in", "1./39.37", "U.S. Surveyor's Inch",
- "us-ft", "0.304800609601219", "U.S. Surveyor's Foot",
- "us-yd", "0.914401828803658", "U.S. Surveyor's Yard",
- "us-ch", "20.11684023368047", "U.S. Surveyor's Chain",
- "us-mi", "1609.347218694437", "U.S. Surveyor's Statute Mile",
- "ind-yd", "0.91439523", "Indian Yard",
- "ind-ft", "0.30479841", "Indian Foot",
- "ind-ch", "20.11669506", "Indian Chain",
-(char *)0, (char *)0, (char *)0
+ {"km", "1000.", "Kilometer"},
+ {"m", "1.", "Meter"},
+ {"dm", "1/10", "Decimeter"},
+ {"cm", "1/100", "Centimeter"},
+ {"mm", "1/1000", "Millimeter"},
+ {"kmi", "1852.0", "International Nautical Mile"},
+ {"in", "0.0254", "International Inch"},
+ {"ft", "0.3048", "International Foot"},
+ {"yd", "0.9144", "International Yard"},
+ {"mi", "1609.344", "International Statute Mile"},
+ {"fath", "1.8288", "International Fathom"},
+ {"ch", "20.1168", "International Chain"},
+ {"link", "0.201168", "International Link"},
+ {"us-in", "1./39.37", "U.S. Surveyor's Inch"},
+ {"us-ft", "0.304800609601219", "U.S. Surveyor's Foot"},
+ {"us-yd", "0.914401828803658", "U.S. Surveyor's Yard"},
+ {"us-ch", "20.11684023368047", "U.S. Surveyor's Chain"},
+ {"us-mi", "1609.347218694437", "U.S. Surveyor's Statute Mile"},
+ {"ind-yd", "0.91439523", "Indian Yard"},
+ {"ind-ft", "0.30479841", "Indian Foot"},
+ {"ind-ch", "20.11669506", "Indian Chain"},
+ {(char *)0, (char *)0, (char *)0}
};
#endif /* def USE_PROJ */
More information about the mapserver-dev
mailing list