From 0444a6c71148395e54aa7700fcecadc815d0ea1e Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Thu, 21 Feb 2013 23:56:15 +0000 Subject: [PATCH] Fixed a couple of tests on Windows, Fixed some compile errors on Windows. --- libdispatch/dvarget.c | 3 ++- libdispatch/dvarput.c | 4 ++-- libsrc/memio.c | 2 +- nc_test4/CMakeLists.txt | 4 ++++ nc_test4/tst_atts1.c | 9 +++++---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/libdispatch/dvarget.c b/libdispatch/dvarget.c index e8593a84b..0a33b916f 100644 --- a/libdispatch/dvarget.c +++ b/libdispatch/dvarget.c @@ -128,6 +128,7 @@ NCDEFAULT_get_vars(int ncid, int varid, const size_t * start, size_t mystart[NC_MAX_VAR_DIMS]; size_t myedges[NC_MAX_VAR_DIMS]; ptrdiff_t mystride[NC_MAX_VAR_DIMS]; + char *memptr = NULL; status = NC_check_id (ncid, &ncp); if(status != NC_NOERR) return status; @@ -213,7 +214,7 @@ NCDEFAULT_get_vars(int ncid, int varid, const size_t * start, */ /* memptr indicates where to store the next value */ - char* memptr = value; + memptr = value; odom_init(&odom,rank,mystart,myedges,mystride); diff --git a/libdispatch/dvarput.c b/libdispatch/dvarput.c index cd6af2aec..90f0b9395 100644 --- a/libdispatch/dvarput.c +++ b/libdispatch/dvarput.c @@ -134,6 +134,8 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start, size_t myedges[NC_MAX_VAR_DIMS]; ptrdiff_t mystride[NC_MAX_VAR_DIMS]; + const char* memptr = value; + status = NC_check_id (ncid, &ncp); if(status != NC_NOERR) return status; @@ -220,8 +222,6 @@ NCDEFAULT_put_vars(int ncid, int varid, const size_t * start, to read larger chunks at a time. */ - /* memptr indicates where to store the next value */ - const char* memptr = value; odom_init(&odom,rank,mystart,myedges,mystride); diff --git a/libsrc/memio.c b/libsrc/memio.c index c680c9d6d..bd3191e7f 100644 --- a/libsrc/memio.c +++ b/libsrc/memio.c @@ -428,7 +428,7 @@ memio_pad_length(ncio* nciop, off_t length) if(newmem == NULL) return NC_ENOMEM; /* zero out the extra memory */ - memset((void*)(newmem+memio->alloc),0,(newsize - memio->alloc)); + memset((void*)((char*)newmem+memio->alloc),0,(newsize - memio->alloc)); #ifdef DEBUG fprintf(stderr,"realloc: %lu/%lu -> %lu/%lu\n", diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt index 80772487c..f1e12d431 100644 --- a/nc_test4/CMakeLists.txt +++ b/nc_test4/CMakeLists.txt @@ -41,6 +41,10 @@ ENDIF() # Copy some test files from current source dir to out-of-tree build dir. FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.sh) FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) +IF(MSVC) + FILE(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/) +ENDIF() + FOREACH(CTEST ${NC4_TESTS}) add_bin_test(nc_test4 ${CTEST}) diff --git a/nc_test4/tst_atts1.c b/nc_test4/tst_atts1.c index 1f9552ab3..e0fef7a40 100644 --- a/nc_test4/tst_atts1.c +++ b/nc_test4/tst_atts1.c @@ -120,7 +120,6 @@ tst_att_ordering(int cmode) int main(int argc, char **argv) { - (void) signal(SIGFPE, SIG_IGN); signed char schar_in[ATT_LEN], schar_out[ATT_LEN] = {NC_MIN_BYTE, 1, NC_MAX_BYTE}; unsigned char uchar_in[ATT_LEN], uchar_out[ATT_LEN] = {0, 128, NC_MAX_UBYTE}; @@ -133,7 +132,8 @@ main(int argc, char **argv) double double_in[ATT_LEN], double_out[ATT_LEN] = {-0.25, .5, 0.125}; long long longlong_in[ATT_LEN], longlong_out[ATT_LEN] = {-3123456789LL, 128LL, 3123456789LL}; unsigned long long ulonglong_in[ATT_LEN], ulonglong_out[ATT_LEN] = {0LL, 128LL, 3123456789LL}; - + + (void) signal(SIGFPE, SIG_IGN); printf("\n*** Testing netcdf-4 attribute functions.\n"); printf("*** testing really simple global atts..."); #define NUM_SIMPLE_ATTS 9 @@ -351,9 +351,10 @@ main(int argc, char **argv) /* for (i = 0; i < ATT_LEN; i++) */ /* if (float_in[i] != (float) longlong_out[i]) ERR; */ if (nc_get_att_float(ncid, NC_GLOBAL, ATT_UINT64_NAME, float_in)) ERR; - for (i = 0; i < ATT_LEN; i++) +#if !defined(_WIN32) && !defined(_WIN64) + for (i = 0; i < ATT_LEN; i++) if (float_in[i] != (float) ulonglong_out[i]) ERR; - +#endif /* Read all atts (except text) as int. */ if (nc_get_att_int(ncid, NC_GLOBAL, ATT_SCHAR_NAME, int_in)) ERR; for (i = 0; i < ATT_LEN; i++)