From: Paul Ramsey Date: Wed, 29 Apr 2015 15:49:19 +0000 (+0000) Subject: Quiet warnings about misuse of abs() / fabs() on X-Git-Tag: 2.2.0rc1~540 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=84abc55b759eac7199ec77a340124004ca7e6580;p=postgis Quiet warnings about misuse of abs() / fabs() on wrong types (new clang in OSX 10.10) git-svn-id: http://svn.osgeo.org/postgis/trunk@13457 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/lwgeom_accum.c b/postgis/lwgeom_accum.c index c615a8f34..6a23d8ab2 100644 --- a/postgis/lwgeom_accum.c +++ b/postgis/lwgeom_accum.c @@ -424,7 +424,7 @@ pgis_twkb_accum_finalfn(PG_FUNCTION_ARGS) } } - if (fabs(state->precision)>7) + if (abs(state->precision)>7) lwerror("precision cannot be more than 7"); twkb = lwgeom_agg_to_twkb(&lwgeom_arrays, state->variant , &twkb_size,(int8_t) state->precision); diff --git a/postgis/lwgeom_inout.c b/postgis/lwgeom_inout.c index 8d2b85824..58520f163 100644 --- a/postgis/lwgeom_inout.c +++ b/postgis/lwgeom_inout.c @@ -447,7 +447,7 @@ Datum TWKBFromLWGEOM(PG_FUNCTION_ARGS) if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) ) { prec = PG_GETARG_INT32(1); - if (fabs(prec)>7) + if (abs(prec)>7) lwerror("precision cannot be more than 7"); } else diff --git a/raster/rt_core/rt_band.c b/raster/rt_core/rt_band.c index f18d8855c..70562fb55 100644 --- a/raster/rt_core/rt_band.c +++ b/raster/rt_core/rt_band.c @@ -445,7 +445,7 @@ rt_band_load_offline_data(rt_band band) { VRTAddSimpleSource( hbandDst, GDALGetRasterBand(hdsSrc, band->data.offline.bandNum + 1), - abs(offset[0]), abs(offset[1]), + fabs(offset[0]), fabs(offset[1]), band->width, band->height, 0, 0, band->width, band->height, diff --git a/raster/rt_core/rt_raster.c b/raster/rt_core/rt_raster.c index eff0cf3f1..90e1cbd6d 100644 --- a/raster/rt_core/rt_raster.c +++ b/raster/rt_core/rt_raster.c @@ -2631,8 +2631,8 @@ rt_raster_gdal_rasterize( (FLT_NEQ(*width, 0.0)) && (FLT_NEQ(*height, 0.0)) ) { - _dim[0] = fabs(*width); - _dim[1] = fabs(*height); + _dim[0] = abs(*width); + _dim[1] = abs(*height); if (FLT_NEQ(extent.MaxX, extent.MinX)) _scale[0] = fabs((extent.MaxX - extent.MinX) / _dim[0]); @@ -2700,8 +2700,8 @@ rt_raster_gdal_rasterize( (wkbtype == wkbLineString) || (wkbtype == wkbMultiLineString) ) && - FLT_EQ(_dim[0], 0) && - FLT_EQ(_dim[1], 0) + _dim[0] == 0 && + _dim[1] == 0 ) { int result; LWPOLY *epoly = NULL; diff --git a/raster/rt_core/rt_warp.c b/raster/rt_core/rt_warp.c index 50fb03350..4544fa2cf 100644 --- a/raster/rt_core/rt_warp.c +++ b/raster/rt_core/rt_warp.c @@ -744,8 +744,8 @@ rt_raster rt_raster_gdal_warp( RASTER_DEBUGF(3, "Raster dimensions (width x height): %d x %d", _dim[0], _dim[1]); - if (FLT_EQ(_dim[0], 0) || FLT_EQ(_dim[1], 0)) { - rterror("rt_raster_gdal_warp: The width (%f) or height (%f) of the warped raster is zero", _dim[0], _dim[1]); + if ( _dim[0] == 0 || _dim[1] == 0 ) { + rterror("rt_raster_gdal_warp: The width (%d) or height (%d) of the warped raster is zero", _dim[0], _dim[1]); _rti_warp_arg_destroy(arg); return NULL; }