From: Sandro Santilli Date: Fri, 5 Sep 2014 15:01:08 +0000 (+0000) Subject: Fix 'defined but not used' and other warnings in unit tests X-Git-Tag: 2.2.0rc1~856 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7bbeee228772bfc1e8c7200874631a42fe48e92a;p=postgis Fix 'defined but not used' and other warnings in unit tests git-svn-id: http://svn.osgeo.org/postgis/trunk@12948 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/cunit/cu_in_geojson.c b/liblwgeom/cunit/cu_in_geojson.c index cef7bae81..d37137bc2 100644 --- a/liblwgeom/cunit/cu_in_geojson.c +++ b/liblwgeom/cunit/cu_in_geojson.c @@ -31,7 +31,7 @@ static void do_geojson_test(const char * exp, char * in, char * exp_srs, int pre g = lwgeom_from_geojson(in, &srs); if ( ! g ) { fprintf(stderr, "\nIn: %s\nExp: %s\nObt: %s\n", in, exp, cu_error_msg); - CU_ASSERT(g); + CU_ASSERT(g != NULL); return; } @@ -61,36 +61,6 @@ static void do_geojson_test(const char * exp, char * in, char * exp_srs, int pre if ( srs ) lwfree(srs); } - -static void do_geojson_unsupported(char * in, char * exp) -{ - LWGEOM *g; - char * h = NULL; - char * srs = NULL; - size_t size; - - g = lwgeom_from_geojson(in, &srs); - - if ( g ) { - h = lwgeom_to_wkt(g, WKT_ISO, 1, &size); - fprintf(stderr, "\nIn: %s\nExp: %s\nObt: %s\n", - in, exp, h); - CU_ASSERT(!g); - } else { - - if (strcmp(cu_error_msg, exp)) - fprintf(stderr, "\nIn: %s\nExp: %s\nObt: %s\n", - in, exp, cu_error_msg); - CU_ASSERT_STRING_EQUAL(in, cu_error_msg); - } - - cu_error_msg_reset(); - - if ( srs ) lwfree(srs); - if ( h ) lwfree(h); - lwgeom_free(g); -} - static void in_geojson_test_srid(void) { /* Linestring */ diff --git a/liblwgeom/cunit/cu_out_encoded_polyline.c b/liblwgeom/cunit/cu_out_encoded_polyline.c index 7c190d254..7f0a71077 100644 --- a/liblwgeom/cunit/cu_out_encoded_polyline.c +++ b/liblwgeom/cunit/cu_out_encoded_polyline.c @@ -37,25 +37,6 @@ static void do_encoded_polyline_test(char * in, int precision, char * out) } -static void do_encoded_polyline_unsupported(char * in, int precision, char * out) -{ - LWGEOM *g; - char *h; - - g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); - h = lwgeom_to_encoded_polyline(g, precision); - - if (strcmp(cu_error_msg, out)) - fprintf(stderr, "\nIn: %s\nOut: %s\nTheo: %s\n", - in, cu_error_msg, out); - - CU_ASSERT_STRING_EQUAL(out, cu_error_msg); - cu_error_msg_reset(); - - lwfree(h); - lwgeom_free(g); -} - static void out_encoded_polyline_test_geoms(void) { /* Linestring */ diff --git a/liblwgeom/cunit/cu_out_gml.c b/liblwgeom/cunit/cu_out_gml.c index 76e0d19cd..547532389 100644 --- a/liblwgeom/cunit/cu_out_gml.c +++ b/liblwgeom/cunit/cu_out_gml.c @@ -148,26 +148,6 @@ static void do_gml2_unsupported(char * in, char * out) lwgeom_free(g); } -static void do_gml3_unsupported(char * in, char * out) -{ - LWGEOM *g; - char *h; - int opts = LW_GML_IS_DIMS; - - g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); - h = lwgeom_to_gml3(g, NULL, 0, opts, "", NULL); - - if (strcmp(cu_error_msg, out)) - fprintf(stderr, "\nGML 3 - In: %s\nOut: %s\nTheo: %s\n", - in, cu_error_msg, out); - - CU_ASSERT_STRING_EQUAL(out, cu_error_msg); - cu_error_msg_reset(); - - lwfree(h); - lwgeom_free(g); -} - static void do_gml2_extent_test(char * in, char * out, char * srs, double precision, char * prefix) { diff --git a/liblwgeom/cunit/cu_surface.c b/liblwgeom/cunit/cu_surface.c index 9a0462c2b..c9badf7f1 100644 --- a/liblwgeom/cunit/cu_surface.c +++ b/liblwgeom/cunit/cu_surface.c @@ -12,8 +12,6 @@ #include "cu_surface.h" -static void check_tgeom(char *ewkt, int type, uint32_t srid, int is_solid); - void triangle_parse(void) { LWGEOM *geom; @@ -313,8 +311,8 @@ void polyhedralsurface_parse(void) geom = lwgeom_from_wkt("POLYHEDRALSURFACE EMPTY", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, POLYHEDRALSURFACETYPE); - tmp = lwgeom_to_wkb(geom, WKB_HEX | WKB_ISO | WKB_NDR, 0); - CU_ASSERT_STRING_EQUAL("010F00000000000000", (char*)tmp); + tmp = (char *)lwgeom_to_wkb(geom, WKB_HEX | WKB_ISO | WKB_NDR, 0); + CU_ASSERT_STRING_EQUAL("010F00000000000000", tmp); lwfree(tmp); tmp = lwgeom_to_ewkt(geom); CU_ASSERT_STRING_EQUAL("POLYHEDRALSURFACE EMPTY", tmp);