PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpointiterator_modify_next()

int lwpointiterator_modify_next ( LWPOINTITERATOR s,
const POINT4D p 
)

Attempts to replace the next point int the iterator with p, and advances the iterator to the next point.

Returns LW_SUCCESS if the assignment was successful, LW_FAILURE otherwise.

Definition at line 226 of file lwiterator.c.

References LWPOINTITERATOR::allow_modification, LWPOINTITERATOR::i, LISTNODE::item, LW_FAILURE, LW_SUCCESS, lwerror(), lwpointiterator_advance(), lwpointiterator_has_next(), LWPOINTITERATOR::pointarrays, and ptarray_set_point4d().

Referenced by test_cannot_modify_read_only(), test_mixed_rw_access(), and test_modification().

227 {
228  if (!lwpointiterator_has_next(s))
229  return LW_FAILURE;
230 
231  if (!s->allow_modification)
232  {
233  lwerror("Cannot write to read-only iterator");
234  return LW_FAILURE;
235  }
236 
238 
240  return LW_SUCCESS;
241 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:437
LISTNODE * pointarrays
Definition: lwiterator.c:47
#define LW_SUCCESS
Definition: liblwgeom.h:80
static int lwpointiterator_advance(LWPOINTITERATOR *s)
Definition: lwiterator.c:154
#define LW_FAILURE
Definition: liblwgeom.h:79
char allow_modification
Definition: lwiterator.c:49
int lwpointiterator_has_next(LWPOINTITERATOR *s)
Returns LW_TRUE if there is another point available in the iterator.
Definition: lwiterator.c:204
uint32_t i
Definition: lwiterator.c:48
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
void * item
Definition: lwiterator.c:32
Here is the call graph for this function:
Here is the caller graph for this function: