Skip to content

Commit ac5c2f5

Browse files
authored
Merge pull request #2277 from WardF/gh2222.wif
Conflict resolution
2 parents 7958a5b + 3446aa0 commit ac5c2f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+833
-592
lines changed

.github/workflows/run_tests_osx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
name: Run macOS-based netCDF Tests
88

99

10-
on: [pull_request]
10+
on: [pull_request,push]
1111

1212
jobs:
1313

CMakeLists.txt

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ IF(UNAME)
5757
set(TMP_BUILDNAME "${osname}-${osrel}-${cpu}")
5858
ENDIF()
5959

60+
# Define some Platforms
61+
if(osname MATCHES "CYGWIN.*")
62+
SET(ISCYGWIN yes)
63+
endif()
64+
if(osname MATCHES "Darwin.*")
65+
SET(ISOSX yes)
66+
endif()
67+
if(MSVC)
68+
SET(ISMSVC yes)
69+
endif()
70+
if(osname MATCHES "MINGW.*")
71+
SET(ISMINGW yes)
72+
SET(MINGW yes)
73+
endif()
74+
6075
###
6176
# Allow for some customization of the buildname.
6277
# This will make it easier to identify different builds,
@@ -88,6 +103,7 @@ INCLUDE(GNUInstallDirs)
88103

89104
IF(MSVC)
90105
SET(GLOBAL PROPERTY USE_FOLDERS ON)
106+
ADD_COMPILE_OPTIONS("/utf-8")
91107
ENDIF()
92108

93109
#Add custom CMake Module
@@ -427,7 +443,6 @@ IF(NOT MSVC)
427443
ENDIF(BUILD_FORTRAN)
428444
ENDIF()
429445

430-
431446
###
432447
# Allow the user to specify libraries
433448
# to link against, similar to automakes 'LIBS' variable.
@@ -1846,6 +1861,26 @@ IF(ENABLE_MMAP)
18461861
ENDIF(ENABLE_MMAP)
18471862

18481863
#CHECK_FUNCTION_EXISTS(alloca HAVE_ALLOCA)
1864+
1865+
# Used in the `configure_file` calls below
1866+
SET(ISCMAKE "1")
1867+
IF(MSVC)
1868+
SET(ISMSVC ON CACHE BOOL "" FORCE)
1869+
SET(REGEDIT ON CACHE BOOL "" FORCE)
1870+
# Get windows major version and build number
1871+
EXECUTE_PROCESS(COMMAND "systeminfo" OUTPUT_VARIABLE WININFO)
1872+
IF(WININFO STREQUAL "")
1873+
SET(WVM 0)
1874+
SET(WVB 0)
1875+
ELSE()
1876+
STRING(REGEX MATCH "\nOS Version:[ \t]+[0-9.]+" WINVERLINE "${WININFO}")
1877+
STRING(REGEX REPLACE "[^0-9]*([0-9]+)[.]([0-9])+[.]([0-9]+)" "\\1" WVM "${WINVERLINE}")
1878+
STRING(REGEX REPLACE "[^0-9]*([0-9]+)[.]([0-9])+[.]([0-9]+)" "\\3" WVB "${WINVERLINE}")
1879+
ENDIF()
1880+
SET(WINVERMAJOR ${WVM} CACHE STRING "" FORCE)
1881+
SET(WINVERBUILD ${WVB} CACHE STRING "" FORCE)
1882+
ENDIF()
1883+
18491884
#####
18501885
# End system inspection checks.
18511886
#####
@@ -2467,13 +2502,6 @@ configure_file(
24672502
${netCDF_SOURCE_DIR}/include/netcdf_dispatch.h.in
24682503
${netCDF_BINARY_DIR}/include/netcdf_dispatch.h @ONLY NEWLINE_STYLE LF)
24692504

