14 static const char null_bytes[8] = {
15 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
18 return memcmp(num, null_bytes, isFloat ? 4 : 8) == 0;
39 static const char null_bytes[8] = {
40 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
43 memcpy(num, null_bytes, isFloat ? 4 : 8);
77 map->numLengthIntern) +
81 G3d_error(
"G3d_initFpXdr: error in G3d_malloc");
87 else if (map->tileSize *
G3D_MAX(map->numLengthExtern,
88 map->numLengthIntern) + misuseBytes
91 map->numLengthIntern) +
95 G3d_error(
"G3d_initFpXdr: error in G3d_realloc");
113 static int dstType, srcType,
type, externLength, eltLength, isFloat, useXdr;
114 static int (*xdrFun) ();
116 static double tmpValue, *tmp;
121 useXdr = map->useXdr;
126 G3d_error(
"G3d_InitCopyToXdr: positioning xdr failed");
133 isFloat = (
type == FCELL_TYPE);
161 if (!xdr_setpos(xdrs, xdr_getpos(xdrs) + externLength)) {
162 G3d_error(
"G3d_copyToXdr: positioning xdr failed");
167 if (
type == srcType) {
168 if (xdrFun(xdrs, src) < 0) {
169 G3d_error(
"G3d_copyToXdr: writing xdr failed");
174 if (
type == FCELL_TYPE)
175 *((
float *)tmp) = (float)*((
double *)src);
177 *((
double *)tmp) = (double)*((
float *)src);
178 if (xdrFun(xdrs, tmp) < 0) {
179 G3d_error(
"G3d_copyToXdr: writing xdr failed");
196 useXdr = map->useXdr;
201 G3d_error(
"G3d_initCopyFromXdr: positioning xdr failed");
208 isFloat = (
type == FCELL_TYPE);
236 if (!xdr_setpos(xdrs, xdr_getpos(xdrs) + externLength)) {
237 G3d_error(
"G3d_copyFromXdr: positioning xdr failed");
242 if (
type == dstType) {
243 if (xdrFun(xdrs, dst) < 0) {
244 G3d_error(
"G3d_copyFromXdr: reading xdr failed");
249 if (xdrFun(xdrs, tmp) < 0) {
250 G3d_error(
"G3d_copyFromXdr: reading xdr failed");
253 if (
type == FCELL_TYPE)
254 *((
double *)dst) = (double)*((
float *)tmp);
256 *((
float *)dst) = (float)*((
double *)tmp);
int G3d_externLength(int t)
void G3d_setNullValue(void *c, int nofElts, int type)
Fills the vector pointed to by c with nofElts NULL-values of type.
void G3d_error(const char *msg,...)
int G3d_isNullValueNum(const void *n, int type)
void * G3d_realloc(void *ptr, int nBytes)
Same as realloc (ptr, nBytes), except that in case of error G3d_error() is invoked.
void G3d_setXdrNullNum(void *num, int isFloat)
void G3d_setXdrNullDouble(double *d)
void * G_incr_void_ptr(const void *ptr, const size_t size)
Advance void pointer.
int G3d_isXdrNullNum(const void *num, int isFloat)
void G3d_copyValues(const void *src, int offsSrc, int typeSrc, void *dst, int offsDst, int typeDst, int nElts)
int G3d_copyFromXdr(int nofNum, void *dst)
int G3d_copyToXdr(const void *src, int nofNum)
int G3d_initCopyFromXdr(G3D_Map *map, int dType)
int G3d_isXdrNullFloat(const float *f)
void * G3d_malloc(int nBytes)
Same as malloc (nBytes), except that in case of error G3d_error() is invoked.
int G3d_isXdrNullDouble(const double *d)
int G3d_initFpXdr(G3D_Map *map, int misuseBytes)
void G3d_setXdrNullFloat(float *f)
int G3d_initCopyToXdr(G3D_Map *map, int sType)