Skip to content
Snippets Groups Projects
Commit cafd4e6a authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Return constant file suffix string pointers.

parent ea5bb1f1
No related branches found
No related tags found
No related merge requests found
......@@ -320,7 +320,7 @@ int streamInqTimestep(int streamID, int tsID);
int streamInqCurTimestepID(int streamID);
char *streamFilename(int streamID);
char *streamFilesuffix(int filetype);
const char *streamFilesuffix(int filetype);
off_t streamNvals(int streamID);
int streamInqNvars ( int streamID );
......
......@@ -308,11 +308,14 @@ int streamInqByteorder(int streamID)
}
char *streamFilesuffix(int filetype)
const char *streamFilesuffix(int filetype)
{
// static char *fileSuffix[] = {"", ".grb", ".g2", ".nc", ".nc", ".nc4", ".nc4", ".srv", ".ext", ".ieg"};
static char *fileSuffix[] = {"", ".grb", ".grb", ".nc", ".nc", ".nc", ".nc", ".srv", ".ext", ".ieg"};
int size = (int) (sizeof(fileSuffix)/sizeof(char *));
/* note: the 2nd dimenstion of the fileSuffix array must be equal to or
* larger than the length of the longest suffix (dot and \0 terminator
* included) */
static const char fileSuffix[][5] = {"", ".grb", ".grb", ".nc", ".nc", ".nc", ".nc", ".srv", ".ext", ".ieg"};
int size = (int)(sizeof(fileSuffix)/sizeof(fileSuffix[0]));
if ( filetype > 0 && filetype < size )
return (fileSuffix[filetype]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment