int pj_apply_gridshift( projCtx ctx, const char *nadgrids, int inverse, long point_count, int point_offset, double *x, double *y, double *z ) { PJ_GRIDINFO **gridlist; int grid_count; int ret; gridlist = pj_gridlist_from_nadgrids( ctx, nadgrids, &grid_count ); if( gridlist == NULL || grid_count == 0 ) return ctx->last_errno; ret = pj_apply_gridshift_3( ctx, gridlist, grid_count, inverse, point_count, point_offset, x, y, z ); /* ** Note this frees the array of grid list pointers, but not the grids ** which is as intended. The grids themselves live on. */ pj_dalloc( gridlist ); return ret; }
int pj_apply_gridshift_2( PJ *defn, int inverse, long point_count, int point_offset, double *x, double *y, double *z ) { if( defn->gridlist == NULL ) { defn->gridlist = pj_gridlist_from_nadgrids( pj_get_ctx( defn ), pj_param(defn->ctx, defn->params,"snadgrids").s, &(defn->gridlist_count) ); if( defn->gridlist == NULL || defn->gridlist_count == 0 ) return defn->ctx->last_errno; } return pj_apply_gridshift_3( pj_get_ctx( defn ), defn->gridlist, defn->gridlist_count, inverse, point_count, point_offset, x, y, z ); }