Merge branch 'main' into execinfo.dmh

This commit is contained in:
Ward Fisher 2023-11-15 15:54:35 -07:00 committed by GitHub
commit 807c6ef3f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 312 additions and 280 deletions

View File

@ -7,7 +7,10 @@ This file contains a high-level description of this package's evolution. Release
## 4.9.3 - TBD
* Remove the use of execinfo to programmatically dump the stack; it never worked. See [Github #2789](https://github.com/Unidata/netcdf-c/pull/2789).
* Update the internal copy of tinyxml2 to latest code. See [Github #2771](https://github.com/Unidata/netcdf-c/pull/2771).
* Mitigate the problem of remote/nczarr-related test interference. See [Github #2755](https://github.com/Unidata/netcdf-c/pull/2755).
* Fix DAP2 proxy problems. See [Github #2764](https://github.com/Unidata/netcdf-c/pull/2764).
* Cleanup a number of misc issues. See [Github #2763](https://github.com/Unidata/netcdf-c/pull/2763).
* Mitigate the problem of test interference. See [Github #2755](https://github.com/Unidata/netcdf-c/pull/2755).

View File

@ -857,129 +857,136 @@ AC_MSG_RESULT([${have_sz}])
##########
# See if we have libzip for NCZarr
AC_SEARCH_LIBS([zip_open],[zip zip.dll cygzip.dll],[have_zip=yes],[have_zip=no])
AC_MSG_CHECKING([whether libzip library is available])
AC_MSG_RESULT([${have_zip}])
enable_nczarr_zip=${have_zip} # alias
##
# Check to see if we're using NCZarr. If not, we don't need to check for dependencies and such.
##
if test "x$enable_nczarr" = xno ; then
enable_nczarr_zip=no
fi
AC_MSG_CHECKING([whether nczarr zip support is enabled])
AC_MSG_RESULT([${enable_nczarr_zip}])
if test "x$enable_nczarr_zip" = xyes ; then
AC_DEFINE([ENABLE_NCZARR_ZIP], [1], [If true, then libzip found])
fi
# Check for enabling of S3 support
AC_MSG_CHECKING([whether netcdf S3 support should be enabled])
AC_ARG_ENABLE([s3],
[AS_HELP_STRING([--enable-s3],
[enable netcdf S3 support])])
test "x$enable_s3" = xyes || enable_s3=no
AC_MSG_RESULT($enable_s3)
if test "x$enable_remote_functionality" = xno ; then
AC_MSG_WARN([--disable-remote-functionality => --disable-s3])
enable_s3=no
fi
# --enable-nczarr-s3 is synonym for --enable-s3 (but...)
AC_MSG_CHECKING([whether netcdf NCZarr S3 support should be enabled])
AC_ARG_ENABLE([nczarr-s3],
[AS_HELP_STRING([--enable-nczarr-s3],
[(Deprecated) enable netcdf NCZarr S3 support; Deprecated in favor of --enable-s3])])
AC_MSG_RESULT([$enable_nczarr_s3 (Deprecated) Please use --enable-s3)])
# Set enable_s3 instead of enable_nczarr_s3
if test "x$enable_s3" = xno && test "x$enable_nczarr_s3" = xyes && test "x$enable_remote_functionality" = xyes; then
enable_s3=yes # back compatibility
fi
unset enable_nczarr_s3
# Note we check for the library after checking for enable_s3
# because for some reason this fails if we unconditionally test for sdk
# and it is not available. Fix someday
S3LIBS=""
if test "x$enable_s3" = xyes ; then
# See if we have the s3 aws library
# Check for the AWS S3 SDK library
AC_LANG_PUSH([C++])
AC_CHECK_LIB([aws-c-common], [aws_string_destroy], [enable_s3_aws=yes],[enable_s3_aws=no])
if test "x$enable_s3_aws" = "xyes" ; then
S3LIBS="-laws-cpp-sdk-core -laws-cpp-sdk-s3"
fi
AC_LANG_POP
else
# See if we have libzip for NCZarr
AC_SEARCH_LIBS([zip_open],[zip zip.dll cygzip.dll],[have_zip=yes],[have_zip=no])
AC_MSG_CHECKING([whether libzip library is available])
AC_MSG_RESULT([${have_zip}])
enable_nczarr_zip=${have_zip} # alias
AC_MSG_CHECKING([whether nczarr zip support is enabled])
AC_MSG_RESULT([${enable_nczarr_zip}])
if test "x$enable_nczarr_zip" = xyes ; then
AC_DEFINE([ENABLE_NCZARR_ZIP], [1], [If true, then libzip found])
fi
# Check for enabling of S3 support
AC_MSG_CHECKING([whether netcdf S3 support should be enabled])
AC_ARG_ENABLE([s3],
[AS_HELP_STRING([--enable-s3],
[enable netcdf S3 support])])
test "x$enable_s3" = xyes || enable_s3=no
AC_MSG_RESULT($enable_s3)
if test "x$enable_remote_functionality" = xno ; then
AC_MSG_WARN([--disable-remote-functionality => --disable-s3])
enable_s3=no
fi
# --enable-nczarr-s3 is synonym for --enable-s3 (but...)
AC_MSG_CHECKING([whether netcdf NCZarr S3 support should be enabled])
AC_ARG_ENABLE([nczarr-s3],
[AS_HELP_STRING([--enable-nczarr-s3],
[(Deprecated) enable netcdf NCZarr S3 support; Deprecated in favor of --enable-s3])])
AC_MSG_RESULT([$enable_nczarr_s3 (Deprecated) Please use --enable-s3)])
# Set enable_s3 instead of enable_nczarr_s3
if test "x$enable_s3" = xno && test "x$enable_nczarr_s3" = xyes && test "x$enable_remote_functionality" = xyes; then
enable_s3=yes # back compatibility
fi
unset enable_nczarr_s3
# Note we check for the library after checking for enable_s3
# because for some reason this fails if we unconditionally test for sdk
# and it is not available. Fix someday
S3LIBS=""
if test "x$enable_s3" = xyes ; then
# See if we have the s3 aws library
# Check for the AWS S3 SDK library
AC_LANG_PUSH([C++])
AC_CHECK_LIB([aws-c-common], [aws_string_destroy], [enable_s3_aws=yes],[enable_s3_aws=no])
if test "x$enable_s3_aws" = "xyes" ; then
S3LIBS="-laws-cpp-sdk-core -laws-cpp-sdk-s3"
fi
AC_LANG_POP
else
enable_s3_aws=no
fi
AC_MSG_CHECKING([whether AWS S3 SDK library is available])
AC_MSG_RESULT([$enable_s3_aws])
# Check for enabling forced use of Internal S3 library
AC_MSG_CHECKING([whether internal S3 support should be used])
AC_ARG_ENABLE([s3-internal],
[AS_HELP_STRING([--enable-s3-internal],
[enable internal S3 support])])
test "x$enable_s3_internal" = xyes || enable_s3_internal=no
AC_MSG_RESULT($enable_s3_internal)
if test "x$enable_s3_aws" = xno && test "x$enable_s3_internal" = xno ; then
AC_MSG_WARN([No S3 library available => S3 support disabled])
enable_s3=no
fi
if test "x$enable_s3_aws" = xyes && test "x$enable_s3_internal" = xyes ; then
AC_MSG_WARN([Both aws-sdk-cpp and s3-internal enabled => use s3-internal.])
enable_s3_aws=no
fi
fi
AC_MSG_CHECKING([whether AWS S3 SDK library is available])
AC_MSG_RESULT([$enable_s3_aws])
if test "x$enable_s3_internal" = xyes ; then
if test "x$ISOSX" != xyes && test "x$ISMINGW" != xyes && test "x$ISMSVC" != xyes ; then
# Find crypto libraries if using ssl
AC_CHECK_LIB([ssl],[ssl_create_cipher_list])
AC_CHECK_LIB([crypto],[SHA256])
fi
fi
# Check for enabling forced use of Internal S3 library
AC_MSG_CHECKING([whether internal S3 support should be used])
AC_ARG_ENABLE([s3-internal],
[AS_HELP_STRING([--enable-s3-internal],
[enable internal S3 support])])
test "x$enable_s3_internal" = xyes || enable_s3_internal=no
AC_MSG_RESULT($enable_s3_internal)
# Check for enabling S3 testing
AC_MSG_CHECKING([what level of netcdf S3 testing should be enabled])
AC_ARG_WITH([s3-testing],
[AS_HELP_STRING([--with-s3-testing=yes|no|public],
[control netcdf S3 testing])],
[], [with_s3_testing=public])
AC_MSG_RESULT($with_s3_testing)
if test "x$enable_s3_aws" = xno && test "x$enable_s3_internal" = xno ; then
AC_MSG_WARN([No S3 library available => S3 support disabled])
enable_s3=no
fi
# Disable S3 tests if S3 support is disabled
if test "x$enable_s3" = xno ; then
if test "x$with_s3_testing" != xno ; then
AC_MSG_WARN([S3 support is disabled => no testing])
with_s3_testing=no
fi
fi
if test "x$enable_s3_aws" = xyes && test "x$enable_s3_internal" = xyes ; then
AC_MSG_WARN([Both aws-sdk-cpp and s3-internal enabled => use s3-internal.])
enable_s3_aws=no
fi
if test "x$enable_s3" = xyes ; then
AC_DEFINE([ENABLE_S3], [1], [if true, build netcdf-c with S3 support enabled])
fi
if test "x$enable_s3_internal" = xyes ; then
if test "x$ISOSX" != xyes && test "x$ISMINGW" != xyes && test "x$ISMSVC" != xyes ; then
# Find crypto libraries if using ssl
AC_CHECK_LIB([ssl],[ssl_create_cipher_list])
AC_CHECK_LIB([crypto],[SHA256])
fi
fi
if test "x$enable_s3_aws" = xyes ; then
LIBS="$LIBS$S3LIBS"
AC_DEFINE([ENABLE_S3_AWS], [1], [If true, then use aws S3 library])
fi
# Check for enabling S3 testing
AC_MSG_CHECKING([what level of netcdf S3 testing should be enabled])
AC_ARG_WITH([s3-testing],
[AS_HELP_STRING([--with-s3-testing=yes|no|public],
[control netcdf S3 testing])],
[], [with_s3_testing=public])
AC_MSG_RESULT($with_s3_testing)
if test "x$enable_s3_internal" = xyes ; then
AC_DEFINE([ENABLE_S3_INTERNAL], [1], [If true, then use internal S3 library])
fi
# Disable S3 tests if S3 support is disabled
if test "x$enable_s3" = xno ; then
if test "x$with_s3_testing" != xno ; then
AC_MSG_WARN([S3 support is disabled => no testing])
with_s3_testing=no
fi
fi
AC_DEFINE_UNQUOTED([WITH_S3_TESTING], [$with_s3_testing], [control S3 testing.])
if test "x$enable_s3" = xyes ; then
AC_DEFINE([ENABLE_S3], [1], [if true, build netcdf-c with S3 support enabled])
fi
if test "x$enable_s3_aws" = xyes ; then
LIBS="$LIBS$S3LIBS"
AC_DEFINE([ENABLE_S3_AWS], [1], [If true, then use aws S3 library])
fi
if test "x$enable_s3_internal" = xyes ; then
AC_DEFINE([ENABLE_S3_INTERNAL], [1], [If true, then use internal S3 library])
fi
AC_DEFINE_UNQUOTED([WITH_S3_TESTING], [$with_s3_testing], [control S3 testing.])
if test "x$with_s3_testing" = xyes ; then
AC_MSG_WARN([*** DO NOT SPECIFY WITH_S3_TESTING=YES UNLESS YOU HAVE ACCESS TO THE UNIDATA S3 BUCKET! ***])
AC_DEFINE([ENABLE_S3_TESTALL], [yes], [control S3 testing.])
if test "x$with_s3_testing" = xyes ; then
AC_MSG_WARN([*** DO NOT SPECIFY WITH_S3_TESTING=YES UNLESS YOU HAVE ACCESS TO THE UNIDATA S3 BUCKET! ***])
AC_DEFINE([ENABLE_S3_TESTALL], [yes], [control S3 testing.])
fi
fi
# Check whether we want to enable strict null byte header padding.

View File

@ -45,7 +45,7 @@ main()
/* Create a bunch of phoney data so we have something to write in
the example file. */
for (fp=(float *)temp, i=0; i<LAT_LEN*LON_LEN; i++)
*fp++ = 10. + i/10.;
*fp++ = 10.f + (float)i/10.f;
/* Now create the file in both formats with the same code. */
for (i=0; i<2; i++)

View File

@ -40,10 +40,10 @@
#define DEGREES_NORTH "degrees_north"
/* These are used to construct some example data. */
#define SAMPLE_PRESSURE 900
#define SAMPLE_TEMP 9.0
#define START_LAT 25.0
#define START_LON -125.0
#define SAMPLE_PRESSURE 900.0f
#define SAMPLE_TEMP 9.0f
#define START_LAT 25.0f
#define START_LON -125.0f
/* For the units attributes. */
#define UNITS "units"
@ -87,16 +87,16 @@ main()
* would have some real data to write, for example, model
* output. */
for (lat = 0; lat < NLAT; lat++)
lats[lat] = START_LAT + 5.*lat;
lats[lat] = START_LAT + 5.f*(float)lat;
for (lon = 0; lon < NLON; lon++)
lons[lon] = START_LON + 5.*lon;
lons[lon] = START_LON + 5.f*(float)lon;
for (lvl = 0; lvl < NLVL; lvl++)
for (lat = 0; lat < NLAT; lat++)
for (lon = 0; lon < NLON; lon++)
{
pres_out[lvl][lat][lon] = SAMPLE_PRESSURE + i;
temp_out[lvl][lat][lon] = SAMPLE_TEMP + i++;
pres_out[lvl][lat][lon] = SAMPLE_PRESSURE + (float)i;
temp_out[lvl][lat][lon] = SAMPLE_TEMP + (float)i++;
}
/* Create the file. */

View File

@ -35,10 +35,10 @@
#define DEGREES_NORTH "degrees_north"
/* These are used to construct some example data. */
#define SAMPLE_PRESSURE 900
#define SAMPLE_TEMP 9.0
#define START_LAT 25.0
#define START_LON -125.0
#define SAMPLE_PRESSURE 900.0f
#define SAMPLE_TEMP 9.0f
#define START_LAT 25.0f
#define START_LON -125.0f
/* Handle errors by printing an error message and exiting with a
* non-zero status. */
@ -78,15 +78,15 @@ main()
* would have some real data to write, for example, model
* output. */
for (lat = 0; lat < NLAT; lat++)
lats[lat] = START_LAT + 5.*lat;
lats[lat] = START_LAT + 5.f*(float)lat;
for (lon = 0; lon < NLON; lon++)
lons[lon] = START_LON + 5.*lon;
lons[lon] = START_LON + 5.f*(float)lon;
for (lat = 0; lat < NLAT; lat++)
for (lon = 0; lon < NLON; lon++)
{
pres_out[lat][lon] = SAMPLE_PRESSURE + (lon * NLAT + lat);
temp_out[lat][lon] = SAMPLE_TEMP + .25 * (lon * NLAT + lat);
pres_out[lat][lon] = SAMPLE_PRESSURE + (float)(lon * NLAT + lat);
temp_out[lat][lon] = SAMPLE_TEMP + .25f * (float)(lon * NLAT + lat);
}
/* Create the file. */

View File

@ -75,7 +75,7 @@ main()
if (!(cvc_out[i].data[j].p = calloc(sizeof(struct s1), cvc_out[i].data[j].len))) ERR;
for (k = 0; k < cvc_out[i].data[j].len; k++)
{
((struct s1 *)cvc_out[i].data[j].p)[k].x = 42.42;
((struct s1 *)cvc_out[i].data[j].p)[k].x = 42.42f;
((struct s1 *)cvc_out[i].data[j].p)[k].y = 2.0;
}
}

View File

@ -75,7 +75,7 @@ main()
if (!(vc_out[i].p = calloc(sizeof(struct s1), vc_out[i].len))) ERR;
for (k = 0; k < vc_out[i].len; k++)
{
((struct s1 *)vc_out[i].p)[k].x = 42.42;
((struct s1 *)vc_out[i].p)[k].x = 42.42f;
((struct s1 *)vc_out[i].p)[k].y = 2.0;
}
}

View File

@ -301,10 +301,10 @@ main()
/* Initialize data. */
for (i = 0; i < DIM6_LEN; i++)
{
obsdata[i].day = 15 * i + 1;
obsdata[i].elev = 2 * i + 1;
obsdata[i].day = 15 * (char)i + 1;
obsdata[i].elev = 2 * (short)i + 1;
obsdata[i].count = 2 * i + 1;
obsdata[i].relhum = 2.0 * i + 1;
obsdata[i].relhum = 2.0f * (float)i + 1;
obsdata[i].time = 2.0 * i + 1;
}
@ -453,8 +453,8 @@ main()
hr_data_out[i].svc_rec.i1 = 95;
hr_data_out[i].svc_rec.i2 = 90;
if (sprintf(hr_data_out[i].name, "alien_%d", i) < 0) ERR;
hr_data_out[i].max_temp = 99.99;
hr_data_out[i].min_temp = -9.99;
hr_data_out[i].max_temp = 99.99f;
hr_data_out[i].min_temp = -9.99f;
hr_data_out[i].percent_transporter_errosion = .1;
}
@ -558,8 +558,8 @@ main()
hr_data_out[i].svc_rec.i1 = 95;
hr_data_out[i].svc_rec.i2 = 90;
if (sprintf(hr_data_out[i].name, "alien_%d", i) < 0) ERR;
hr_data_out[i].max_temp = 99.99;
hr_data_out[i].min_temp = -9.99;
hr_data_out[i].max_temp = 99.99f;
hr_data_out[i].min_temp = -9.99f;
hr_data_out[i].percent_transporter_errosion = .1;
}
@ -666,8 +666,8 @@ main()
hr_data_out[i].svc_rec.i1 = 95;
hr_data_out[i].svc_rec.i2 = 90;
if (sprintf(hr_data_out[i].name, "alien_%d", i) < 0) ERR;
hr_data_out[i].max_temp = 99.99;
hr_data_out[i].min_temp = -9.99;
hr_data_out[i].max_temp = 99.99f;
hr_data_out[i].min_temp = -9.99f;
hr_data_out[i].percent_transporter_errosion = .1;
}
@ -757,7 +757,7 @@ main()
for (i = 0; i < DIM1_LEN; i++)
{
if (sprintf(hr_data_out[i].name, "alien_%d", i) < 0) ERR;
hr_data_out[i].max_temp = 99.99;
hr_data_out[i].max_temp = 99.99f;
}
/* Open file and get root group. */
@ -842,7 +842,7 @@ main()
for (i = 0; i < DIM2_LEN; i++)
{
if (sprintf(hr_data_out[i].name, "alien_%d", i) < 0) ERR;
hr_data_out[i].max_temp = 99.99;
hr_data_out[i].max_temp = 99.99f;
}
/* Open file and get root group. */
@ -921,7 +921,7 @@ main()
{
for (j = 0; j < STR_LEN + 1; j++)
data_out[i].x[j] = 4;
data_out[i].y = 99.99;
data_out[i].y = 99.99f;
}
/* Set latest_format in access propertly list and

View File

@ -76,7 +76,7 @@ main()
* dimension varies most slowly. */
for (lat = 0; lat < LAT_LEN; lat++)
for (lon = 0; lon < LON_LEN; lon++)
float_data_out[lat][lon] = -666.666;
float_data_out[lat][lon] = -666.666f;
/* Create file and group. */
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,

View File

@ -199,7 +199,7 @@ main()
hid_t did, fapl_id, fcpl_id, gcpl_id, attid;
hsize_t num_obj;
hid_t fileid, grpid, spaceid;
float val = 3.1495;
float val = 3.1495f;
#if H5_VERSION_GE(1,12,0)
H5O_info2_t obj_info;
#else

View File

@ -61,7 +61,7 @@ extern "C" {
#endif
/* WARNING: in some systems, these functions may be defined as macros, so check */
#ifndef HAVE_STRDUP
#if ! defined(HAVE_STRDUP) || defined(__CYGWIN__)
#ifndef strdup
char* strdup(const char*);
#endif

View File

@ -1770,7 +1770,7 @@ static int
check_create_mode(int mode)
{
int mode_format;
int mmap = 0;
int use_mmap = 0;
int inmemory = 0;
int diskless = 0;
@ -1781,17 +1781,17 @@ check_create_mode(int mode)
if (mode_format && (mode_format & (mode_format - 1)))
return NC_EINVAL;
mmap = ((mode & NC_MMAP) == NC_MMAP);
use_mmap = ((mode & NC_MMAP) == NC_MMAP);
inmemory = ((mode & NC_INMEMORY) == NC_INMEMORY);
diskless = ((mode & NC_DISKLESS) == NC_DISKLESS);
/* NC_INMEMORY and NC_DISKLESS and NC_MMAP are all mutually exclusive */
if(diskless && inmemory) return NC_EDISKLESS;
if(diskless && mmap) return NC_EDISKLESS;
if(inmemory && mmap) return NC_EINMEMORY;
if(diskless && use_mmap) return NC_EDISKLESS;
if(inmemory && use_mmap) return NC_EINMEMORY;
/* mmap is not allowed for netcdf-4 */
if(mmap && (mode & NC_NETCDF4)) return NC_EINVAL;
if(use_mmap && (mode & NC_NETCDF4)) return NC_EINVAL;
#ifndef USE_NETCDF4
/* If the user asks for a netCDF-4 file, and the library was built
@ -1973,7 +1973,7 @@ NC_open(const char *path0, int omode, int basepe, size_t *chunksizehintp,
const NC_Dispatch* dispatcher = NULL;
int inmemory = 0;
int diskless = 0;
int mmap = 0;
int use_mmap = 0;
char* path = NULL;
NCmodel model;
char* newpath = NULL;
@ -1989,17 +1989,17 @@ NC_open(const char *path0, int omode, int basepe, size_t *chunksizehintp,
{stat = NC_EINVAL; goto done;}
/* Capture the inmemory related flags */
mmap = ((omode & NC_MMAP) == NC_MMAP);
use_mmap = ((omode & NC_MMAP) == NC_MMAP);
diskless = ((omode & NC_DISKLESS) == NC_DISKLESS);
inmemory = ((omode & NC_INMEMORY) == NC_INMEMORY);
/* NC_INMEMORY and NC_DISKLESS and NC_MMAP are all mutually exclusive */
if(diskless && inmemory) {stat = NC_EDISKLESS; goto done;}
if(diskless && mmap) {stat = NC_EDISKLESS; goto done;}
if(inmemory && mmap) {stat = NC_EINMEMORY; goto done;}
if(diskless && use_mmap) {stat = NC_EDISKLESS; goto done;}
if(inmemory && use_mmap) {stat = NC_EINMEMORY; goto done;}
/* mmap is not allowed for netcdf-4 */
if(mmap && (omode & NC_NETCDF4)) {stat = NC_EINVAL; goto done;}
if(use_mmap && (omode & NC_NETCDF4)) {stat = NC_EINVAL; goto done;}
/* Attempt to do file path conversion: note that this will do
nothing if path is a 'file:...' url, so it will need to be

View File

@ -111,7 +111,7 @@ ncexinit(void)
int i;
bitmasks[0] = 0;
for(i=1;i<NCEXHASHKEYBITS;i++)
bitmasks[i] = (1 << i) - 1;
bitmasks[i] = (1ULL << i) - 1;
ncexinitialized = 1;
}
@ -855,7 +855,7 @@ ncexhashprintstats(NCexhashmap* map)
fprintf(stderr," |leaf|=%d nactive/nleaves=%g", map->leaflen, leafavg);
fprintf(stderr," load=%g",leafload);
fprintf(stderr,"]\n");
dirsize = (1<<(map->depth))*((unsigned long long)sizeof(void*));
dirsize = (1ULL<<(map->depth))*((unsigned long long)sizeof(void*));
leafsize = (nleaves)*((unsigned long long)sizeof(NCexleaf));
total = dirsize + leafsize;
fprintf(stderr,"\tsizeof(directory)=%llu sizeof(leaves)=%lld total=%lld\n",

View File

@ -81,8 +81,8 @@ free_NCList(void)
int
add_to_NCList(NC* ncp)
{
int i;
int new_id;
unsigned int i;
unsigned int new_id;
if(nc_filelist == NULL) {
if (!(nc_filelist = calloc(1, sizeof(NC*)*NCFILELISTLENGTH)))
return NC_ENOMEM;
@ -96,7 +96,7 @@ add_to_NCList(NC* ncp)
if(new_id == 0) return NC_ENOMEM; /* no more slots */
nc_filelist[new_id] = ncp;
numfiles++;
ncp->ext_ncid = (new_id << ID_SHIFT);
ncp->ext_ncid = (int)(new_id << ID_SHIFT);
return NC_NOERR;
}

View File

@ -995,7 +995,7 @@ nc4_hdf5_get_chunk_cache(int ncid, size_t *sizep, size_t *nelemsp,
if (H5Pget_cache(plistid, NULL, nelemsp, sizep, &dpreemption) < 0)
return NC_EHDFERR;
if (preemptionp)
*preemptionp = dpreemption;
*preemptionp = (float)dpreemption;
return NC_NOERR;
}

View File

@ -1483,7 +1483,7 @@ nc4_get_var_meta(NC_VAR_INFO_T *var)
if ((H5Pget_chunk_cache(access_pid, &(var->chunkcache.nelems),
&(var->chunkcache.size), &rdcc_w0)) < 0)
BAIL(NC_EHDFERR);
var->chunkcache.preemption = rdcc_w0;
var->chunkcache.preemption = (float)rdcc_w0;
/* Get the dataset creation properties. */
if ((propid = H5Dget_create_plist(hdf5_var->hdf_datasetid)) < 0)

View File

@ -2391,7 +2391,7 @@ nc_set_var_chunk_cache_ints(int ncid, int varid, int size, int nelems,
real_nelems = nelems;
if (preemption >= 0)
real_preemption = preemption / 100.;
real_preemption = (float)(preemption / 100.);
return NC4_HDF5_set_var_chunk_cache(ncid, varid, real_size, real_nelems,
real_preemption);

View File

@ -35,7 +35,20 @@ tinyxml2::
rm -fr ./tinyxml2 ./license.txt
git clone --depth=1 ${REPO}
cat tinyxml2/LICENSE.txt > ./license.txt
cat tinyxml2/tinyxml2.h > ./tinyxml2.h
sed -e 's/__BORLANDC__/__APPLE__/' < tinyxml2/tinyxml2.cpp \
| sed -e 's/ptrdiff_t/long/g' > ./tinyxml2.cpp
tr -d '\r' < tinyxml2/tinyxml2.h > tinyxml2.h
cat tinyxml2/tinyxml2.cpp \
| sed -e 's/__BORLANDC__/__APPLE__/' \
| sed -e 's/ptrdiff_t/long/g' \
| sed -e '/^static[ ]*FILE[*][ ]*callfopen(/i\
\#if 0' \
| sed -e '/^void[ ]*XMLDocument::DeleteNode(/i\
\#endif /*0*/\
' \
| sed -e '/^XMLError[ ]*XMLDocument::LoadFile([ ]*const[ ]*char[*]/i\
\#if 0' \
| sed -e '/^XMLError[ ]*XMLDocument::Parse(/i\
\#endif /*0*/\
' \
| tr -d '\r' \
| cat > ./tinyxml2.cpp
rm -fr tinyxml2

View File

@ -2283,6 +2283,7 @@ XMLUnknown* XMLDocument::NewUnknown( const char* str )
return unk;
}
#if 0
static FILE* callfopen( const char* filepath, const char* mode )
{
TIXMLASSERT( filepath );
@ -2299,6 +2300,8 @@ static FILE* callfopen( const char* filepath, const char* mode )
return fp;
}
#endif /*0*/
void XMLDocument::DeleteNode( XMLNode* node ) {
TIXMLASSERT( node );
TIXMLASSERT(node->_document == this );
@ -2317,6 +2320,7 @@ void XMLDocument::DeleteNode( XMLNode* node ) {
}
#if 0
XMLError XMLDocument::LoadFile( const char* filename )
{
if ( !filename ) {
@ -2420,6 +2424,8 @@ XMLError XMLDocument::SaveFile( FILE* fp, bool compact )
}
#endif /*0*/
XMLError XMLDocument::Parse( const char* xml, size_t nBytes )
{
Clear();

View File

@ -46,7 +46,7 @@ void fail(int line) {
#endif
/* Control flags */
static int flags, persist, usenetcdf4, mmap, diskless;
static int flags, persist, usenetcdf4, use_mmap, diskless;
char*
smode(int mode)
@ -90,13 +90,13 @@ main(int argc, char **argv)
/* Set defaults */
persist = 0;
usenetcdf4 = 0;
mmap = 0;
use_mmap = 0;
diskless = 0;
for(i=1;i<argc;i++) {
if(strcmp(argv[i],"netcdf4")==0) usenetcdf4=1;
else if(strcmp(argv[i],"persist")==0) persist=1;
else if(strcmp(argv[i],"mmap")==0) mmap=1;
else if(strcmp(argv[i],"mmap")==0) use_mmap=1;
else if(strcmp(argv[i],"diskless")==0) diskless=1;
else if(strncmp(argv[i],"file:",strlen("file:"))==0) {
filename = argv[i];
@ -111,12 +111,12 @@ main(int argc, char **argv)
#endif
/* Invalid combinations */
if(mmap && diskless) {fprintf(stderr,"Illegal: mmap+diskless\n"); exit(1);};
if(mmap && usenetcdf4) {fprintf(stderr,"Illegal: mmap+netcdf4\n"); exit(1);};
if(use_mmap && diskless) {fprintf(stderr,"Illegal: mmap+diskless\n"); exit(1);};
if(use_mmap && usenetcdf4) {fprintf(stderr,"Illegal: mmap+netcdf4\n"); exit(1);};
flags = usenetcdf4?FLAGS4:FLAGS3;
if(persist) flags |= NC_PERSIST;
if(mmap) flags |= NC_MMAP;
if(use_mmap) flags |= NC_MMAP;
if(diskless) flags |= NC_DISKLESS;
printf("\n*** Testing the diskless|mmap API.\n");
@ -126,7 +126,7 @@ printf("*** testing diskless file with scalar vars...");
int ndims_in, nvars_in, natts_in, unlimdimid_in;
char name_in[NC_MAX_NAME + 1];
nc_type type_in;
float float_data = 3.14, float_data_in;
float float_data = 3.14f, float_data_in;
int int_data = 42, int_data_in;
short short_data = 2, short_data_in;
@ -176,7 +176,7 @@ printf("*** testing diskless file with scalar vars...");
if(!usenetcdf4 && persist) {
int ncid, varid0, varid1, varid2;
float float_data = 3.14, float_data_in;
float float_data = 3.14f, float_data_in;
int int_data = 42, int_data_in;
short short_data = 2, short_data_in;
@ -221,7 +221,7 @@ printf("*** testing diskless file with scalar vars...");
size_t start[1] = {0};
size_t count[1] = {DIM1_LEN};
int i;
float float_data = 42.22, float_data_in;
float float_data = 42.22f, float_data_in;
/* This is some really important data that I want to save. */
for (i = 0; i < DIM1_LEN; i++)
@ -301,7 +301,7 @@ printf("*** testing diskless file with scalar vars...");
int ndims_in, nvars_in, natts_in, unlimdimid_in;
char name_in[NC_MAX_NAME + 1];
nc_type type_in;
float float_data = 3.14, float_data_in;
float float_data = 3.14f, float_data_in;
int int_data = 42, int_data_in;
short short_data = 2, short_data_in;

View File

@ -47,7 +47,7 @@
static int status = NC_NOERR;
/* Control flags */
static int persist, usenetcdf4, mmap, diskless, file, openfile;
static int persist, usenetcdf4, use_mmap, diskless, file, openfile;
static char* filename = NCFILENAME;
static int diskmode = 0;
@ -211,7 +211,7 @@ parse(int argc, char** argv)
/* Set defaults */
persist = 0;
usenetcdf4 = 0;
mmap = 0;
use_mmap = 0;
diskless = 0;
file = 0;
diskmode = 0;
@ -219,7 +219,7 @@ parse(int argc, char** argv)
for(i=1;i<argc;i++) {
if(strcmp(argv[i],"diskless")==0) diskless=1;
else if(strcmp(argv[i],"mmap")==0) mmap=1;
else if(strcmp(argv[i],"mmap")==0) use_mmap=1;
else if(strcmp(argv[i],"file")==0) file=1;
else if(strcmp(argv[i],"persist")==0) persist=1;
else if(strcmp(argv[i],"open")==0) openfile=1;
@ -231,7 +231,7 @@ parse(int argc, char** argv)
/* ignore anything not recognized */
}
if(diskless && mmap) {
if(diskless && use_mmap) {
fprintf(stderr,"NC_DISKLESS and NC_MMAP are mutually exclusive\n");
exit(1);
}
@ -244,7 +244,7 @@ buildmode(void)
diskmode = 0;
if(diskless)
diskmode |= NC_DISKLESS;
if(mmap)
if(use_mmap)
diskmode |= NC_MMAP;
if(persist)
diskmode |= NC_PERSIST;
@ -257,7 +257,7 @@ main(int argc, char **argv)
{
parse(argc,argv);
if(!diskless && !mmap && !file) {
if(!diskless && !use_mmap && !file) {
fprintf(stderr,"file or diskless or mmap must be specified\n");
exit(1);
}

View File

@ -88,8 +88,8 @@ inRange_float(const double value, const nc_type xtype)
case NC_UBYTE: min = 0; max = X_UCHAR_MAX; break;
case NC_USHORT: min = 0; max = X_USHORT_MAX; break;
case NC_UINT: min = 0; max = X_UINT_MAX; break;
case NC_INT64: min = X_INT64_MIN; max = X_INT64_MAX; break;
case NC_UINT64: min = 0; max = X_UINT64_MAX; break;
case NC_INT64: min = X_INT64_MIN; max = (double)X_INT64_MAX; break;
case NC_UINT64: min = 0; max = (double)X_UINT64_MAX; break;
default: assert(0);
}
if(!( value >= min && value <= max)) {

View File

@ -28,11 +28,11 @@ main(int argc, char **argv)
/* Create phony data. */
for (i = 0; i < DIM_LEN; i++)
{
if (!(data[i].temp_vl.p = malloc(sizeof(float) * (i + 1))))
if (!(data[i].temp_vl.p = malloc(sizeof(float) * (size_t)(i + 1))))
return NC_ENOMEM;
for (j = 0; j < i + 1; j++)
((float *)(data[i].temp_vl.p))[j] = 23.5 - j;
data[i].temp_vl.len = i + 1;
((float *)(data[i].temp_vl.p))[j] = 23.5f - (float)j;
data[i].temp_vl.len = (size_t)i + 1;
}
printf("\n*** Testing netcdf-4 CDM compliance: sea soundings.\n");

View File

@ -1215,7 +1215,7 @@ create_file()
check_err(stat,__LINE__,__FILE__);
}
{ /* Gf */
static const float Gf_att[5] = {-3.4028231e+38, 3.4028231e+38, -9.96921e+36, 9.96921e+36, 531} ;
static const float Gf_att[5] = {-3.4028231e+38f, 3.4028231e+38f, -9.96921e+36f, 9.96921e+36f, 531} ;
stat = nc_put_att_float(ncid, NC_GLOBAL, "Gf", NC_FLOAT, 5, Gf_att);
check_err(stat,__LINE__,__FILE__);
}
@ -1247,7 +1247,7 @@ create_file()
check_err(stat,__LINE__,__FILE__);
}
{ /* f */
static const float i_f_att[4] = {-3.4028231e+38, 3.4028231e+38, -9.96921e+36, 9.96921e+36} ;
static const float i_f_att[4] = {-3.4028231e+38f, 3.4028231e+38f, -9.96921e+36f, 9.96921e+36f} ;
stat = nc_put_att_float(ncid, i_id, "f", NC_FLOAT, 4, i_f_att);
check_err(stat,__LINE__,__FILE__);
}
@ -1330,7 +1330,7 @@ create_file()
}
{
float fr_data[2] = {-3.4028231e+38, 3.4028231e+38} ;
float fr_data[2] = {-3.4028231e+38f, 3.4028231e+38f} ;
size_t fr_startset[1] = {0} ;
size_t fr_countset[1] = {2} ;
stat = nc_put_vara(ncid, fr_id, fr_startset, fr_countset, fr_data);
@ -1378,7 +1378,7 @@ create_file()
}
{
float f1_data[1] = {-3.4028231e+38} ;
float f1_data[1] = {-3.4028231e+38f} ;
size_t f1_startset[1] = {0} ;
size_t f1_countset[1] = {1} ;
stat = nc_put_vara(ncid, f1_id, f1_startset, f1_countset, f1_data);
@ -1426,7 +1426,7 @@ create_file()
}
{
float f2_data[2] = {-3.4028231e+38, 3.4028231e+38} ;
float f2_data[2] = {-3.4028231e+38f, 3.4028231e+38f} ;
size_t f2_startset[1] = {0} ;
size_t f2_countset[1] = {2} ;
stat = nc_put_vara(ncid, f2_id, f2_startset, f2_countset, f2_data);
@ -1474,7 +1474,7 @@ create_file()
}
{
float f3_data[3] = {-3.4028231e+38, 3.4028231e+38, -9.96921e+36} ;
float f3_data[3] = {-3.4028231e+38f, 3.4028231e+38f, -9.96921e+36f} ;
size_t f3_startset[1] = {0} ;
size_t f3_countset[1] = {3} ;
stat = nc_put_vara(ncid, f3_id, f3_startset, f3_countset, f3_data);
@ -1522,7 +1522,7 @@ create_file()
}
{
float f4_data[4] = {-3.4028231e+38, 3.4028231e+38, -9.96921e+36, 9.96921e+36} ;
float f4_data[4] = {-3.4028231e+38f, 3.4028231e+38f, -9.96921e+36f, 9.96921e+36f} ;
size_t f4_startset[1] = {0} ;
size_t f4_countset[1] = {4} ;
stat = nc_put_vara(ncid, f4_id, f4_startset, f4_countset, f4_data);

View File

@ -50,7 +50,7 @@ calculate_waste(int ndims, size_t *dimlen, size_t *chunksize, float *waste)
#endif
/* Percent of the chunked file that is wasted space. */
*waste = ((float)(chunked - unchunked) / (float)chunked) * 100.0;
*waste = ((float)(chunked - unchunked) / (float)chunked) * 100.0f;
#ifdef PRINT_CHUNK_WASTE_REPORT
printf("\ndimlen\tchunksize\tnum_chunks\n");

View File

@ -546,8 +546,8 @@ main(int argc, char **argv)
hr_data_out[i].starfleet_id = i;
hr_data_out[i].svc_rec = data[i];
if (sprintf(hr_data_out[i].name, "alien_%d", i) < 0) ERR;
hr_data_out[i].max_temp = 99.99;
hr_data_out[i].min_temp = -9.99;
hr_data_out[i].max_temp = 99.99f;
hr_data_out[i].min_temp = -9.99f;
hr_data_out[i].percent_transporter_errosion = .030303;
}
@ -659,10 +659,10 @@ main(int argc, char **argv)
/* Initialize data. */
for (i = 0; i < DIM6_LEN; i++)
{
obsdata[i].day = 15 * i + 1;
obsdata[i].elev = 2 * i + 1;
obsdata[i].day = 15 * (char)i + 1;
obsdata[i].elev = 2 * (short)i + 1;
obsdata[i].count = 2 * i + 1;
obsdata[i].relhum = 2.0 * i + 1;
obsdata[i].relhum = 2.0f * (float)i + 1;
obsdata[i].time = 2.0 * i + 1;
}
missing_val.day = 99;
@ -863,7 +863,7 @@ main(int argc, char **argv)
for (i = 0; i < DIM1_LEN; i++)
{
if (sprintf(hr_data_out[i].name, "alien_%d", i) < 0) ERR;
hr_data_out[i].max_temp = 99.99;
hr_data_out[i].max_temp = 99.99f;
}
/* Create a file with a nested compound type attribute and variable. */
@ -927,7 +927,7 @@ main(int argc, char **argv)
/* Create some phony data. */
for (i = 0; i < DIM1_LEN; i++)
{
hr_data_out[i].max_temp = 99.99;
hr_data_out[i].max_temp = 99.99f;
for (j = 0; j < ARRAY_LEN; j++)
hr_data_out[i].name[j] = j;
}

View File

@ -49,7 +49,7 @@ main(int argc, char **argv)
/* Create some phony data. */
for (i = 0; i < DIM1_LEN; i++)
{
data_out[i].y = 99.99;
data_out[i].y = 99.99f;
for (j = 0; j < ARRAY_LEN; j++)
data_out[i].x[j] = j;
}

View File

@ -136,7 +136,7 @@ main(int argc, char **argv)
for (i = 0; i < ATT_LEN; i++)
{
a1_att[i].s1.x = 13.3;
a1_att[i].s1.x = 13.3f;
a1_att[i].s1.y = 13.3;
}
/* Create a file with two groups, define a type in each group,

View File

@ -215,7 +215,7 @@ main(int argc, char **argv)
if (uint64_in != ivalue) ERR;
if (nc_get_var_float(ncid, varid, &float_in)) ERR;
if(fabs( (float_in-X_INT_MAX) - ((float)ivalue - X_INT_MAX)) > 1) ERR;
if(fabs( (float_in-(float)X_INT_MAX) - ((float)ivalue - (float)X_INT_MAX)) > 1) ERR;
if (nc_get_var_double(ncid, varid, &double_in)) ERR;
if (double_in != (double)ivalue) ERR;

View File

@ -38,8 +38,8 @@ main(int argc, char **argv)
#define LAT_NAME "lat"
#define LON_NAME "lon"
#define NVARS 2
#define START_LAT 25.0
#define START_LON -125.0
#define START_LAT 25.0f
#define START_LON -125.0f
{
int ncid, lon_dimid, lat_dimid;
int lat_varid, lon_varid;
@ -52,9 +52,9 @@ main(int argc, char **argv)
/* Initialize coord data. */
for (lat = 0; lat < NLAT; lat++)
lats[lat] = START_LAT + 5. * lat;
lats[lat] = START_LAT + 5.f * (float)lat;
for (lon = 0; lon < NLON; lon++)
lons[lon] = START_LON + 5. * lon;
lons[lon] = START_LON + 5.f * (float)lon;
/* Create file with two dimensions. */
if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR;
@ -103,7 +103,7 @@ main(int argc, char **argv)
#define DIM0_NAME "d0"
#define CACHE_SIZE 1000000
#define CACHE_NELEMS 1009
#define CACHE_PREEMPTION .90
#define CACHE_PREEMPTION .90f
int ncid, dimid, varid;
char name_in[NC_MAX_NAME + 1];
@ -413,12 +413,12 @@ main(int argc, char **argv)
check_err(stat,__LINE__,__FILE__);
}
{ /* missing_value */
static const float pr_missing_value_att[1] = {1e+20} ;
static const float pr_missing_value_att[1] = {1e+20f} ;
stat = nc_put_att_float(root_grp, pr_id, "missing_value", NC_FLOAT, 1, pr_missing_value_att);
check_err(stat,__LINE__,__FILE__);
}
{ /* _FillValue */
static const float pr_FillValue_att[1] = {1e+20} ;
static const float pr_FillValue_att[1] = {1e+20f} ;
stat = nc_put_att_float(root_grp, pr_id, "_FillValue", NC_FLOAT, 1, pr_FillValue_att);
check_err(stat,__LINE__,__FILE__);
}

View File

@ -849,9 +849,9 @@ main(int argc, char **argv)
/* Lats and lons suitable for some South American data. */
for (lat[0] = 40.0, i = 1; i < LAT_LEN; i++)
lat[i] = lat[i - 1] + .5;
lat[i] = (float)lat[i - 1] + .5f;
for (lon[0] = 20.0, i = 1; i < LON_LEN; i++)
lon[i] = lon[i - 1] + 1.5;
lon[i] = (float)lon[i - 1] + 1.5f;
/* Some phoney 2D pressure data. */
for (i = 0; i < LAT_LEN; i++)
@ -1002,9 +1002,9 @@ main(int argc, char **argv)
/* Some phony 1D lats and lons. */
for (i = 0; i < LAT_LEN; i++)
lat[i] = i * 5.;
lat[i] = (float)i * 5.f;
for (i = 0; i < LON_LEN; i++)
lon[i] = i * 5.;
lon[i] = (float)i * 5.f;
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;

View File

@ -209,7 +209,7 @@ main(int argc, char **argv)
int dimids_var[2], var_type;
size_t dim_len;
char dim_name[NC_MAX_NAME+1], var_name[NC_MAX_NAME+1];
float float_in, float_out = 99.99;
float float_in, float_out = 99.99f;
int int_in, int_out = -9999;
/* Create a file, this time with attributes. */

View File

@ -42,7 +42,7 @@ main()
int dimids[NDIMS];
for (i = 0; i < (X_LEN * Y_LEN * Z_LEN); i++)
mydata[i] = i;
mydata[i] = (float)i;
/* create the file in NetCDF-4 format */
if ((retval = nc_create(FILE_NAME, NC_NETCDF4, &ncid)))

View File

@ -277,7 +277,7 @@ main(int argc, char **argv)
{
int ncid, varid1, varid2;
int quantize_mode_in, nsd_in;
float float_data[DIM_LEN_1] = {1.1111111};
float float_data[DIM_LEN_1] = {1.1111111f};
double double_data[DIM_LEN_1] = {1.111111111111};
printf("\t\t**** testing quantize algorithm %d...\n", quantize_mode[q]);
@ -394,7 +394,7 @@ main(int argc, char **argv)
{
int ncid, dimid, varid1, varid2;
int quantize_mode_in, nsd_in;
float float_data[DIM_LEN_1] = {1.1111111};
float float_data[DIM_LEN_1] = {1.1111111f};
double double_data[DIM_LEN_1] = {1.111111111111};
printf("\t\t**** testing quantize algorithm %d...\n", quantize_mode[q]);
@ -485,7 +485,7 @@ main(int argc, char **argv)
{
int ncid, dimid, varid1, varid2;
int quantize_mode_in, nsd_in;
float float_data[DIM_LEN_5] = {1.11111111, 1.0, 9.99999999, 12345.67, .1234567};
float float_data[DIM_LEN_5] = {1.11111111f, 1.0f, 9.99999999f, 12345.67f, .1234567f};
double double_data[DIM_LEN_5] = {1.1111111, 1.0, 9.999999999, 1234567890.12345, 123456789012345.0};
int x;
@ -616,7 +616,7 @@ main(int argc, char **argv)
{
int ncid, dimid, varid1, varid2;
int quantize_mode_in, nsd_in;
float float_data[DIM_LEN_1] = {1.1111111};
float float_data[DIM_LEN_1] = {1.1111111f};
double double_data[DIM_LEN_1] = {1.111111111111};
printf("\t\t**** testing quantize algorithm %d...\n", quantize_mode[q]);
@ -733,7 +733,7 @@ main(int argc, char **argv)
{
int ncid, dimid, varid1, varid2;
int quantize_mode_in, nsd_in;
float float_data[DIM_LEN_5] = {1.11111111, 1.0, 9.99999999, 12345.67, .1234567};
float float_data[DIM_LEN_5] = {1.11111111f, 1.0, 9.99999999f, 12345.67f, .1234567f};
double double_data[DIM_LEN_5] = {1.1111111, 1.0, 9.999999999, 1234567890.12345, 123456789012345.0};
int x;
@ -862,7 +862,7 @@ main(int argc, char **argv)
{
int ncid, dimid, varid1, varid2;
int quantize_mode_in, nsd_in;
float float_data[DIM_LEN_5] = {1.11111111, NC_FILL_FLOAT, 9.99999999, 12345.67, NC_FILL_FLOAT};
float float_data[DIM_LEN_5] = {1.11111111f, NC_FILL_FLOAT, 9.99999999f, 12345.67f, NC_FILL_FLOAT};
double double_data[DIM_LEN_5] = {1.1111111, NC_FILL_DOUBLE, 9.999999999, 1234567890.12345, NC_FILL_DOUBLE};
int x;
@ -987,13 +987,13 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
printf("\t**** testing more quantization values with custom fill values...\n");
{
#define CUSTOM_FILL_FLOAT 99.99999
#define CUSTOM_FILL_FLOAT 99.99999f
#define CUSTOM_FILL_DOUBLE -99999.99999
for (q = 0; q < NUM_QUANTIZE_MODES; q++)
{
int ncid, dimid, varid1, varid2;
int quantize_mode_in, nsd_in;
float float_data[DIM_LEN_5] = {1.11111111, CUSTOM_FILL_FLOAT, 9.99999999, 12345.67, CUSTOM_FILL_FLOAT};
float float_data[DIM_LEN_5] = {1.11111111f, CUSTOM_FILL_FLOAT, 9.99999999f, 12345.67f, CUSTOM_FILL_FLOAT};
double double_data[DIM_LEN_5] = {1.1111111, CUSTOM_FILL_DOUBLE, 9.999999999, 1234567890.12345, CUSTOM_FILL_DOUBLE};
float custom_fill_float = CUSTOM_FILL_FLOAT;
double custom_fill_double = CUSTOM_FILL_DOUBLE;
@ -1311,8 +1311,8 @@ main(int argc, char **argv)
ERR;
for (i = 0; i < DIM_LEN_SIMPLE; i++)
{
float_data[i] = 1.5 * i;
double_data[i] = 1.5 * i;
float_data[i] = 1.5f * (float)i;
double_data[i] = 1.5 * (double)i;
}
/* Create the file. */

View File

@ -51,7 +51,7 @@ main(int argc, char **argv)
for (time = 0; time < NUM_TIMESTEPS; time++)
for (lat = 0; lat < LAT_LEN; lat++)
for (lon = 0; lon < LON_LEN; lon++)
data_out[time][lat][lon] = 25.5 + lat + lon + time;
data_out[time][lat][lon] = 25.5f + (float)(lat + lon + time);
/* Create a file with a 3D surface temp variable. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;

View File

@ -56,10 +56,10 @@
#define NVARS_EX 4
/* These are used to construct some example data. */
#define SAMPLE_PRESSURE 900
#define SAMPLE_TEMP 9.0
#define START_LAT 25.0
#define START_LON -125.0
#define SAMPLE_PRESSURE 900.f
#define SAMPLE_TEMP 9.0f
#define START_LAT 25.0f
#define START_LON -125.0f
/* For the units attributes. */
#define UNITS "units"
@ -97,16 +97,16 @@ create_4D_example(char *file_name, int cmode)
* would have some real data to write, for example, model
* output. */
for (lat = 0; lat < NLAT; lat++)
lats[lat] = START_LAT + 5.*lat;
lats[lat] = START_LAT + 5.f*(float)lat;
for (lon = 0; lon < NLON; lon++)
lons[lon] = START_LON + 5.*lon;
lons[lon] = START_LON + 5.f*(float)lon;
for (lvl = 0; lvl < NLVL; lvl++)
for (lat = 0; lat < NLAT; lat++)
for (lon = 0; lon < NLON; lon++)
{
pres_out[lvl][lat][lon] = SAMPLE_PRESSURE + i;
temp_out[lvl][lat][lon] = SAMPLE_TEMP + i++;
pres_out[lvl][lat][lon] = SAMPLE_PRESSURE + (float)i;
temp_out[lvl][lat][lon] = SAMPLE_TEMP + (float)i++;
}
/* Create the file. */
@ -307,7 +307,7 @@ main(int argc, char **argv)
unsigned short ushort_out[DIM1_LEN][DIM2_LEN] = {{110, 128, 255},{110, 128, 255}};
short short_in[DIM1_LEN][DIM2_LEN], short_out[DIM1_LEN][DIM2_LEN] = {{-110, -128, 255},{-110, -128, 255}};
int int_in[DIM1_LEN][DIM2_LEN], int_out[DIM1_LEN][DIM2_LEN] = {{0, 128, 255},{0, 128, 255}};
float float_in[DIM1_LEN][DIM2_LEN], float_out[DIM1_LEN][DIM2_LEN] = {{-.1, 9999.99, 100.001},{-.1, 9999.99, 100.001}};
float float_in[DIM1_LEN][DIM2_LEN], float_out[DIM1_LEN][DIM2_LEN] = {{-.1f, 9999.99f, 100.001f},{-.1f, 9999.99f, 100.001f}};
double double_in[DIM1_LEN][DIM2_LEN], double_out[DIM1_LEN][DIM2_LEN] = {{0.02, .1128, 1090.1},{0.02, .1128, 1090.1}};
unsigned int uint_in[DIM1_LEN][DIM2_LEN], uint_out[DIM1_LEN][DIM2_LEN] = {{0, 128, 255},{0, 128, 255}};
long long int64_in[DIM1_LEN][DIM2_LEN], int64_out[DIM1_LEN][DIM2_LEN] = {{-111, 777, 100},{-111, 777, 100}};

View File

@ -312,7 +312,7 @@ main(int argc, char **argv)
return NC_ENOMEM;
for (j = 0; j < vlen_of_comp_out[i].len; j++)
{
((struct s1 *)vlen_of_comp_out[i].p)[j].x = 42.42;
((struct s1 *)vlen_of_comp_out[i].p)[j].x = 42.42f;
((struct s1 *)vlen_of_comp_out[i].p)[j].y = 2.0;
}
}
@ -322,7 +322,7 @@ main(int argc, char **argv)
for (i = 0; i < DIM2_LEN; i++)
for (j = 0; j < NUM_S1; j++)
{
comp_array_of_comp_out[i].data[j].x = 42.42;
comp_array_of_comp_out[i].data[j].x = 42.42f;
comp_array_of_comp_out[i].data[j].y = 2.0;
}
@ -336,7 +336,7 @@ main(int argc, char **argv)
return NC_ENOMEM;
for (k = 0; k < comp_array_of_vlen_of_comp_out[i].data[j].len; k++)
{
((struct s1 *)comp_array_of_vlen_of_comp_out[i].data[j].p)[k].x = 42.42;
((struct s1 *)comp_array_of_vlen_of_comp_out[i].data[j].p)[k].x = 42.42f;
((struct s1 *)comp_array_of_vlen_of_comp_out[i].data[j].p)[k].y = 2.0;
}
}

View File

@ -317,7 +317,7 @@ static float int162float32_data[DIMSIZE]={0.000,256.000,512.000,768.000,1024.000
static int int32_data[DIMSIZE]={0,2048,4096,6144,8192,10240,12288,14336,16384,18432,20480,22528,24576,26624,28672,30720,32768,34816,36864,38912,40960,43008,45056,47104,49152};
static float int32tofloat32_data[DIMSIZE]={0.000,2048.000,4096.000,6144.000,8192.000,10240.000,12288.000,14336.000,16384.000,18432.000,20480.000,22528.000,24576.000,26624.000,28672.000,30720.000,32768.000,34816.000,36864.000,38912.000,40960.000,43008.000,45056.000,47104.000,49152.000};
static long int32toilong_data[DIMSIZE]={0,2048,4096,6144,8192,10240,12288,14336,16384,18432,20480,22528,24576,26624,28672,30720,32768,34816,36864,38912,40960,43008,45056,47104,49152};
static float float32_data[DIMSIZE]={0.000,0.010,0.020,0.030,0.040,0.050,0.060,0.070,0.080,0.090,0.100,0.110,0.120,0.130,0.140,0.149,0.159,0.169,0.179,0.189,0.199,0.208,0.218,0.228,0.238};
static float float32_data[DIMSIZE]={0.000f,0.010f,0.020f,0.030f,0.040f,0.050f,0.060f,0.070f,0.080f,0.090f,0.100f,0.110f,0.120f,0.130f,0.140f,0.149f,0.159f,0.169f,0.179f,0.189f,0.199f,0.208f,0.218f,0.228f,0.238f};
static double float64_data[DIMSIZE]={1.000,1.000,1.000,1.000,0.999,0.999,0.998,0.998,0.997,0.996,0.995,0.994,0.993,0.992,0.990,0.989,0.987,0.986,0.984,0.982,0.980,0.978,0.976,0.974,0.971};
#ifndef USE_NETCDF4

View File

@ -316,7 +316,7 @@ static float int162float32_data[DIMSIZE]={0.000,256.000,512.000,768.000,1024.000
static int int32_data[DIMSIZE]={0,2048,4096,6144,8192,10240,12288,14336,16384,18432,20480,22528,24576,26624,28672,30720,32768,34816,36864,38912,40960,43008,45056,47104,49152};
static float int32tofloat32_data[DIMSIZE]={0.000,2048.000,4096.000,6144.000,8192.000,10240.000,12288.000,14336.000,16384.000,18432.000,20480.000,22528.000,24576.000,26624.000,28672.000,30720.000,32768.000,34816.000,36864.000,38912.000,40960.000,43008.000,45056.000,47104.000,49152.000};
static long int32toilong_data[DIMSIZE]={0,2048,4096,6144,8192,10240,12288,14336,16384,18432,20480,22528,24576,26624,28672,30720,32768,34816,36864,38912,40960,43008,45056,47104,49152};
static float float32_data[DIMSIZE]={0.000,0.010,0.020,0.030,0.040,0.050,0.060,0.070,0.080,0.090,0.100,0.110,0.120,0.130,0.140,0.149,0.159,0.169,0.179,0.189,0.199,0.208,0.218,0.228,0.238};
static float float32_data[DIMSIZE]={0.000f,0.010f,0.020f,0.030f,0.040f,0.050f,0.060f,0.070f,0.080f,0.090f,0.100f,0.110f,0.120f,0.130f,0.140f,0.149f,0.159f,0.169f,0.179f,0.189f,0.199f,0.208f,0.218f,0.228f,0.238f};
static double float64_data[DIMSIZE]={1.000,1.000,1.000,1.000,0.999,0.999,0.998,0.998,0.997,0.996,0.995,0.994,0.993,0.992,0.990,0.989,0.987,0.986,0.984,0.982,0.980,0.978,0.976,0.974,0.971};
#ifndef USE_NETCDF4

View File

@ -33,33 +33,33 @@ TODO: Note that this test uses thredds server
#define VAR "SST"
static float expected_stride1[12] = {
29.430857,
29.403780,
29.325428,
29.578333,
29.660833,
29.378437,
29.151943,
29.109715,
29.114864,
29.550285,
29.542500,
29.500286
29.430857f,
29.403780f,
29.325428f,
29.578333f,
29.660833f,
29.378437f,
29.151943f,
29.109715f,
29.114864f,
29.550285f,
29.542500f,
29.500286f
};
static float expected_stride2[6] = {
29.430857,
29.325428,
29.660833,
29.151943,
29.114864,
29.542500
29.430857f,
29.325428f,
29.660833f,
29.151943f,
29.114864f,
29.542500f
};
static float expected_stride3[3] = {
29.430857,
29.378437,
29.542500
29.430857f,
29.378437f,
29.542500f
};
void

View File

@ -7,6 +7,7 @@
*********************************************************************/
#include "config.h" /* for USE_NETCDF4 macro */
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_GETOPT_H
@ -2310,7 +2311,7 @@ main(int argc, char**argv)
double dval = double_with_suffix(optarg); /* "K" for kilobytes. "M" for megabytes, ... */
if(dval < 0)
error("Suffix used for '-m' option value must be K, M, G, T, or P");
option_copy_buffer_size = dval;
option_copy_buffer_size = (size_t)dval;
break;
}
case 'h': /* non-default size of chunk cache */
@ -2318,7 +2319,7 @@ main(int argc, char**argv)
double dval = double_with_suffix(optarg); /* "K" for kilobytes. "M" for megabytes, ... */
if(dval < 0)
error("Suffix used for '-h' option value must be K, M, G, T, or P");
option_chunk_cache_size = dval;
option_chunk_cache_size = (size_t)dval;
break;
}
case 'e': /* number of elements chunk cache can hold */
@ -2326,7 +2327,7 @@ main(int argc, char**argv)
double dval = double_with_suffix(optarg); /* "K" for kilobytes. "M" for megabytes, ... */
if(dval < 0 )
error("Suffix used for '-e' option value must be K, M, G, T, or P");
option_chunk_cache_nelems = (long)dval;
option_chunk_cache_nelems = (size_t)dval;
break;
}
case 'r':

View File

@ -699,7 +699,7 @@ pr_att_valsx(
case NC_BYTE:
case NC_SHORT:
case NC_INT:
ii = vals[iel];
ii = (int)vals[iel];
res = snprintf(gps, PRIM_LEN, "%d", ii);
assert(res < PRIM_LEN);
(void) strlcat(attvals, gps, attvalslen);
@ -708,28 +708,28 @@ pr_att_valsx(
case NC_UBYTE:
case NC_USHORT:
case NC_UINT:
ui = vals[iel];
ui = (unsigned int)vals[iel];
res = snprintf(gps, PRIM_LEN, "%u", ui);
assert(res < PRIM_LEN);
(void) strlcat(attvals, gps, attvalslen);
(void) strlcat(attvals, iel < len-1 ? " " : "", attvalslen);
break;
case NC_INT64:
i64 = vals[iel];
i64 = (int64_t)vals[iel];
res = snprintf(gps, PRIM_LEN, "%lld", i64);
assert(res < PRIM_LEN);
(void) strlcat(attvals, gps, attvalslen);
(void) strlcat(attvals, iel < len-1 ? " " : "", attvalslen);
break;
case NC_UINT64:
ui64 = vals[iel];
ui64 = (uint64_t)vals[iel];
res = snprintf(gps, PRIM_LEN, "%llu", ui64);
assert(res < PRIM_LEN);
(void) strlcat(attvals, gps, attvalslen);
(void) strlcat(attvals, iel < len-1 ? " " : "", attvalslen);
break;
case NC_FLOAT:
ff = vals[iel];
ff = (float)vals[iel];
res = snprintf(gps, PRIM_LEN, float_attx_fmt, ff);
assert(res < PRIM_LEN);
tztrim(gps); /* trim trailing 0's after '.' */
@ -847,7 +847,7 @@ pr_att(
case NC_VLEN:
/* because size returned for vlen is base type size, but we
* need space to read array of vlen structs into ... */
data = emalloc((att.len + 1) * sizeof(nc_vlen_t));
data = emalloc((att.len + 1) * sizeof(nc_vlen_t));
break;
case NC_OPAQUE:
data = emalloc((att.len + 1) * type_size);

View File

@ -226,8 +226,8 @@ main(int argc, char **argv)
#define ATT_NAME_CMP "my_favorite_wind_speeds"
#define COMPOUND_NAME "wind_vector"
#define NUM_FAVS 3
#define U_VALUE 13.3
#define V_VALUE 12.2
#define U_VALUE 13.3f
#define V_VALUE 12.2f
{
int ncid;

View File

@ -91,7 +91,7 @@ main(int argc, char **argv)
array[i] = (float *) malloc(ncolumns * sizeof(float));
if(array[i] == NULL) ERR;
for (j = 0; j < ncolumns; j++) {
array[i][j] = 10.0 * (i + 1) + j;
array[i][j] = 10.0f * (float)(i + 1) + (float)j;
}
}
array[4][0] = missing_value; /* overwrite last row with missing for equality test */

View File

@ -18,7 +18,9 @@ TARGET_LINK_LIBRARIES(nctest netcdf)
ADD_TEST(nctest ${EXECUTABLE_OUTPUT_PATH}/nctest)
add_bin_test_no_prefix(tst_rename)
add_sh_test(nctest compare_test_files)
IF(HAVE_BASH)
SET_TESTS_PROPERTIES(nctest_compare_test_files PROPERTIES DEPENDS nctest)
ENDIF(HAVE_BASH)
IF(BUILD_UTILITIES)
add_sh_test(nctest compare_test_files)
IF(HAVE_BASH)
SET_TESTS_PROPERTIES(nctest_compare_test_files PROPERTIES DEPENDS nctest)
ENDIF(HAVE_BASH)
ENDIF(BUILD_UTILITIES)

View File

@ -52,7 +52,7 @@ calculate_waste(int ndims, size_t *dimlen, size_t *chunksize, float *waste)
#endif
/* Percent of the chunked file that is wasted space. */
*waste = ((float)(chunked - unchunked) / (float)chunked) * 100.0;
*waste = ((float)(chunked - unchunked) / (float)chunked) * 100.0f;
#ifdef PRINT_CHUNK_WASTE_REPORT
printf("\ndimlen\tchunksize\tnum_chunks\n");