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