Skip to content

Commit

Permalink
Rast_incr_void_ptr moved back to libgis
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/grass/grass/trunk@38073 15284696-431f-4ddb-bdfa-cd5b030d7da7
  • Loading branch information
landam committed Jun 25, 2009
1 parent 8db528a commit 6126234
Show file tree
Hide file tree
Showing 57 changed files with 241 additions and 241 deletions.
8 changes: 4 additions & 4 deletions display/d.rast.arrow/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,10 @@ int main(int argc, char **argv)
}

if (no_arrow) {
ptr = Rast_incr_void_ptr(ptr, Rast_raster_size(raster_type));
ptr = G_incr_void_ptr(ptr, Rast_raster_size(raster_type));
if (opt7->answer)
mag_ptr =
Rast_incr_void_ptr(mag_ptr,
G_incr_void_ptr(mag_ptr,
Rast_raster_size(mag_raster_type));
no_arrow = FALSE;
continue;
Expand Down Expand Up @@ -494,10 +494,10 @@ int main(int argc, char **argv)
}
}

ptr = Rast_incr_void_ptr(ptr, Rast_raster_size(raster_type));
ptr = G_incr_void_ptr(ptr, Rast_raster_size(raster_type));
if (opt7->answer)
mag_ptr =
Rast_incr_void_ptr(mag_ptr, Rast_raster_size(mag_raster_type));
G_incr_void_ptr(mag_ptr, Rast_raster_size(mag_raster_type));
}
}

Expand Down
4 changes: 2 additions & 2 deletions general/g.region/zoom.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int zoom(struct Cell_head *window, const char *name, const char *mapset)
for (col = 0; col < ncols; col++) {
if (!Rast_is_null_value(rast_ptr, map_type))
break;
rast_ptr = Rast_incr_void_ptr(rast_ptr, Rast_raster_size(map_type));
rast_ptr = G_incr_void_ptr(rast_ptr, Rast_raster_size(map_type));
}
if (col == ncols)
continue;
Expand All @@ -50,7 +50,7 @@ int zoom(struct Cell_head *window, const char *name, const char *mapset)
for (mark = col; col < ncols; col++) {
if (!Rast_is_null_value(rast_ptr, map_type))
mark = col;
rast_ptr = Rast_incr_void_ptr(rast_ptr, Rast_raster_size(map_type));
rast_ptr = G_incr_void_ptr(rast_ptr, Rast_raster_size(map_type));
}
if (mark > right)
right = mark;
Expand Down
24 changes: 12 additions & 12 deletions imagery/i.pca/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ static int calc_mu(int *fds, double *mu, int bands)
for (col = 0; col < cols; col++) {
/* skip null cells */
if (Rast_is_null_value(rowbuf, maptype)) {
ptr = Rast_incr_void_ptr(ptr, Rast_raster_size(maptype));
ptr = G_incr_void_ptr(ptr, Rast_raster_size(maptype));
continue;
}

sum += Rast_get_raster_value_d(rowbuf, maptype);
ptr = Rast_incr_void_ptr(ptr, Rast_raster_size(maptype));
ptr = G_incr_void_ptr(ptr, Rast_raster_size(maptype));
}
}

Expand Down Expand Up @@ -327,8 +327,8 @@ static int calc_covariance(int *fds, double **covar, double *mu, int bands)
/* skip null cells */
if (Rast_is_null_value(ptr1, maptype) ||
Rast_is_null_value(ptr2, maptype2)) {
ptr1 = Rast_incr_void_ptr(ptr1, Rast_raster_size(maptype));
ptr2 = Rast_incr_void_ptr(ptr2, Rast_raster_size(maptype2));
ptr1 = G_incr_void_ptr(ptr1, Rast_raster_size(maptype));
ptr2 = G_incr_void_ptr(ptr2, Rast_raster_size(maptype2));
continue;
}

Expand All @@ -337,8 +337,8 @@ static int calc_covariance(int *fds, double **covar, double *mu, int bands)
mu[j]) * ((double)Rast_get_raster_value_d(ptr2,
maptype2) - mu[k]);

ptr1 = Rast_incr_void_ptr(ptr1, Rast_raster_size(maptype));
ptr2 = Rast_incr_void_ptr(ptr2, Rast_raster_size(maptype2));
ptr1 = G_incr_void_ptr(ptr1, Rast_raster_size(maptype));
ptr2 = G_incr_void_ptr(ptr2, Rast_raster_size(maptype2));
}