2470-
# Used in the `configure_file` calls below
2471-
SET(ISCMAKE "1")
2472-
IF(MSVC)
2473-
SET(ISMSVC "1")
2474-
SET(REGEDIT 1)
2475-
ENDIF()
2476-
24772505
####
24782506
# Build test_common.sh
24792507
#####

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This file contains a high-level description of this package's evolution. Release
1212
* [Bug Fix] Require that the type of the variable in nc_def_var_filter is not variable length. See [Github #/2231](https://github.com/Unidata/netcdf-c/pull/2231).
1313
* [File Change] Apply HDF5 v1.8 format compatibility when writing to previous files, as well as when creating new files. The superblock version remains at 2 for newly created files. Full backward read/write compatibility for netCDF-4 is maintained in all cases. See [Github #2176](https://github.com/Unidata/netcdf-c/issues/2176).
1414
* [Enhancement] Add ability to set dataset alignment for netcdf-4/HDF5 files. See [Github #2206](https://github.com/Unidata/netcdf-c/pull/2206).
15+
* [Bug Fix] Improve UTF8 support on windows so that it can use utf8 natively. See [Github #2222](https://github.com/Unidata/netcdf-c/pull/2222).
1516
* [Enhancement] Add complete bitgroom support to NCZarr. See [Github #2197](https://github.com/Unidata/netcdf-c/pull/2197).
1617
* [Bug Fix] Clean up the handling of deeply nested VLEN types. Marks nc_free_vlen() and nc_free_string as deprecated in favor of ncaux_reclaim_data(). See [Github #2179](https://github.com/Unidata/netcdf-c/pull/2179).
1718
* [Bug Fix] Make sure that netcdf.h accurately defines the flags in the open/create mode flags. See [Github #2183](https://github.com/Unidata/netcdf-c/pull/2183).

config.h.cmake.in

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,6 @@ are set when opening a binary file on Windows. */
157157
/* if true, Allow dynamically loaded plugins */
158158
#cmakedefine ENABLE_PLUGINS 1
159159

160-
/* Do we have access to the Windows Registry */
161-
#cmakedefine REGEDIT 1
162-
163-
/* define the possible sources for remote test servers */
164-
#cmakedefine REMOTETESTSERVERS "${REMOTETESTSERVERS}"
165-
166160
/* if true, run extra tests which may not work yet */
167161
#cmakedefine EXTRA_TESTS 1
168162

@@ -510,6 +504,12 @@ with zip */
510504
/* Define to the version of this package. */
511505
#cmakedefine PACKAGE_VERSION "${netCDF_VERSION}"
512506

507+
/* Do we have access to the Windows Registry */
508+
#cmakedefine REGEDIT 1
509+
510+
/* define the possible sources for remote test servers */
511+
#cmakedefine REMOTETESTSERVERS "${REMOTETESTSERVERS}"
512+
513513
/* The size of `ulonglong` as computed by sizeof. */
514514
#cmakedefine SIZEOF_ULONGLONG @SIZEOF_ULONGLONG@
515515

@@ -628,6 +628,10 @@ with zip */
628628
/* Version number of package */
629629
#cmakedefine VERSION "${netCDF_VERSION}"
630630

631+
/* Capture Windows version and build */
632+
#cmakedefine WINVERMAJOR ${WINVERMAJOR}
633+
#cmakedefine WINVERBUILD ${WINVERBUILD}
634+
631635
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
632636
significant byte first (like Motorola and SPARC, unlike Intel). */
633637
#if defined AC_APPLE_UNIVERSAL_BUILD

configure.ac

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ ISMINGW=yes
106106
ISMSYS=yes
107107
fi
108108

109+
# Get windows version info
110+
WINVER=`systeminfo | sed -e '/^OS Version:/p' -ed | sed -e 's|[^0-9]*\([0-9.]*\).*|\1|'`
111+
WINVERMAJOR=`echo $WVER | sed -e 's|\([^.]*\)[.]\([^.]*\)[.]\(.*\)|\1|'`
112+
WINVERBUILD=`echo $WVER | sed -e 's|\([^.]*\)[.]\([^.]*\)[.]\(.*\)|\3|'`
113+
if test "x$WINVERMAJOR" = x ; then WINVERMAJOR=0; fi
114+
if test "x$WINVERBUILD" = x ; then WINVERBUILD=0; fi
115+
AC_DEFINE_UNQUOTED([WINVERMAJOR], [$WINVERMAJOR], [windows version major])
116+
AC_DEFINE_UNQUOTED([WINVERBUILD], [$WINVERBUILD], [windows version build])
117+
109118
AC_MSG_NOTICE([checking supported formats])
110119

111120
# An explicit disable of netcdf-4 | netcdf4 is treated as if it was disable-hdf5
@@ -1279,6 +1288,8 @@ AM_CONDITIONAL(ISMINGW, [test "x$ISMINGW" = xyes])
12791288
AM_CONDITIONAL(ISMSYS, [test "x$ISMSYS" = xyes])
12801289

12811290
AC_SUBST([ISMSVC], [${ISMSVC}])
1291+
AC_SUBST([WINVERMAJOR], [${WINVERMAJOR}])
1292+
AC_SUBST([WINVERBUILD], [${WINVERBUILD}])
12821293
AC_SUBST([ISCYGWIN], [${ISCYGWIN}])
12831294
AC_SUBST([ISOSX], [${ISOSX}])
12841295
AC_SUBST([ISMINGW], [${ISMINGW}])

dap4_test/test_common.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,6 @@ static char* outfile = NULL;
2626
static int ncid = 0;
2727
static int translatenc4 = 0;
2828

29-
static int
30-
readfile(const char* filename, NCbytes* content)
31-
{
32-
FILE* stream;
33-
char part[1024];
34-
35-
stream = fopen(filename,"r");
36-
if(stream == NULL) return errno;
37-
for(;;) {
38-
size_t count = fread(part, 1, sizeof(part), stream);
39-
if(count <= 0) break;
40-
ncbytesappendn(content,part,count);
41-
if(ferror(stream)) {fclose(stream); return NC_EIO;}
42-
if(feof(stream)) break;
43-
}
44-
ncbytesnull(content);
45-
fclose(stream);
46-
return NC_NOERR;
47-
}
48-
4929
static void
5030
fail(int code)
5131
{
@@ -86,7 +66,7 @@ setup(int tdmr, int argc, char** argv)
8666
outfile = NULL;
8767
input = ncbytesnew();
8868
output = ncbytesnew();
89-
if((ret = readfile(infile,input))) fail(ret);
69+
if((ret = NC_readfile(infile,input))) fail(ret);
9070
{
9171
const char* trans = getenv("translatenc4");
9272
if(trans != NULL)

include/nc_tests.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "netcdf.h"
2121
#include "netcdf_filter.h"
2222
#include "nc_logging.h"
23+
#include "ncpathmgr.h"
24+
#include "ncrc.h"
2325
#ifdef USE_PARALLEL
2426
#include "netcdf_par.h"
2527
#endif

include/ncrc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ EXTERNL int NC__testurl(const char* path, char** basenamep);
8686
EXTERNL int NC_isLittleEndian(void);
8787
EXTERNL char* NC_entityescape(const char* s);
8888
EXTERNL int NC_readfile(const char* filename, NCbytes* content);
89+
EXTERNL int NC_readfilen(const char* filename, NCbytes* content, long long len);
90+
EXTERNL int NC_readfileF(FILE* fp, NCbytes* content, long long len);
8991
EXTERNL int NC_writefile(const char* filename, size_t size, void* content);
9092
EXTERNL char* NC_mktmp(const char* base);
9193
EXTERNL int NC_getmodelist(const char* modestr, NClist** modelistp);

libdap4/d4file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,17 +395,17 @@ set_curl_properties(NCD4INFO* d4info)
395395
FILE* f = NULL;
396396
char* fname = d4info->auth->curlflags.cookiejar;
397397
/* See if the file exists already */
398-
f = fopen(fname,"r");
398+
f = NCfopen(fname,"r");
399399
if(f == NULL) {
400400
/* Ok, create it */
401-
f = fopen(fname,"w+");
401+
f = NCfopen(fname,"w+");
402402
if(f == NULL) {
403403
fprintf(stderr,"Cookie file cannot be read and written: %s\n",fname);
404404
{ret= NC_EPERM; goto fail;}
405405
}
406406
} else { /* test if file can be written */
407407
fclose(f);
408-
f = fopen(fname,"r+");
408+
f = NCfopen(fname,"r+");
409409
if(f == NULL) {
410410
fprintf(stderr,"Cookie file is cannot be written: %s\n",fname);
411411
{ret = NC_EPERM; goto fail;}

libdap4/d4includes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "ncuri.h"
4343
#include "nclog.h"
4444
#include "ncdap.h"
45+
#include "ncpathmgr.h"
4546

4647
#include "d4util.h"
4748

0 commit comments

Comments
 (0)