Commit fb2583b1 authored by Jeremy Cohen's avatar Jeremy Cohen

Fix for ccmio compile warning on recent GCC versions

parent 494a66a5
Pipeline #1976 passed with stages
in 132 minutes and 2 seconds
......@@ -36,17 +36,55 @@
}
ADF_Read_All_Data(origNode.node, bytes, &adfErr);
--- libccmio/ccmio.c 2019-10-01 10:52:27.872670035 +0100
+++ libccmio/ccmio.c 2019-10-01 10:52:54.900797471 +0100
@@ -520,9 +520,9 @@
type == kCCMIORestartData || type == kCCMIOReferenceData ||
type == kCCMIOModelConstants)
--- libccmio/ccmio.c 2006-06-30 19:00:17.000000000 +0100
+++ libccmio/ccmio.c 2020-05-27 15:58:48.000000000 +0100
@@ -469,8 +469,10 @@
if (type == kCCMIOField)
node = id.node;
#if kHasSNPrintf
- snprintf(name, kCCMIOMaxStringLength, "%ss",
+ int ret = snprintf(name, kCCMIOMaxStringLength, "%ss",
gEntityNames[(int)type]);
+ if (ret < 0)
+ abort();
#else
sprintf(name, "%ss", gEntityNames[(int)type]);
#endif
@@ -515,23 +517,32 @@
void MakeEntityName( CCMIOEntity type, int id, char *name )
{
+ int ret = 0;
if (type == kCCMIOInternalFaces || type == kCCMIOCells ||
- type == kCCMIOInterfaces || type == kCCMIORestart ||
- type == kCCMIORestartData || type == kCCMIOReferenceData ||
- type == kCCMIOModelConstants)
+ type == kCCMIOInterfaces || type == kCCMIORestart ||
+ type == kCCMIORestartData || type == kCCMIOReferenceData ||
+ type == kCCMIOModelConstants)
+ {
#if kHasSNPrintf
- snprintf(name, kCCMIOMaxStringLength, gEntityNames[(int)type]);
+ snprintf(name, kCCMIOMaxStringLength, "%s", gEntityNames[(int)type]);
+ ret = snprintf(name, kCCMIOMaxStringLength, gEntityNames[(int)type]);
+ if (ret < 0)
+ abort();
#else
- sprintf(name, gEntityNames[(int)type]);
+ sprintf(name, "%s", gEntityNames[(int)type]);
sprintf(name, gEntityNames[(int)type]);
#endif
+ }
else
+ {
#if kHasSNPrintf
- snprintf(name, kCCMIOMaxStringLength, "%s%c%d",
+ ret = snprintf(name, kCCMIOMaxStringLength, "%s%c%d",
gEntityNames[(int)type], kEntityIDDelimiter, id);
+ if (ret < 0)
+ abort();
#else
sprintf(name, "%s%c%d",
gEntityNames[(int)type], kEntityIDDelimiter, id);
#endif
+ }
name[kCCMIOMaxStringLength] = '\0';
}
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