covar[k][j] = covar[j][k];
Expand Down Expand Up @@ -445,16 +445,16 @@ write_pca(double **eigmat, int *inp_fd, char *out_basename,
if (Rast_is_null_value(rowptr, maptype)) {
if (scale) {
Rast_set_null_value(outptr, 1, CELL_TYPE);
outptr = Rast_incr_void_ptr(outptr, cell_mapsiz);
outptr = G_incr_void_ptr(outptr, cell_mapsiz);
}
else {
Rast_set_null_value(outptr, 1, DCELL_TYPE);
outptr =
Rast_incr_void_ptr(outptr, dcell_mapsiz);
G_incr_void_ptr(outptr, dcell_mapsiz);
}

rowptr =
Rast_incr_void_ptr(rowptr,
G_incr_void_ptr(rowptr,
Rast_raster_size(maptype));
continue;
}
Expand Down Expand Up @@ -502,11 +502,11 @@ write_pca(double **eigmat, int *inp_fd, char *out_basename,
}

outptr = (scale) ?
Rast_incr_void_ptr(outptr, cell_mapsiz) :
Rast_incr_void_ptr(outptr, dcell_mapsiz);
G_incr_void_ptr(outptr, cell_mapsiz) :
G_incr_void_ptr(outptr, dcell_mapsiz);

rowptr =
Rast_incr_void_ptr(rowptr, Rast_raster_size(maptype));
G_incr_void_ptr(rowptr, Rast_raster_size(maptype));
}
} /* for j = 0 to bands */

Expand Down
16 changes: 8 additions & 8 deletions imagery/i.rectify/perform.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int perform_georef(int infd, void *rast)
*/

if (Rast_get_raster_row_nomask
(infd, Rast_incr_void_ptr(rast, rast_size), row, map_type) < 0)
(infd, G_incr_void_ptr(rast, rast_size), row, map_type) < 0)
return 0;

