Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
SET(HDF5_C_LIBRARY_hdf5 "${HDF5_C_LIBRARY}")
ENDIF()

find_package(Threads REQUIRED)

###
# The following options are not used in Windows currently.
###
Expand Down Expand Up @@ -1899,6 +1901,13 @@ FILE(COPY ${netCDF_SOURCE_DIR}/include/netcdf_meta.h
SET(EXTRA_DIST ${EXTRA_DIST} ${CMAKE_SOURCE_DIR}/test_common.in)
SET(TOPSRCDIR "${CMAKE_SOURCE_DIR}")
SET(TOPBUILDDIR "${CMAKE_BINARY_DIR}")
IF(MSVC)
# Seems this is always upper-case by this point :-(
SET(VS_CONFIGURATION "/${CMAKE_BUILD_TYPE}")
ELSE()
SET(VS_CONFIGURATION "")
ENDIF()

configure_file(${CMAKE_SOURCE_DIR}/test_common.in ${CMAKE_BINARY_DIR}/test_common.sh @ONLY NEWLINE_STYLE LF)

#####
Expand Down
3 changes: 3 additions & 0 deletions config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ are set when opening a binary file on Windows. */
#endif
#endif

#if _MSC_VER<1900
#define __func__ __FUNCTION__
#endif

#define strdup _strdup
#define fdopen _fdopen
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,7 @@ AC_SUBST(HAS_MMAP,[$enable_mmap])
AC_SUBST(HAS_JNA,[$enable_jna])
AC_SUBST(RELAX_COORD_BOUND,[$enable_relax_coord_bound])
AC_SUBST(HAS_ERANGE_FILL,[$enable_erange_fill])
AC_SUBST(VS_CONFIGURATION,[])

# Include some specifics for netcdf on windows.
#AH_VERBATIM([_WIN32_STRICMP],
Expand Down
8 changes: 5 additions & 3 deletions examples/CDL/do_comps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# This shell script runs the cmp test on the example programs.
# $Id: do_comps.sh,v 1.1 2006/06/27 17:44:54 ed Exp $

. ../../test_common.sh

set -e

##
Expand All @@ -11,13 +13,13 @@ set -e
echo ""
echo "*** Creating example data files from CDL scripts."
echo "*** creating simple_xy.nc..."
../../ncgen/ncgen -b -o simple_xy.nc $srcdir/simple_xy.cdl
../../ncgen${VS}/ncgen -b -o simple_xy.nc $srcdir/simple_xy.cdl

echo "*** checking sfc_pres_temp.nc..."
../../ncgen/ncgen -b -o sfc_pres_temp.nc $srcdir/sfc_pres_temp.cdl
../../ncgen${VS}/ncgen -b -o sfc_pres_temp.nc $srcdir/sfc_pres_temp.cdl

echo "*** checking pres_temp_4D.nc..."
../../ncgen/ncgen -b -o pres_temp_4D.nc $srcdir/pres_temp_4D.cdl
../../ncgen${VS}/ncgen -b -o pres_temp_4D.nc $srcdir/pres_temp_4D.cdl

echo "*** All example creations worked!"

Expand Down
2 changes: 1 addition & 1 deletion hdf4_test/run_get_hdf4_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ getfile() {
for try in 1 2 3 4 ; do # try 4 times

# signal success/failure
if wget -c $Q --passive-ftp $FTPFILE ; then
if wget -c $Q --passive-ftp $FTPFILE || curl -O $FTPFILE; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add this change in one of my outstanding branches as well.

return 0 # got it
fi
echo "wget failed: try $try"
Expand Down
6 changes: 4 additions & 2 deletions libdispatch/drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ See LICENSE.txt for license information.
#include "ncrc.h"
#include "nclog.h"
#include "ncwinpath.h"
#include <stdint.h>

#define RCFILEENV "DAPRCFILE"

Expand Down Expand Up @@ -366,9 +367,10 @@ rclocate(const char* key, const char* hostport)
if(hostport == NULL) hostport = "";

for(found=0,i=0;i<nclistlength(rc);i++) {
triple = (NCTriple*)nclistget(rc,i);
size_t hplen = (triple->host == NULL ? 0 : strlen(triple->host));
int t;
size_t hplen;
triple = (NCTriple*)nclistget(rc,i);
hplen = (triple->host == NULL ? 0 : strlen(triple->host));
if(strcmp(key,triple->key) != 0) continue; /* keys do not match */
/* If the triple entry has no url, then use it
(because we have checked all other cases)*/
Expand Down
6 changes: 4 additions & 2 deletions libdispatch/nchashmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,12 @@ NC_hashmapadd(NC_hashmap* hash, uintptr_t data, const char* key, size_t keysize)
rehash(hash);
for(;;) {
size_t index;
NC_hentry* entry;
if(!locate(hash,hashkey,key,keysize,&index,1)) {
rehash(hash);
continue; /* try on larger table */
}
NC_hentry* entry = &hash->table[index];
entry = &hash->table[index];
if(entry->flags & ACTIVE) {
/* key already exists in table => overwrite data */
entry->data = data;
Expand Down Expand Up @@ -376,8 +377,9 @@ findPrimeGreaterThan(size_t val)
v = (unsigned int)val;

for(;;) {
int m;
if(L >= R) break;
int m = (L + R) / 2;
m = (L + R) / 2;
/* is this an acceptable prime? */
if(NC_primes[m-1] < v && NC_primes[m] >= v)
return NC_primes[m]; /* acceptable*/
Expand Down
1 change: 1 addition & 0 deletions libhdf5/nc4hdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "nc4dispatch.h"
#include <H5DSpublic.h>
#include <math.h>
#include <inttypes.h>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This include is already below:

#ifdef HAVE_INTTYPES_H
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#endif

Is that not working for your build?


#ifdef HAVE_INTTYPES_H
#define __STDC_FORMAT_MACROS
Expand Down
4 changes: 3 additions & 1 deletion nc_test/tst_def_var_fill.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Author: Wei-keng Liao.
*/

#include "config.h"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this change in another current PR #1266 so that it gets into the code base. All test programs must start by including config.h. I also checked the other tests in nc_test and nc_test4 and found a bunch more places where the include was missing, so I fixed those too. Thanks for noticing this.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -38,6 +39,7 @@ int main(int argc, char** argv) {
size_t start[2], count[2];
int formats[5]={NC_FORMAT_CLASSIC, NC_FORMAT_64BIT_OFFSET, NC_FORMAT_CDF5,
NC_FORMAT_NETCDF4, NC_FORMAT_NETCDF4_CLASSIC};
char *cmd_str;

if (argc > 2) {
printf("Usage: %s [filename]\n",argv[0]);
Expand All @@ -46,7 +48,7 @@ int main(int argc, char** argv) {
if (argc == 2) snprintf(filename, 256, "%s", argv[1]);
else strcpy(filename, "tst_def_var_fill.nc");

char *cmd_str = (char*)malloc(strlen(argv[0]) + 256);
cmd_str = (char*)malloc(strlen(argv[0]) + 256);
sprintf(cmd_str, "*** TESTING C %s for def_var_fill ", argv[0]);
printf("%-66s ------ ", cmd_str); fflush(stdout);
free(cmd_str);
Expand Down
24 changes: 8 additions & 16 deletions ncdap_test/t_srcdir.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@
static const char*
gettopsrcdir(void)
{
const char* topsrcdir = NULL;
#ifdef TOPSRCDIR
topsrcdir = STRINGIFY(TOPSRCDIR);
#else
static char tsd[4096];
extern char *getcwd(char *buf, size_t size);
tsd[0] = '\0';
getcwd(tsd,sizeof(tsd));
if(strlen(tsd) > 0) {
strcat(tsd,"/..");
topsrcdir = tsd;
}
#endif
const char* topsrcdir;
topsrcdir = getenv("TOPSRCDIR");
if(topsrcdir == NULL) {
fprintf(stderr,"*** FAIL: $abs_top_srcdir not defined\n");
exit(1);
}
topsrcdir = STRINGIFY(TOPSRCDIR);
if(topsrcdir == NULL) {
fprintf(stderr,"*** FAIL: Neither $abs_top_srcdir nor env var TOPSRCDIR defined\n");
exit(1);
}
}
fprintf(stderr,"topsrcdir=%s\n",topsrcdir);
return topsrcdir;
}
3 changes: 1 addition & 2 deletions ncdump/tst_nccopy4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TESTFILES='tst_comp tst_comp2 tst_enum_data tst_fillbug
# Run these programs to create some test files.
${execdir}/tst_comp2
${execdir}/tst_compress
${execdir}/tst_chunking

echo "*** Testing netCDF-4 features of nccopy on ncdump/*.nc files"
for i in $TESTFILES ; do
Expand All @@ -31,7 +32,6 @@ ${NCDUMP} copy_of_$i.nc > copy_of_$i.cdl
rm copy_of_$i.nc copy_of_$i.cdl tmp.cdl
done
# echo "*** Testing compression of deflatable files ..."
./tst_compress
echo "*** Test nccopy -d1 can compress a classic format file ..."
$NCCOPY -d1 tst_inflated.nc tst_deflated.nc
if test `wc -c < tst_deflated.nc` -ge `wc -c < tst_inflated.nc`; then
Expand Down Expand Up @@ -73,7 +73,6 @@ ${NCDUMP} copy_of_$i.nc > copy_of_$i.cdl
diff copy_of_$i.cdl tmp.cdl
rm copy_of_$i.nc copy_of_$i.cdl tmp.cdl
done
./tst_chunking
echo "*** Test that nccopy -c can chunk and unchunk files"
$NCCOPY tst_chunking.nc tmp.nc
${NCDUMP} tmp.nc > tmp.cdl
Expand Down
2 changes: 1 addition & 1 deletion ncdump/tst_netcdf4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ ${NCDUMP} tst_nans.nc | sed 's/e+0/e+/g' > tst_nans.cdl ; ERR
diff -b tst_nans.cdl $srcdir/ref_tst_nans.cdl ; ERR

# Do unicode test only if it exists => BUILD_UTF8 is true
if test -f ./tst_unicode -o -f ./tst_unicode.exe ; then
if test -f ./tst_unicode -o -f ./tst_unicode.exe -o -f ${execdir}/tst_unicode.exe; then
echo "*** dumping tst_unicode.nc to tst_unicode.cdl..."
${execdir}/tst_unicode ; ERR
${NCDUMP} tst_unicode.nc | sed 's/e+0/e+/g' > tst_unicode.cdl ; ERR
Expand Down
3 changes: 2 additions & 1 deletion oc2/ocnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,15 @@ mergedods1(OCnode* dds, OCnode* dods)
OCnode* attnode = (OCnode*)nclistget(dods->subnodes,i);
if(attnode->octype == OC_Attribute) {
OCattribute* att;
char* newname;
/* prefix the attribute name with the name of the attribute
set plus "."
*/
size_t len = strlen(attnode->name)
+ strlen(dods->name)
+ strlen(".");
len++; /*strlcat nul*/
char* newname = (char*)malloc(len+1);
newname = (char*)malloc(len+1);
if(newname == NULL) return OC_ENOMEM;
strncpy(newname,dods->name,len);
strlcat(newname,".",len);
Expand Down
9 changes: 7 additions & 2 deletions test_common.in
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ if test "x$SETX" = x1 ; then set -x ; fi
top_srcdir="$TOPSRCDIR"
top_builddir="$TOPBUILDDIR"

# Currently not used, but left as a Visual Studio placeholder.
# VS=Debug
# Only set via CMake builds, where it must contain a leading '/'
export VS=@VS_CONFIGURATION@

# srcdir may or may not be defined, but if not, then create it
if test "x$srcdir" = x ; then
Expand All @@ -77,6 +77,11 @@ builddir=`pwd`
# execdir is an alias for builddir
execdir="${builddir}"

# VS build dir support
if test -d "${execdir}${VS}"; then
execdir="${execdir}${VS}"
fi

# pick off the last component as the relative name of this directory
thisdir=`basename $srcdir`

Expand Down