mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-03-25 17:40:27 +08:00
more win32 fixes
This commit is contained in:
parent
4f68d6c5f8
commit
14c3dae49e
@ -18,7 +18,7 @@
|
||||
#endif
|
||||
#include "nc.h"
|
||||
|
||||
#undef DEBUG
|
||||
#define DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
@ -299,6 +299,12 @@ memio_open(const char* path,
|
||||
fd = open(path, oflags, 0, "ctx=stm");
|
||||
#else
|
||||
fd = open(path, oflags, OPENMODE);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
if(fd < 0) {
|
||||
fprintf(stderr,"open failed: file=%s err=",path);
|
||||
perror("");
|
||||
}
|
||||
#endif
|
||||
if(fd < 0) {status = errno; goto unwind_open;}
|
||||
|
||||
|
@ -39,9 +39,8 @@ ncio_create(const char *path, int ioflags, size_t initialsz,
|
||||
off_t igeto, size_t igetsz, size_t *sizehintp,
|
||||
ncio** iopp, void** const mempp)
|
||||
{
|
||||
if(fIsSet(ioflags,NC_DISKLESS))
|
||||
|
||||
#ifdef USE_DISKLESS
|
||||
if(fIsSet(ioflags,NC_DISKLESS))
|
||||
# ifdef USE_MMAP
|
||||
return mmapio_create(path,ioflags,initialsz,igeto,igetsz,sizehintp,iopp,mempp);
|
||||
# else
|
||||
|
@ -37,21 +37,18 @@
|
||||
/* Global */
|
||||
int diskless = 0;
|
||||
|
||||
int status = NC_NOERR;
|
||||
|
||||
static void
|
||||
report(int status,int lineno)
|
||||
{
|
||||
if(status) {
|
||||
fprintf(stderr,"fail: line %d; %s\n",lineno,nc_strerror(status));
|
||||
fflush(stderr);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
#undef ERR
|
||||
#define ERR report(status,__LINE__)
|
||||
|
||||
static int status = NC_NOERR;
|
||||
|
||||
void report(int stat, int lno)
|
||||
{
|
||||
fprintf(stderr,"line: %d ; %s\n",stat,nc_strerror(stat));
|
||||
fflush(stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Test a diskless file with two record vars, which grow, and has
|
||||
* attributes added. */
|
||||
static int
|
||||
@ -80,8 +77,7 @@ test_two_growing_with_att(const char *testfile)
|
||||
for (r = 0; r < MAX_RECS; r++)
|
||||
{
|
||||
/* Write one record of var data, a single character. */
|
||||
if((status=nc_open(testfile, NC_WRITE, &ncid)))
|
||||
ERR;
|
||||
if((status=nc_open(testfile, NC_WRITE, &ncid))) ERR;
|
||||
count[0] = 1;
|
||||
start[0] = r;
|
||||
sprintf(att_name, "a_%d", data[r]);
|
||||
@ -109,6 +105,7 @@ test_two_growing_with_att(const char *testfile)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Test a diskless file with one var and one att. */
|
||||
static int
|
||||
test_one_with_att(const char *testfile)
|
||||
@ -144,12 +141,11 @@ test_one_with_att(const char *testfile)
|
||||
if((status=nc_close(ncid))) ERR;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
diskless = (argc > 1);
|
||||
|
||||
printf("\n*** Testing diskless file: create/modify %s: %s\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user