15 static const char null_bytes[8] = {(char)0xFF, (
char)0xFF, (char)0xFF,
16 (
char)0xFF, (char)0xFF, (
char)0xFF,
17 (char)0xFF, (
char)0xFF};
19 return memcmp(num, null_bytes, isFloat ? 4 : 8) == 0;
40 static const char null_bytes[8] = {(char)0xFF, (
char)0xFF, (char)0xFF,
41 (
char)0xFF, (char)0xFF, (
char)0xFF,
42 (char)0xFF, (
char)0xFF};
44 memcpy(num, null_bytes, isFloat ? 4 : 8);
63 static size_t xdr_off;
75 Rast3d_error(
"Rast3d_init_fp_xdr: error in Rast3d_malloc");
88 Rast3d_error(
"Rast3d_init_fp_xdr: error in Rast3d_realloc");
99 static int dstType, srcType, type, externLength, eltLength, isFloat, useXdr;
100 static double tmpValue, *tmp;
122 static int xdr_put(
const void *src)
155 xdr_off += externLength;
158 if (type == srcType) {
166 *((
float *)tmp) = (float)*((
double *)src);
168 *((
double *)tmp) = (double)*((
float *)src);
204 static int xdr_get(
void *src)
237 xdr_off += externLength;
240 if (type == dstType) {
242 Rast3d_error(
"Rast3d_copy_from_xdr: reading xdr failed");
248 Rast3d_error(
"Rast3d_copy_from_xdr: reading xdr failed");
252 *((
double *)dst) = (double)*((
float *)tmp);
254 *((
float *)dst) = (float)*((
double *)tmp);
void G_xdr_put_float(void *, const float *)
void G_xdr_get_float(float *, const void *)
void G_xdr_put_double(void *, const double *)
void G_xdr_get_double(double *, const void *)
#define G_incr_void_ptr(ptr, size)
void Rast3d_copy_values(const void *, int, int, void *, int, int, int)
void * Rast3d_realloc(void *, int)
Same as realloc (ptr, nBytes), except that in case of error Rast3d_error() is invoked.
void Rast3d_set_null_value(void *, int, int)
Fills the vector pointed to by c with nofElts NULL-values of type.
int Rast3d_is_null_value_num(const void *, int)
int Rast3d_extern_length(int)
void Rast3d_error(const char *,...) __attribute__((format(printf
void * Rast3d_malloc(int)
Same as malloc (nBytes), except that in case of error Rast3d_error() is invoked.
int Rast3d_init_copy_from_xdr(RASTER3D_Map *map, int dType)
int Rast3d_init_fp_xdr(RASTER3D_Map *map, int misuseBytes)
void Rast3d_set_xdr_null_num(void *num, int isFloat)
int Rast3d_init_copy_to_xdr(RASTER3D_Map *map, int sType)
void Rast3d_set_xdr_null_float(float *f)
void Rast3d_set_xdr_null_double(double *d)
int Rast3d_is_xdr_null_float(const float *f)
int Rast3d_is_xdr_null_num(const void *num, int isFloat)
int Rast3d_copy_from_xdr(int nofNum, void *dst)
int Rast3d_is_xdr_null_double(const double *d)
int Rast3d_copy_to_xdr(const void *src, int nofNum)
#define RASTER3D_XDR_DOUBLE_LENGTH
#define RASTER3D_XDR_FLOAT_LENGTH
#define RASTER3D_MAX(a, b)