10 G3d_xdrTile2tile(G3D_Map *
map,
void *tile,
int rows,
int cols,
int depths,
11 int xRedundant,
int yRedundant,
int zRedundant,
int nofNum,
14 int y, z, xLength, yLength, length;
17 G3d_error(
"G3d_xdrTile2tile: error in G3d_initCopyFromXdr");
21 if (nofNum == map->tileSize) {
23 G3d_error(
"G3d_xdrTile2tile: error in G3d_copyFromXdr");
30 xLength = xRedundant * length;
31 yLength = map->tileX * yRedundant * length;
34 for (z = 0; z < depths; z++) {
35 for (y = 0; y < rows; y++) {
37 G3d_error(
"G3d_xdrTile2tile: error in G3d_copyFromXdr");
57 for (z = 0; z < depths; z++) {
59 G3d_error(
"G3d_xdrTile2tile: error in G3d_copyFromXdr");
74 G3d_error(
"G3d_xdrTile2tile: error in G3d_copyFromXdr");
89 static int G3d_readTileUncompressed(G3D_Map * map,
int tileIndex,
int nofNum)
93 nofBytes = nofNum * map->numLengthExtern;
94 nofBytes =
G3D_MIN(nofBytes, map->fileEndPtr - map->index[tileIndex]);
96 if (read(map->data_fd,
xdr, nofBytes) != nofBytes) {
97 G3d_error(
"G3d_readTileUncompressed: can't read file");
106 static int G3d_readTileCompressed(G3D_Map * map,
int tileIndex,
int nofNum)
109 map->tileLength[tileIndex],
111 map->type == FCELL_TYPE)) {
113 (
"G3d_readTileCompressed: error in G_fpcompress_readXdrNums");
147 int nofNum, rows,
cols, depths, xRedundant, yRedundant, zRedundant;
149 if ((tileIndex >= map->nTiles) || (tileIndex < 0))
152 if (map->index[tileIndex] == -1) {
158 &rows, &cols, &depths,
159 &xRedundant, &yRedundant,
162 if (lseek(map->data_fd, map->index[tileIndex], SEEK_SET) == -1) {
163 G3d_error(
"G3d_readTile: can't position file");
167 if (map->compression == G3D_NO_COMPRESSION) {
168 if (!G3d_readTileUncompressed(map, tileIndex, nofNum)) {
169 G3d_error(
"G3d_readTile: error in G3d_readTileUncompressed");
173 else if (!G3d_readTileCompressed(map, tileIndex, nofNum)) {
174 G3d_error(
"G3d_readTile: error in G3d_readTileCompressed");
178 if (!G3d_xdrTile2tile(map, tile, rows, cols, depths,
179 xRedundant, yRedundant, zRedundant, nofNum, type)) {
180 G3d_error(
"G3d_readTile: error in G3d_xdrTile2tile");
208 G3d_error(
"G3d_readTileFloat: error in G3d_readTile");
232 G3d_error(
"G3d_readTileDouble: error in G3d_readTile");
262 G3d_fatalError(
"G3d_lockTile: function invalid in non-cache mode");
265 G3d_error(
"G3d_lockTile: error in G3d_cache_lock");
289 G3d_fatalError(
"G3d_unlockTile: function invalid in non-cache mode");
292 G3d_error(
"G3d_unlockTile: error in G3d_cache_unlock");
315 G3d_fatalError(
"G3d_unlockAll: function invalid in non-cache mode");
318 G3d_error(
"G3d_unlockAll: error in G3d_cache_unlock_all");
340 G3d_fatalError(
"G3d_autoLockOn: function invalid in non-cache mode");
360 G3d_fatalError(
"G3d_autoLockOff: function invalid in non-cache mode");
389 G3d_fatalError(
"G3d_autoLockOff: function invalid in non-cache mode");