Commit 7bf3024d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

streamFilesuffix(): refactoring (bug fix).

parent 53535591
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
* Version 1.9.3 released * Version 1.9.3 released
2018-01-13 Uwe Schulzweida
* streamFilesuffix(): refactoring (bug fix)
2018-01-09 Uwe Schulzweida 2018-01-09 Uwe Schulzweida
* GRIBAPI: Added support for variables with same name and different gridsize. * GRIBAPI: Added support for variables with same name and different gridsize.
......
...@@ -303,17 +303,27 @@ int streamInqByteorder(int streamID) ...@@ -303,17 +303,27 @@ int streamInqByteorder(int streamID)
const char *streamFilesuffix(int filetype) const char *streamFilesuffix(int filetype)
{ {
// static char *fileSuffix[] = {"", ".grb", ".g2", ".nc", ".nc", ".nc4", ".nc4", ".srv", ".ext", ".ieg"}; static const char *noSuffix = "";
/* note: the 2nd dimenstion of the fileSuffix array must be equal to or static const char *ncSuffix = ".nc";
* larger than the length of the longest suffix (dot and \0 terminator static const char *grbSuffix = ".grb";
* included) */ static const char *srvSuffix = ".srv";
static const char fileSuffix[][5] = {"", ".grb", ".grb", ".nc", ".nc", ".nc", ".nc", ".srv", ".ext", ".ieg"}; static const char *extSuffix = ".ext";
int size = (int)(sizeof(fileSuffix)/sizeof(fileSuffix[0])); static const char *iegSuffix = ".ieg";
if ( filetype > 0 && filetype < size ) switch (filetype)
return fileSuffix[filetype]; {
else case CDI_FILETYPE_NC:
return fileSuffix[0]; case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5: return ncSuffix;
case CDI_FILETYPE_GRB:
case CDI_FILETYPE_GRB2: return grbSuffix;
case CDI_FILETYPE_SRV: return srvSuffix;
case CDI_FILETYPE_EXT: return extSuffix;
case CDI_FILETYPE_IEG: return iegSuffix;
default: return noSuffix;
}
} }
......
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