Commit 9b0114f2 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

check pointer arguments of streamRead/streamWrite

parent f5ea1c22
......@@ -1468,10 +1468,12 @@ void streamReadVar(int streamID, int varID, double *data, int *nmiss)
int filetype;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
if ( CDI_Debug ) Message("streamID = %d varID = %d", streamID, varID);
if ( CDI_Debug )
Message("streamID = %d varID = %d", streamID, varID);
check_parg(data);
check_parg(nmiss);
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
......@@ -1549,10 +1551,11 @@ void streamWriteVar(int streamID, int varID, const double *data, int nmiss)
int filetype;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
if ( CDI_Debug ) Message("streamID = %d varID = %d", streamID, varID);
if ( CDI_Debug )
Message("streamID = %d varID = %d", streamID, varID);
check_parg(data);
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
......@@ -1634,6 +1637,11 @@ void streamReadVarSlice(int streamID, int varID, int levelID, double *data, int
int ierr = 0;
stream_t *streamptr;
if ( CDI_Debug ) Message("streamID = %d varID = %d", streamID, varID);
check_parg(data);
check_parg(nmiss);
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
......@@ -1714,10 +1722,11 @@ void streamWriteVarSlice(int streamID, int varID, int levelID, const double *dat
int ierr = 0;
stream_t *streamptr;
streamptr = stream_to_pointer(streamID);
if ( CDI_Debug ) Message("streamID = %d varID = %d", streamID, varID);
if ( CDI_Debug )
Message("streamID = %d varID = %d", streamID, varID);
check_parg(data);
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
......
......@@ -58,6 +58,8 @@ char *strdup(const char *s);
#endif
#define check_parg(arg) if ( arg == 0 ) Warning("Argument '" #arg "' not allocated!")
#if defined (__xlC__) /* performance problems on IBM */
#ifndef DBL_IS_NAN
# define DBL_IS_NAN(x) ((x) != (x))
......
......@@ -131,6 +131,9 @@ void streamInqRecord(int streamID, int *varID, int *levelID)
int lindex;
stream_t *streamptr;
check_parg(varID);
check_parg(levelID);
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
......@@ -296,6 +299,9 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
int filetype;
stream_t *streamptr;
check_parg(data);
check_parg(nmiss);
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
......@@ -360,6 +366,8 @@ void streamWriteRecord(int streamID, const double *data, int nmiss)
int filetype;
stream_t *streamptr;
check_parg(data);
streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
......
Supports Markdown
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