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

add nfiles

parent 986f1012
......@@ -921,6 +921,7 @@ if ( streamID < 0 ) handle_error(streamID);
*/
int streamOpenRead(const char *filenames)
{
static char func[] = "streamOpenRead";
int filetype, byteorder;
int streamID;
int num_fnames;
......@@ -949,6 +950,15 @@ int streamOpenRead(const char *filenames)
{
streamptr = stream_to_pointer(streamID);
streamptr->byteorder = byteorder;
if ( num_fnames > 0 )
{
int i;
streamptr->nfiles = num_fnames;
streamptr->fnames = (char **) malloc(num_fnames*sizeof(char *));
for ( i = 0; i < num_fnames; ++i )
streamptr->fnames[i] = fnames[i];
}
}
return (streamID);
......@@ -1125,7 +1135,7 @@ void streamClose(int streamID)
}
free(streamptr->vars);
for ( index = 0; index < streamptr->ntsteps; index++ )
for ( index = 0; index < streamptr->ntsteps; ++index )
{
if ( streamptr->tsteps[index].records )
free(streamptr->tsteps[index].records);
......@@ -1135,6 +1145,14 @@ void streamClose(int streamID)
if ( streamptr->tsteps ) free(streamptr->tsteps);
if ( streamptr->nfiles > 0 )
{
for ( index = 0; index < streamptr->nfiles; ++index )
free(streamptr->fnames[index]);
free(streamptr->fnames);
}
stream_delete_entry(streamptr);
if ( vlistID != -1 )
......
......@@ -319,6 +319,10 @@ static void stream_init_entry(STREAM *streamptr)
for ( i = 0; i < MAX_GRIDS_PS; i++ ) streamptr->ncxvarID[i] = UNDEFID;
for ( i = 0; i < MAX_GRIDS_PS; i++ ) streamptr->ncyvarID[i] = UNDEFID;
for ( i = 0; i < MAX_GRIDS_PS; i++ ) streamptr->ncavarID[i] = UNDEFID;
streamptr->curfile = 0;
streamptr->nfiles = 0;
streamptr->fnames = NULL;
}
......
......@@ -215,6 +215,9 @@ typedef struct {
int unreduced;
int compressType;
int compressLevel;
int curfile;
int nfiles;
char **fnames;
}
STREAM;
......
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