Commit 13a2407a authored by Uwe Schulzweida's avatar Uwe Schulzweida

removed CDI functions streamInqHistorySize(), streamInqHistoryString() and streamDefHistory().

parent a3e0c913
......@@ -2,6 +2,7 @@
* Added function cdiInqAttLen()
* NetCDF: treats global history attribute as a normal attribute
* removed CDI functions streamInqHistorySize(), streamInqHistoryString() and streamDefHistory()
2020-02-20 Uwe Schulzweida
......
......@@ -1221,12 +1221,6 @@ int tableInqModel(int tableID);
void tableInqEntry(int tableID, int id, int ltype, char *name, char *longname, char *units);
// History routines
void streamDefHistory(int streamID, int size, const char *history);
int streamInqHistorySize(int streamID);
void streamInqHistoryString(int streamID, char *history);
// Subtype routines
// subtypeCreate: Create a variable subtype
......
......@@ -282,7 +282,6 @@ typedef struct {
int nczvarID[MAX_ZAXES_PS];
VCT vct;
#endif
int historyID;
int globalatts;
int localatts;
int unreduced;
......
......@@ -886,7 +886,6 @@ void streamDefaultValue ( stream_t * streamptr )
streamptr->tsteps = NULL;
streamptr->tstepsTableSize = 0;
streamptr->tstepsNextID = 0;
streamptr->historyID = CDI_UNDEFID;
streamptr->vlistID = CDI_UNDEFID;
streamptr->globalatts = 0;
streamptr->localatts = 0;
......@@ -1764,9 +1763,9 @@ void streamDestroyP ( void * streamptr )
}
void streamPrintP ( void * streamptr, FILE * fp )
void streamPrintP(void *streamptr, FILE *fp)
{
stream_t * sp = ( stream_t * ) streamptr;
stream_t *sp = (stream_t *) streamptr;
if ( !sp ) return;
......@@ -1791,7 +1790,6 @@ void streamPrintP ( void * streamptr, FILE * fp )
"tstepsNextID = %d\n"
"ncmode = %d\n"
"vlistID = %d\n"
"historyID = %d\n"
"globalatts = %d\n"
"localatts = %d\n"
"unreduced = %d\n"
......@@ -1803,7 +1801,7 @@ void streamPrintP ( void * streamptr, FILE * fp )
sp->filetype, sp->byteorder, sp->fileID, sp->filemode,
sp->filename, sp->nrecs, sp->nvars, sp->varsAllocated,
sp->curTsID, sp->rtsteps, sp->ntsteps, sp->tstepsTableSize,
sp->tstepsNextID, sp->ncmode, sp->vlistID, sp->historyID,
sp->tstepsNextID, sp->ncmode, sp->vlistID,
sp->globalatts, sp->localatts, sp->unreduced, sp->sortname,
sp->have_missval, sp->comptype, sp->complevel);
}
......
......@@ -7,9 +7,6 @@ void cdfDefCoordinateVars(stream_t *streamptr);
void cdfDefTimestep(stream_t *streamptr, int tsID);
int cdfInqTimestep(stream_t *streamptr, int tsID);
int cdfInqContents(stream_t *streamptr);
void cdfDefHistory(stream_t *streamptr, int size, const char *history);
int cdfInqHistorySize(stream_t *streamptr);
void cdfInqHistoryString(stream_t *streamptr, char *history);
void cdfEndDef(stream_t * streamptr);
void cdfDefRecord(stream_t * streamptr);
......
......@@ -4328,40 +4328,6 @@ int cdfInqTimestep(stream_t * streamptr, int tsID)
return (int) nrecs;
}
int cdfInqHistorySize(stream_t *streamptr)
{
size_t size = 0;
int ncid = streamptr->fileID;
if ( streamptr->historyID != CDI_UNDEFID )
cdf_inq_attlen(ncid, NC_GLOBAL, "history", &size);
return (int) size;
}
void cdfInqHistoryString(stream_t *streamptr, char *history)
{
int ncid = streamptr->fileID;
if ( streamptr->historyID != CDI_UNDEFID )
{
nc_type atttype;
cdf_inq_atttype(ncid, NC_GLOBAL, "history", &atttype);
if ( atttype == NC_CHAR )
{
cdf_get_att_text(ncid, NC_GLOBAL, "history", history);
}
#ifdef HAVE_NETCDF4
else if ( atttype == NC_STRING )
{
// ToDo
Warning("History attribute with type NC_STRING unsupported!");
}
#endif
}
}
#endif
/*
* Local Variables:
......
......@@ -1978,13 +1978,6 @@ void cdfDefGrid(stream_t *streamptr, int gridID, int gridindex)
}
void cdfDefHistory(stream_t *streamptr, int size, const char *history)
{
const int ncid = streamptr->fileID;
cdf_put_att_text(ncid, NC_GLOBAL, "history", (size_t) size, history);
}
void cdfDefCoordinateVars(stream_t *streamptr)
{
const int vlistID = streamptr->vlistID;
......
......@@ -19,64 +19,6 @@ filetypeIsNetCDF(int filetype)
}
#endif
void streamDefHistory(int streamID, int length, const char *history)
{
#ifdef HAVE_LIBNETCDF
stream_t *streamptr = stream_to_pointer(streamID);
if ( filetypeIsNetCDF(streamptr->filetype) )
{
char *histstring;
size_t len;
if ( history )
{
len = strlen(history);
if ( len )
{
/* FIXME: what's the point of strdupx? Why not use
* history argument directly? */
histstring = strdupx(history);
cdfDefHistory(streamptr, length, histstring);
Free(histstring);
}
}
}
#else
(void)streamID; (void)length; (void)history;
#endif
}
int streamInqHistorySize(int streamID)
{
int size = 0;
#ifdef HAVE_LIBNETCDF
stream_t *streamptr = stream_to_pointer(streamID);
if ( filetypeIsNetCDF(streamptr->filetype) )
{
size = cdfInqHistorySize(streamptr);
}
#else
(void)streamID;
#endif
return (size);
}
void streamInqHistoryString(int streamID, char *history)
{
#ifdef HAVE_LIBNETCDF
stream_t *streamptr = stream_to_pointer(streamID);
if ( filetypeIsNetCDF(streamptr->filetype) )
{
cdfInqHistoryString(streamptr, history);
}
#else
(void)streamID; (void)history;
#endif
}
/*
* Local Variables:
* c-file-style: "Java"
......
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