/********************************************************************* * Copyright 1993, UCAR/Unidata * See netcdf/COPYRIGHT file for copying and redistribution conditions. *********************************************************************/ #include "config.h" #include "dapincludes.h" #ifdef _MSC_VER #include #endif NCerror dapconvert(nc_type srctype, nc_type dsttype, char* memory0, char* value0, size_t count) { NCerror ncstat = NC_NOERR; size_t i; char* memory = memory0; char* value = value0; /* In order to deal with the DAP upgrade problem, try to preserve the bit patterns */ /* Provide space and pointer casts for intermediate results */ signed char ncbyte; signed char* ncbytep; char ncchar; char* nccharp; short ncshort; short* ncshortp; int ncint; int* ncintp; float ncfloat; float* ncfloatp; double ncdouble; double* ncdoublep; unsigned char ncubyte; unsigned char* ncubytep; unsigned short ncushort; unsigned short* ncushortp; unsigned int ncuint; unsigned int* ncuintp; long long ncint64; long long* ncint64p; unsigned long long ncuint64; unsigned long long* ncuint64p; #define CASE(nc1,nc2) (nc1*256+nc2) #define CUT8(e) ((unsigned char)((e) & 0xff)) #define CUT16(e) ((unsigned short)((e) & 0xffff)) #define CUT32(e) ((unsigned int)((e) & 0xffffffff)) #define ARM(vs,ncs,ts,vd,ncd,td) \ case CASE(ncs,ncd):\ vs##p = (ts *)value;\ vs = *vs##p;\ vd##p = (td *)memory;\ *vd##p = (td)vs;\ break; for(i=0;i