mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-04-24 18:30:51 +08:00
Merge pull request #2003 from DennisHeimbigner/closedir.dmh
Fix NCclosedir in dpathmgr.c
This commit is contained in:
commit
427166f02d
@ -6,6 +6,7 @@ Release Notes {#RELEASE_NOTES}
|
||||
This file contains a high-level description of this package's evolution. Releases are in reverse chronological order (most recent first). Note that, as of netcdf 4.2, the `netcdf-c++` and `netcdf-fortran` libraries have been separated into their own libraries.
|
||||
## 4.8.1 - TBD
|
||||
|
||||
* [Bug Fix] Fix bug in NCclosedir in dpathmgr.c. See [Github #2003](https://github.com/Unidata/netcdf-c/issues/2003).
|
||||
* [Bug Fix] Fix bug in ncdump that assumes that there is a relationship between the total number of dimensions and the max dimension id. See [Github #2004](https://github.com/Unidata/netcdf-c/issues/2004).
|
||||
* [Bug Fix] Fix bug in JSON processing of strings with embedded quotes. See [Github #1993](https://github.com/Unidata/netcdf-c/issues/1993).
|
||||
* [Enhancement] Add support for the new "dimension_separator" enhancement to Zarr v2. See [Github #1990](https://github.com/Unidata/netcdf-c/pull/1990) for more information.
|
||||
|
@ -1095,10 +1095,16 @@ AC_C_BIGENDIAN
|
||||
# Figure out platforms of special interest
|
||||
case "`uname`" in
|
||||
CYGWIN*) ISCYGWIN=yes;;
|
||||
Darwin*) ISOSX=yes;;
|
||||
WIN*) ISMSVC=yes;;
|
||||
esac
|
||||
AM_CONDITIONAL(ISCYGWIN, [test "x$ISCYGWIN" = xyes])
|
||||
AM_CONDITIONAL(ISMSVC, [test "x$ISMSVC" = xyes])
|
||||
AM_CONDITIONAL(ISOSX, [test "x$ISOSX" = xyes])
|
||||
|
||||
AC_SUBST([ISMSVC], [${ISMSVC}])
|
||||
AC_SUBST([ISCYGWIN], [${ISCYGWIN}])
|
||||
AC_SUBST([ISOSX], [${ISOSX}])
|
||||
|
||||
###
|
||||
# Crude hack to work around an issue
|
||||
@ -1722,8 +1728,6 @@ AC_DEFINE_UNQUOTED([NC_DISPATCH_VERSION], [${NC_DISPATCH_VERSION}], [Dispatch ta
|
||||
# End netcdf_meta.h definitions.
|
||||
#####
|
||||
|
||||
# This would be true for a visual studio build.
|
||||
AC_SUBST([ISMSVC], [${ISMSVC}])
|
||||
# This would be true for a cmake build.
|
||||
AC_SUBST([ISCMAKE], [])
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include "XGetopt.h"
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
@ -14,6 +14,9 @@
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
@ -133,11 +136,11 @@ EXTERNL int NCclosedir(DIR* ent);
|
||||
#define NCaccess(path,mode) access(path,mode)
|
||||
#define NCmkdir(path,mode) mkdir(path,mode)
|
||||
#define NCgetcwd(buf,len) getcwd(buf,len)
|
||||
#define NCcwd(buf, len) getcwd(buf,len)
|
||||
#define NCrmdir(path) rmdir(path)
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#define NCstat(path,buf) stat(path,buf)
|
||||
#endif
|
||||
#define NCcwd(buf, len) getcwd(buf,len)
|
||||
#define NCrmdir(path) rmdir(path)
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#define NCopendir(path) opendir(path)
|
||||
#define NCclosedir(ent) closedir(ent)
|
||||
|
@ -356,10 +356,7 @@ int
|
||||
NCclosedir(DIR* ent)
|
||||
{
|
||||
int stat = NC_NOERR;
|
||||
char* cvtname = NCpathcvt(path);
|
||||
if(cvtname == NULL) {errno = ENOENT; return -1;}
|
||||
stat = closedir(cvtname);
|
||||
free(cvtname);
|
||||
if(closedir(ent) < 0) stat = errno;
|
||||
return stat;
|
||||
}
|
||||
#endif
|
||||
@ -911,33 +908,3 @@ printutf8hex(const char* s, char* sx)
|
||||
}
|
||||
*q = '\0';
|
||||
}
|
||||
|
||||
/**************************************************/
|
||||
#if 0
|
||||
#ifdef HAVE_DIRENT_H
|
||||
EXTERNL
|
||||
DIR*
|
||||
NCopendir(const char* path)
|
||||
{
|
||||
DIR* ent = NULL;
|
||||
char* cvtpath = NCpathcvt(path);
|
||||
if(cvtpath == NULL) return -1;
|
||||
ent = opendir(cvtpath);
|
||||
free(cvtpath);
|
||||
return ent;
|
||||
}
|
||||
|
||||
EXTERNL
|
||||
int
|
||||
NCclosedir(DIR* ent)
|
||||
{
|
||||
int stat = 0;
|
||||
char* cvtpath = NCpathcvt(path);
|
||||
if(cvtpath == NULL) return -1;
|
||||
stat = closedir(cvtpath);
|
||||
free(cvtpath);
|
||||
return stat;
|
||||
}
|
||||
#endif
|
||||
#endif /*0*/
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#undef ZDEBUG1 /* detailed debug */
|
||||
|
||||
#undef ZCATCH /* Warning: significant performance impact */
|
||||
#define ZTRACING /* Warning: significant performance impact */
|
||||
#undef ZTRACING /* Warning: significant performance impact */
|
||||
|
||||
#include "ncexternl.h"
|
||||
#include "nclog.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
|
@ -377,13 +377,16 @@ nczm_localize(const char* path, char** localpathp, int localize)
|
||||
char* p;
|
||||
int forward = 1;
|
||||
int offset = 0;
|
||||
static const char* windrive = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
#ifdef _MSC_VER
|
||||
forward = (localize?0:1);
|
||||
#endif
|
||||
/* If path comes from a url, then it may start with: /x:/...
|
||||
where x is a drive letter. If so, then remove leading / */
|
||||
if(path[0] == '/' && NChasdriveletter(path+1))
|
||||
if(strlen(path) >= 4
|
||||
&& path[0] == '/' && strchr(windrive,path[1]) != NULL
|
||||
&& path[2] == ':' && path[3] == '/')
|
||||
offset = 1;
|
||||
if((localpath = strdup(path+offset))==NULL) return NC_ENOMEM;
|
||||
|
||||
|
@ -27,14 +27,8 @@ FP_NAME="$1"
|
||||
# Figure out the compiler (some values from ./configure)
|
||||
FP_ISCMAKE=@ISCMAKE@
|
||||
FP_ISMSVC=@ISMSVC@
|
||||
|
||||
# Are we operating under OS-X? (test using uname)
|
||||
FP_OS=`uname | cut -d '_' -f 1`
|
||||
if test "x$FP_OS" = xDarwin ; then FP_ISOSX=1; fi
|
||||
|
||||
# Are we operating under CYGWIN? (test using uname)
|
||||
FP_OS=`uname | cut -d '_' -f 1`
|
||||
if test "x$FP_OS" = xCYGWIN ; then FP_ISCYGWIN=1; fi
|
||||
FP_ISCYGWIN=@ISCYGWIN@
|
||||
FP_ISOSX=@ISOSX@
|
||||
|
||||
FP_PLUGINS="$TOPBUILDDIR/plugins"
|
||||
|
||||
|
@ -66,7 +66,7 @@ bom tst_dimsizes nctrunc tst_rcmerge
|
||||
# Tests for classic and 64-bit offset files.
|
||||
TESTS = tst_inttags.sh run_tests.sh tst_64bit.sh ref_ctest \
|
||||
ref_ctest64 tst_output.sh tst_lengths.sh tst_calendars.sh \
|
||||
run_utf8_tests.sh test_unicode_directory.sh tst_nccopy3.sh tst_nccopy3_subset.sh \
|
||||
run_utf8_tests.sh tst_nccopy3.sh tst_nccopy3_subset.sh \
|
||||
tst_charfill.sh tst_iter.sh tst_formatx3.sh tst_bom.sh \
|
||||
tst_dimsizes.sh run_ncgen_tests.sh tst_ncgen4_classic.sh test_radix.sh test_rcmerge.sh
|
||||
|
||||
@ -80,6 +80,10 @@ if USE_STRICT_NULL_BYTE_HEADER_PADDING
|
||||
XFAIL_TESTS += tst_null_byte_padding.sh
|
||||
endif
|
||||
|
||||
if ! ISCYGWIN
|
||||
TESTS += test_unicode_directory.sh
|
||||
endif
|
||||
|
||||
if LARGE_FILE_TESTS
|
||||
TESTS += tst_iter.sh
|
||||
endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include "XGetopt.h"
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@ Research/Unidata. See \ref copyright file for more info. */
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include "XGetopt.h"
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
@ -73,7 +73,7 @@ THIS SOFTWARE.
|
||||
#include <unistd.h> /* read() getopt() */
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include "XGetopt.h"
|
||||
#define snprintf _snprintf
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "oc.h"
|
||||
#include "ocx.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include "XGetopt.h"
|
||||
#endif
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include "XGetopt.h"
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include "XGetopt.h"
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include "XGetopt.h"
|
||||
#endif
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include "XGetopt.h"
|
||||
#endif
|
||||
|
||||
|
@ -11,7 +11,7 @@ x * Copyright 2018, University Corporation for Atmospheric Research
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
#include "XGetopt.h"
|
||||
#endif
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -10,6 +10,7 @@ TOPSRCDIR='@abs_top_srcdir@'
|
||||
TOPBUILDDIR='@abs_top_builddir@'
|
||||
FP_ISCMAKE=@ISCMAKE@
|
||||
FP_ISMSVC=@ISMSVC@
|
||||
FP_ISCYGWIN=@ISCYGWIN@
|
||||
|
||||
# Feature flags
|
||||
FEATURE_HDF5=@HAS_HDF5@
|
||||
|
Loading…
x
Reference in New Issue
Block a user