Commit d7ec10f3 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added call to cdiInitialize() in all streamOpen functions (bug fix)

parent e0e5be73
......@@ -5,6 +5,7 @@
2012-07-13 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added call to cdiInitialize() in all streamOpen functions (bug fix)
* added support for environment variable NC_CHUNKSIZEHINT [Feature #2142]
2012-07-04 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
......@@ -67,13 +67,11 @@ void cdf_create(const char *path, int cmode, int *ncidp)
if ( CDF_Debug || status != NC_NOERR )
Message("chunksizehint %d", chunksizehint);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
status = nc_set_fill(*ncidp, NC_NOFILL, &oldfill);
if ( status != NC_NOERR )
Error("%s", nc_strerror(status));
if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
}
......@@ -102,17 +100,17 @@ int cdf_open(const char *path, int omode, int *ncidp)
/*
if ( chunksizehint < ChunkSizeMin ) chunksizehint = ChunkSizeMin;
*/
if ( cdiNcChunksizehint != CDI_UNDEFID ) chunksizehint = cdiNcChunksizehint;
status = nc__open(path, omode, &chunksizehint, ncidp);
if ( CDF_Debug )
Message("chunksizehint %d", chunksizehint);
if ( CDF_Debug ) Message("chunksizehint %d", chunksizehint);
}
if ( CDF_Debug )
Message("ncid = %d mode = %d file = %s", *ncidp, omode, path);
if ( CDF_Debug && status != NC_NOERR )
Message("%s", nc_strerror(status));
if ( CDF_Debug && status != NC_NOERR ) Message("%s", nc_strerror(status));
return (status);
}
......
......@@ -298,8 +298,7 @@ int get_fnames(const char *argument, char *fnames[], int max_fnames)
strcat(command, pch);
pfp = popen(command, "r");
if ( pfp == NULL )
SysError("popen %s failed", command);
if ( pfp == NULL ) SysError("popen %s failed", command);
nfiles = 0;
while ( _readline_(pfp, line, MAX_LINE) )
......@@ -973,6 +972,8 @@ int streamOpenRead(const char *filenames)
const char *filename;
stream_t *streamptr = NULL;
cdiInitialize();
//num_fnames = get_fnames(filenames, fnames, MAX_FNAMES);
if ( num_fnames == 0 )
......@@ -1015,6 +1016,8 @@ int streamOpenAppend(const char *filename)
int streamID;
stream_t *streamptr;
cdiInitialize();
filetype = getFiletype(filename, &byteorder);
if ( filetype < 0 ) return (filetype);
......@@ -1073,6 +1076,8 @@ if ( streamID < 0 ) handle_error(streamID);
*/
int streamOpenWrite(const char *filename, int filetype)
{
cdiInitialize();
return (streamOpen(filename, "w", filetype));
}
......
......@@ -191,7 +191,9 @@ void cdiInitialize(void)
if ( CDI_Debug )
Message("Default calendar set to %s!", envString);
}
#if defined (HAVE_LIBCGRIBEX)
gribSetCalendar(cdiDefaultCalendar);
#endif
envString = getenv("PARTAB_INTERN");
if ( envString ) cdiPartabIntern = atoi(envString);
......@@ -581,7 +583,6 @@ void cdiCheckContents(int streamID)
if ( zaxisInqType(zaxisID) == ZAXIS_GENERIC )
cdiCheckZaxis(zaxisID);
}
}
......
......@@ -311,6 +311,7 @@ int streamInqDimgroupID(int streamID);
int getByteswap(int byteorder);
void cdiInitialize(void);
void stream_write_record(int streamID, int memtype, const void *data, int nmiss);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment