From: Raúl Marín Rodríguez Date: Wed, 24 Apr 2019 11:02:21 +0000 (+0000) Subject: lwout_wkb.c: Address implicit type conversion with value change X-Git-Tag: 3.0.0alpha1~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ada2f6fd66804dff4ac82a5efb9b80717bec031;p=postgis lwout_wkb.c: Address implicit type conversion with value change lwout_wkb.c:288:16: runtime error: implicit conversion from type 'char' of value -16 (8-bit, signed) to type 'uint8_t' (aka 'unsigned char') changed the value to 240 (8-bit, unsigned) lwout_wkb.c:654:27: runtime error: implicit conversion from type 'uint32_t' (aka 'unsigned int') of value 2147483663 (32-bit, unsigned) to type 'int' changed the value to -2147483633 (32-bit, signed) lwout_wkb.c:213:16: runtime error: implicit conversion from type 'char' of value -128 (8-bit, signed) to type 'uint8_t' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned) lwout_wkb.c:607:27: runtime error: implicit conversion from type 'uint32_t' (aka 'unsigned int') of value 2147483651 (32-bit, unsigned) to type 'int' changed the value to -2147483645 (32-bit, signed) References #4383 git-svn-id: http://svn.osgeo.org/postgis/trunk@17412 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/lwout_wkb.c b/liblwgeom/lwout_wkb.c index 49bcfd665..4d4a55863 100644 --- a/liblwgeom/lwout_wkb.c +++ b/liblwgeom/lwout_wkb.c @@ -193,9 +193,10 @@ static inline int wkb_swap_bytes(uint8_t variant) /* * Integer32 */ -static uint8_t* integer_to_wkb_buf(const int ival, uint8_t *buf, uint8_t variant) +static uint8_t * +integer_to_wkb_buf(const uint32_t ival, uint8_t *buf, uint8_t variant) { - char *iptr = (char*)(&ival); + uint8_t *iptr = (uint8_t *)(&ival); int i = 0; if ( sizeof(int) != WKB_INT_SIZE ) @@ -270,7 +271,7 @@ static uint8_t* double_nan_to_wkb_buf(uint8_t *buf, uint8_t variant) */ static uint8_t* double_to_wkb_buf(const double d, uint8_t *buf, uint8_t variant) { - char *dptr = (char*)(&d); + uint8_t *dptr = (uint8_t *)(&d); int i = 0; if ( sizeof(double) != WKB_DOUBLE_SIZE )