From 810f9ae59876e4d94fcb327f1a92aa61a307292a Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Thu, 15 Nov 2012 00:08:53 +0000 Subject: [PATCH] Use a locale-independent braindead upper implementation git-svn-id: http://svn.osgeo.org/postgis/trunk@10678 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/g_util.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/liblwgeom/g_util.c b/liblwgeom/g_util.c index 32c6240a2..ac52d4baa 100644 --- a/liblwgeom/g_util.c +++ b/liblwgeom/g_util.c @@ -112,6 +112,14 @@ struct geomtype_struct geomtype_struct_array[] = }; #define GEOMTYPE_STRUCT_ARRAY_LEN (sizeof geomtype_struct_array/sizeof(struct geomtype_struct)) +const char dumb_upper_map[128] = "................................................0123456789.......ABCDEFGHIJKLMNOPQRSTUVWXYZ......ABCDEFGHIJKLMNOPQRSTUVWXYZ....."; + +static char dump_toupper(int in) +{ + if ( in < 0 || in > 127 ) + return '.'; + return dumb_upper_map[in]; +} uint8_t gflags(int hasz, int hasm, int geodetic) { @@ -171,7 +179,7 @@ int geometry_type_from_string(const char *str, uint8_t *type, int *z, int *m) /* Copy and convert to upper case for comparison */ tmpstr = lwalloc(tmpendpos - tmpstartpos + 2); for (i = tmpstartpos; i <= tmpendpos; i++) - tmpstr[i - tmpstartpos] = toupper(str[i]); + tmpstr[i - tmpstartpos] = dump_toupper(str[i]); /* Add NULL to terminate */ tmpstr[i - tmpstartpos] = '\0'; -- 2.40.0