void
ptarray_reverse_in_place(POINTARRAY *pa)
{
- int i;
- int last = pa->npoints-1;
- int mid = pa->npoints/2;
+ if (!pa->npoints)
+ return;
+ uint32_t i;
+ uint32_t last = pa->npoints - 1;
+ uint32_t mid = pa->npoints / 2;
double *d = (double*)(pa->serialized_pointlist);
int j;
int field_precision, field_width;
char name[MAXFIELDNAMELEN];
char name2[MAXFIELDNAMELEN];
- DBFFieldType type = -1;
+ DBFFieldType type = FTInvalid;
char *utf8str;
/* If we are reading the entire shapefile, open it */
{
GSERIALIZED *pglwg1, *result;
LWLINE *line, *outline;
- uint32 which;
+ int32 which;
POSTGIS_DEBUG(2, "LWGEOM_removepoint called.");
line = lwgeom_as_lwline(lwgeom_from_gserialized(pglwg1));
- if (which > line->points->npoints - 1)
+ if (which < 0 || (uint32_t)which > line->points->npoints - 1)
{
- elog(ERROR, "Point index out of range (%d..%d)", 0, line->points->npoints - 1);
+ elog(ERROR, "Point index out of range (%u..%u)", 0, line->points->npoints - 1);
PG_RETURN_NULL();
}
PG_RETURN_NULL();
}
- outline = lwline_removepoint(line, which);
+ outline = lwline_removepoint(line, (uint32_t)which);
/* Release memory */
lwline_free(line);
LWLINE *line;
LWPOINT *lwpoint;
POINT4D newpoint;
- int32 which;
+ int64_t which;
POSTGIS_DEBUG(2, "LWGEOM_setpoint_linestring called.");
if (which < 0)
{
/* Use backward indexing for negative values */
- which = which + line->points->npoints;
+ which += (int64_t)line->points->npoints;
}
- if ((uint32_t)which + 1 > line->points->npoints)
+ if ((uint32_t)which > line->points->npoints - 1)
{
- elog(ERROR, "abs(Point index) out of range (-)(%d..%d)", 0, line->points->npoints - 1);
+ elog(ERROR, "abs(Point index) out of range (-)(%u..%u)", 0, line->points->npoints - 1);
PG_RETURN_NULL();
}