for (i = curidx; i < matrix_rows; i++) {
Expand All @@ -54,7 +54,7 @@ int perform_georef(int infd, void *rast)
cmap = col_map[idx];
left = row_left[idx];
right = row_right[idx];
do_cell(row, Rast_incr_void_ptr(rast, rast_size), cell_buf[idx]);
do_cell(row, G_incr_void_ptr(rast, rast_size), cell_buf[idx]);

row_min[idx]++;
if (row_min[idx] > row_max[idx])
Expand All @@ -73,26 +73,26 @@ static int do_cell(int row, void *in, void *out)
void *inptr, *outptr;

for (; left <= right; left++) {
inptr = Rast_incr_void_ptr(in, cmap[left] * rast_size);
outptr = Rast_incr_void_ptr(out, left * rast_size);
inptr = G_incr_void_ptr(in, cmap[left] * rast_size);
outptr = G_incr_void_ptr(out, left * rast_size);
if (rmap[left] < 0)
continue;
if (rmap[left] != row)
break;
Rast_raster_cpy(outptr, inptr, 1, map_type);
}
for (; left <= right; right--) {
inptr = Rast_incr_void_ptr(in, cmap[right] * rast_size);
outptr = Rast_incr_void_ptr(out, right * rast_size);
inptr = G_incr_void_ptr(in, cmap[right] * rast_size);
outptr = G_incr_void_ptr(out, right * rast_size);
if (rmap[right] < 0)
continue;
if (rmap[right] != row)
break;
Rast_raster_cpy(outptr, inptr, 1, map_type);
}
for (col = left; col <= right; col++) {
inptr = Rast_incr_void_ptr(in, cmap[col] * rast_size);
outptr = Rast_incr_void_ptr(out, col * rast_size);
inptr = G_incr_void_ptr(in, cmap[col] * rast_size);
outptr = G_incr_void_ptr(out, col * rast_size);
if (rmap[col] == row)
Rast_raster_cpy(outptr, inptr, 1, map_type);
}
Expand Down
1 change: 1 addition & 0 deletions include/gisdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void *G__malloc(const char *, int, size_t);
void *G__calloc(const char *, int, size_t, size_t);
void *G__realloc(const char *, int, void *, size_t);
void G_free(void *);
void *G_incr_void_ptr(const void *, const size_t);

#define G_malloc(n) G__malloc(__FILE__, __LINE__, (n))
#define G_calloc(m, n) G__calloc(__FILE__, __LINE__, (m), (n))
Expand Down
1 change: 0 additions & 1 deletion include/raster.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ void Rast_init_fp_range(struct FPRange *);
void Rast_get_fp_range_min_max(const struct FPRange *, DCELL *, DCELL *);

/* raster.c */
void *Rast_incr_void_ptr(const void *, const size_t);
int Rast_raster_cmp(const void *, const void *, RASTER_MAP_TYPE);
void Rast_raster_cpy(void *, const void *, int, RASTER_MAP_TYPE);
void Rast_set_raster_value_c(void *, CELL, RASTER_MAP_TYPE);
Expand Down
8 changes: 4 additions & 4 deletions lib/display/raster.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static int draw_cell(int A_row,
if (D__overlay_mode)
for (i = 0; i < ncols; i++) {
set[i] = Rast_is_null_value(array, data_type);
array = Rast_incr_void_ptr(array, Rast_raster_size(data_type));
array = G_incr_void_ptr(array, Rast_raster_size(data_type));
}

A_row =
Expand Down Expand Up @@ -178,9 +178,9 @@ int D_draw_raster_RGB(int A_row,
Rast_is_null_value(g_raster, g_type) ||
Rast_is_null_value(b_raster, b_type));

r_raster = Rast_incr_void_ptr(r_raster, r_size);
g_raster = Rast_incr_void_ptr(g_raster, g_size);
b_raster = Rast_incr_void_ptr(b_raster, b_size);
r_raster = G_incr_void_ptr(r_raster, r_size);
g_raster = G_incr_void_ptr(g_raster, g_size);
b_raster = G_incr_void_ptr(b_raster, b_size);
}

A_row = COM_raster(ncols, A_row, r_buf, g_buf, b_buf,
Expand Down
12 changes: 6 additions & 6 deletions lib/g3d/g3dfpxdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ int G3d_copyToXdr(const void *src, int nofNum)

if (useXdr == G3D_NO_XDR) {
G3d_copyValues(src, 0, srcType, xdrTmp, 0, type, nofNum);
xdrTmp = Rast_incr_void_ptr(xdrTmp, nofNum * G3d_externLength(type));
xdrTmp = G_incr_void_ptr(xdrTmp, nofNum * G3d_externLength(type));
return 1;
}

for (i = 0; i < nofNum; i++, src = Rast_incr_void_ptr(src, eltLength)) {
for (i = 0; i < nofNum; i++, src = G_incr_void_ptr(src, eltLength)) {

if (G3d_isNullValueNum(src, srcType)) {
G3d_setXdrNullNum(xdrTmp, isFloat);
Expand Down Expand Up @@ -185,7 +185,7 @@ int G3d_copyToXdr(const void *src, int nofNum)
}
}

xdrTmp = Rast_incr_void_ptr(xdrTmp, externLength);
xdrTmp = G_incr_void_ptr(xdrTmp, externLength);
}

return 1;
Expand Down Expand Up @@ -228,11 +228,11 @@ int G3d_copyFromXdr(int nofNum, void *dst)

if (useXdr == G3D_NO_XDR) {
G3d_copyValues(xdrTmp, 0, type, dst, 0, dstType, nofNum);
xdrTmp = Rast_incr_void_ptr(xdrTmp, nofNum * G3d_externLength(type));
xdrTmp = G_incr_void_ptr(xdrTmp, nofNum * G3d_externLength(type));
return 1;
}

for (i = 0; i < nofNum; i++, dst = Rast_incr_void_ptr(dst, eltLength)) {
for (i = 0; i < nofNum; i++, dst = G_incr_void_ptr(dst, eltLength)) {

if (G3d_isXdrNullNum(xdrTmp, isFloat)) {
G3d_setNullValue(dst, 1, dstType);
Expand Down Expand Up @@ -260,7 +260,7 @@ int G3d_copyFromXdr(int nofNum, void *dst)
}
}

xdrTmp = Rast_incr_void_ptr(xdrTmp, externLength);
xdrTmp = G_incr_void_ptr(xdrTmp, externLength);
}

return 1;
Expand Down
4 changes: 2 additions & 2 deletions lib/g3d/g3dmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ G3d_copyValues(const void *src, int offsSrc, int typeSrc, void *dst,

eltLength = G3d_length(typeSrc);

src = Rast_incr_void_ptr(src, eltLength * offsSrc);
dst = Rast_incr_void_ptr(dst, eltLength * offsDst);
src = G_incr_void_ptr(src, eltLength * offsSrc);
dst = G_incr_void_ptr(dst, eltLength * offsDst);

memcpy(dst, src, nElts * eltLength);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/g3d/g3drange.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ G3d_range_updateFromTile(G3D_Map * map, const void *tile, int rows, int cols,
for (z = 0; z < depths; z++) {
for (y = 0; y < rows; y++) {
Rast_row_update_fp_range(tile, cols, range, cellType);
tile = Rast_incr_void_ptr(tile, map->tileX * G3d_length(type));
tile = G_incr_void_ptr(tile, map->tileX * G3d_length(type));
}
if (yRedundant)
tile =
Rast_incr_void_ptr(tile,
G_incr_void_ptr(tile,
map->tileX * yRedundant *
G3d_length(type));
}
Expand All @@ -47,7 +47,7 @@ G3d_range_updateFromTile(G3D_Map * map, const void *tile, int rows, int cols,
if (yRedundant) {
for (z = 0; z < depths; z++) {
Rast_row_update_fp_range(tile, map->tileX * rows, range, cellType);
tile = Rast_incr_void_ptr(tile, map->tileXY * G3d_length(type));
tile = G_incr_void_ptr(tile, map->tileXY * G3d_length(type));
}
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/g3d/g3dvolume.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ G3d_makeAlignedVolumeFile(void *map, const char *fileName,
for (x = 0; x < nx; x++) {
/* G3d_putValueRegion? */
if (!G3d_putValue(mapVolume, x, y, z,
Rast_incr_void_ptr(volumeBuf,
G_incr_void_ptr(volumeBuf,
(z * ny * nx + y * nx +
x) * eltLength),
G3d_fileTypeMap(mapVolume)))
Expand Down
6 changes: 3 additions & 3 deletions lib/g3d/getblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ G3d_getBlock(G3D_Map * map, int x0, int y0, int z0, int nx, int ny, int nz,
for (y = y0; y < y1; y++) {
for (x = x0; x < x1; x++) {
G3d_getValueRegion(map, x, y, z, block, type);
block = Rast_incr_void_ptr(block, length);
block = G_incr_void_ptr(block, length);
}
nNull = x0 + nx - x;
G3d_setNullValue(block, nNull, type);
block = Rast_incr_void_ptr(block, length * nNull);
block = G_incr_void_ptr(block, length * nNull);
}
nNull = (y0 + ny - y) * nx;
G3d_setNullValue(block, nNull, type);
block = Rast_incr_void_ptr(block, length * nNull);
block = G_incr_void_ptr(block, length * nNull);
}
nNull = (z0 + nz - z) * ny * nx;
G3d_setNullValue(block, nNull, type);
Expand Down
12 changes: 6 additions & 6 deletions lib/g3d/tileread.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ G3d_xdrTile2tile(G3D_Map * map, void *tile, int rows, int cols, int depths,
G3d_error("G3d_xdrTile2tile: error in G3d_copyFromXdr");
return 0;
}
tile = Rast_incr_void_ptr(tile, cols * length);
tile = G_incr_void_ptr(tile, cols * length);
G3d_setNullValue(tile, xRedundant, type);
tile = Rast_incr_void_ptr(tile, xLength);
tile = G_incr_void_ptr(tile, xLength);
}
if (yRedundant) {
G3d_setNullValue(tile, map->tileX * yRedundant, type);
tile = Rast_incr_void_ptr(tile, yLength);
tile = G_incr_void_ptr(tile, yLength);
}
}
if (!zRedundant)
Expand All @@ -61,9 +61,9 @@ G3d_xdrTile2tile(G3D_Map * map, void *tile, int rows, int cols, int depths,
G3d_error("G3d_xdrTile2tile: error in G3d_copyFromXdr");
return 0;
}
tile = Rast_incr_void_ptr(tile, map->tileX * rows * length);
tile = G_incr_void_ptr(tile, map->tileX * rows * length);
G3d_setNullValue(tile, map->tileX * yRedundant, type);
tile = Rast_incr_void_ptr(tile, yLength);
tile = G_incr_void_ptr(tile, yLength);
}
if (!zRedundant)
return 1;
Expand All @@ -80,7 +80,7 @@ G3d_xdrTile2tile(G3D_Map * map, void *tile, int rows, int cols, int depths,
if (!zRedundant)
return 1;

tile = Rast_incr_void_ptr(tile, map->tileXY * depths * length);
tile = G_incr_void_ptr(tile, map->tileXY * depths * length);
G3d_setNullValue(tile, map->tileXY * zRedundant, type);

return 1;
Expand Down
6 changes: 3 additions & 3 deletions lib/g3d/tilewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ G3d_tile2xdrTile(G3D_Map * map, const void *tile, int rows, int cols,
G3d_error("G3d_tile2xdrTile: error in G3d_copyToXdr");
return 0;
}
tile = Rast_incr_void_ptr(tile, map->tileX * G3d_length(type));
tile = G_incr_void_ptr(tile, map->tileX * G3d_length(type));
}
if (yRedundant)
tile =
Rast_incr_void_ptr(tile,
G_incr_void_ptr(tile,
map->tileX * yRedundant *
G3d_length(type));
}
Expand All @@ -56,7 +56,7 @@ G3d_tile2xdrTile(G3D_Map * map, const void *tile, int rows, int cols,
G3d_error("G3d_tile2xdrTile: error in G3d_copyToXdr");
return 0;
}
tile = Rast_incr_void_ptr(tile, map->tileXY * G3d_length(type));
tile = G_incr_void_ptr(tile, map->tileXY * G3d_length(type));
}
return 1;
}
Expand Down
Loading

0 comments on commit 6126234

Please sign in to comment.