- After a bug at TRICS I replaced all occurrences of strcpy, strcat, sprintf
by length limited versions wherever appropriate. SKIPPED: psi/el755driv.c psi/faverage.c psi/frame.c psi/lmd200.c psi/polterwrite.c psi/psi.c psi/sanswave.c psi/sinqhmdriv.c psi/termprot.c
This commit is contained in:
96
histmem.c
96
histmem.c
@ -191,7 +191,7 @@ static int HistStartCount(void *pData, SConnection * pCon)
|
||||
return iRet;
|
||||
} else {
|
||||
iRet = self->pDriv->GetError(self->pDriv, &iErr, pError, 79);
|
||||
sprintf(pBueffel, "WARNING: %s ", pError);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: %s ", pError);
|
||||
SCWrite(pCon, pBueffel, eLogError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv, iErr);
|
||||
if (iRet == COTERM) {
|
||||
@ -233,7 +233,7 @@ static int HistPause(void *pData, SConnection * pCon)
|
||||
return iRet;
|
||||
} else {
|
||||
iRet = self->pDriv->GetError(self->pDriv, &iErr, pError, 79);
|
||||
sprintf(pBueffel, "WARNING: %s ", pError);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: %s ", pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv, iErr);
|
||||
if (iRet == COTERM) {
|
||||
@ -275,7 +275,7 @@ static int HistContinue(void *pData, SConnection * pCon)
|
||||
return iRet;
|
||||
} else {
|
||||
iRet = self->pDriv->GetError(self->pDriv, &iErr, pError, 79);
|
||||
sprintf(pBueffel, "WARNING: %s ", pError);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: %s ", pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv, iErr);
|
||||
if (iRet == COTERM) {
|
||||
@ -313,7 +313,7 @@ static int HistCountStatus(void *pData, SConnection * pCon)
|
||||
eCt = self->pDriv->GetCountStatus(self->pDriv, pCon);
|
||||
if (eCt == HWFault) {
|
||||
iRet = self->pDriv->GetError(self->pDriv, &iErr, pError, 79);
|
||||
sprintf(pBueffel, "WARNING: %s ", pError);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: %s ", pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv, iErr);
|
||||
if (iRet == COTERM) {
|
||||
@ -370,7 +370,7 @@ static int HistTransfer(void *pData, SConnection * pCon)
|
||||
iStatus = iRet;
|
||||
} else {
|
||||
iRet = self->pDriv->GetError(self->pDriv, &iErr, pError, 79);
|
||||
sprintf(pBueffel, "WARNING: %s ", pError);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "WARNING: %s ", pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv, iErr);
|
||||
if (iRet == COTERM) {
|
||||
@ -514,7 +514,7 @@ int MakeHistMemory(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
/* check no of arguments */
|
||||
if (argc < 3) {
|
||||
sprintf(pBueffel, "ERROR: insufficient no of arguments to %s",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: insufficient no of arguments to %s",
|
||||
argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@ -524,7 +524,7 @@ int MakeHistMemory(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
strtolower(argv[2]);
|
||||
pNew = CreateHistMemory(argv[2]);
|
||||
if (!pNew) {
|
||||
sprintf(pBueffel,
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1,
|
||||
"ERROR: failed to create Histogram Memory %s, driver %s may be invalid or no memory",
|
||||
argv[1], argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
@ -538,7 +538,7 @@ int MakeHistMemory(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
AddCommand(pSics, argv[1], HistAction, DeleteHistMemory,
|
||||
(void *) pNew);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: duplicate command %s not created", argv[1]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: duplicate command %s not created", argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
DeleteHistMemory((void *) pNew);
|
||||
return 0;
|
||||
@ -793,7 +793,7 @@ int SetHistogram(pHistMem self, SConnection * pCon,
|
||||
return 1;
|
||||
} else {
|
||||
iRet = self->pDriv->GetError(self->pDriv, &iErr, pError, 79);
|
||||
sprintf(pBueffel, "ERROR: %s ", pError);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s ", pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv, iErr);
|
||||
if (iRet == COTERM) {
|
||||
@ -849,7 +849,7 @@ int GetHistogramDirect(pHistMem self, SConnection * pCon,
|
||||
break;
|
||||
} else {
|
||||
iRet = self->pDriv->GetError(self->pDriv, &iErr, pError, 79);
|
||||
sprintf(pBueffel, "ERROR: %s ", pError);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s ", pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv, iErr);
|
||||
if (iRet == COTERM) {
|
||||
@ -895,7 +895,7 @@ int PresetHistogram(pHistMem self, SConnection * pCon, HistInt lVal)
|
||||
return 1;
|
||||
} else {
|
||||
iRet = self->pDriv->GetError(self->pDriv, &iErr, pError, 79);
|
||||
sprintf(pBueffel, "ERROR: %s ", pError);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s ", pError);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv, iErr);
|
||||
if (iRet == COTERM) {
|
||||
@ -974,31 +974,31 @@ void HMListOption(pHistMem self, SConnection * pCon)
|
||||
StringDictGet(self->pDriv->pOption, "driver", pValue,
|
||||
sizeof(pValue) - 1);
|
||||
if (0 < iRet) {
|
||||
sprintf(pBuffer, "%s.driver = %s", name, pValue);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "%s.driver = %s", name, pValue);
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
}
|
||||
|
||||
iRet = StringDictGetAsNumber(self->pDriv->pOption, "update", &fVal);
|
||||
if (0 < iRet) {
|
||||
sprintf(pBuffer, "%s.update = %d", name, (int) rint(fVal));
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "%s.update = %d", name, (int) rint(fVal));
|
||||
} else {
|
||||
sprintf(pBuffer, "%s.update = 0 (no buffering)", name);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "%s.update = 0 (no buffering)", name);
|
||||
}
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
|
||||
iRet = StringDictGetAsNumber(self->pDriv->pOption, "rank", &fVal);
|
||||
if (0 < iRet) {
|
||||
iRank = (int) rint(fVal);
|
||||
sprintf(pBuffer, "%s.rank = %d", name, iRank);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "%s.rank = %d", name, iRank);
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
} else {
|
||||
iRank = 0;
|
||||
}
|
||||
for (i = 0; i < iRank; i++) {
|
||||
sprintf(pValue, "dim%1.1d", i);
|
||||
snprintf(pValue,sizeof(pValue)-1, "dim%1.1d", i);
|
||||
iRet = StringDictGetAsNumber(self->pDriv->pOption, pValue, &fVal);
|
||||
if (0 < iRet) {
|
||||
sprintf(pBuffer, "%s.dim%1.1d = %d", name, i, (int) rint(fVal));
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "%s.dim%1.1d = %d", name, i, (int) rint(fVal));
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
}
|
||||
}
|
||||
@ -1027,11 +1027,11 @@ void HMListOption(pHistMem self, SConnection * pCon)
|
||||
}
|
||||
|
||||
/* Display Count Mode */
|
||||
sprintf(pBuffer, "%s.CountMode = %s", name, pMode[self->pDriv->eCount]);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "%s.CountMode = %s", name, pMode[self->pDriv->eCount]);
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
|
||||
/* Display Preset */
|
||||
sprintf(pBuffer, "%s.preset = %f", name, self->pDriv->fCountPreset);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "%s.preset = %f", name, self->pDriv->fCountPreset);
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
|
||||
if (self->pDriv->data->nTimeChan > 2) {
|
||||
@ -1039,7 +1039,7 @@ void HMListOption(pHistMem self, SConnection * pCon)
|
||||
} else {
|
||||
tofMode = 0;
|
||||
}
|
||||
sprintf(pBuffer, "%s.tofMode = %d", name, tofMode);
|
||||
snprintf(pBuffer,sizeof(pBuffer)-1, "%s.tofMode = %d", name, tofMode);
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
buf = SCEndBuffering(pCon);
|
||||
if (buf != NULL) {
|
||||
@ -1116,7 +1116,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
/* check arguments */
|
||||
if (argc < 2) {
|
||||
sprintf(pBueffel, "ERROR: no arguments specified to %s", argv[0]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: no arguments specified to %s", argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1136,7 +1136,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/* enough arguments ? */
|
||||
if (argc < 4) {
|
||||
if (argc < 3) {
|
||||
sprintf(pBueffel, "ERROR: not enough arguments to %s configure",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: not enough arguments to %s configure",
|
||||
argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@ -1145,7 +1145,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
strtolower(argv[2]);
|
||||
iRet = HistGetOption(self, argv[2], NULL, 0);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: option %s not known", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: option %s not known", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1156,7 +1156,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
memset(pBuf, 0, iRet + 60);
|
||||
HistGetOption(self, argv[2], pBuf, iRet + 60);
|
||||
sprintf(pBueffel, "%s.%s = %s", argv[0], argv[2], pBuf);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s.%s = %s", argv[0], argv[2], pBuf);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
free(pBuf);
|
||||
return 1;
|
||||
@ -1166,7 +1166,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
Arg2Text(argc - 3, &argv[3], pBueffel, 511);
|
||||
/* authorise */
|
||||
if (!SCMatchRights(pCon, usMugger)) {
|
||||
sprintf(pBueffel,
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1,
|
||||
"ERROR: you need to be manager in order to configure %s",
|
||||
argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
@ -1175,7 +1175,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
strtolower(argv[2]);
|
||||
iRet = HistSetOption(self, argv[2], pBueffel);
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: option %s not known", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: option %s not known", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1184,7 +1184,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
} else if (strcmp(argv[1], "preset") == 0) { /* preset */
|
||||
if (argc < 3) { /* get value */
|
||||
fVal = GetHistPreset(self);
|
||||
sprintf(pBueffel, "%s.preset = %f", argv[0], fVal);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s.preset = %f", argv[0], fVal);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else { /* set case */
|
||||
@ -1205,7 +1205,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
} else if (strcmp(argv[1], "exponent") == 0) { /* preset */
|
||||
if (argc < 3) { /* get value */
|
||||
sprintf(pBueffel, "%s.exponent = %d", argv[0], self->iExponent);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s.exponent = %d", argv[0], self->iExponent);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else { /* set case */
|
||||
@ -1221,7 +1221,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
} else if (strcmp(argv[1], "countmode") == 0) { /* countmode */
|
||||
if (argc < 3) { /* get value */
|
||||
eCount = GetHistCountMode(self);
|
||||
sprintf(pBueffel, "%s.CountMode = %s", argv[0], pMode[eCount]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s.CountMode = %s", argv[0], pMode[eCount]);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else { /* set case */
|
||||
@ -1240,7 +1240,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
} else if (strcmp(argv[2], "monitor") == 0) {
|
||||
eCount = ePreset;
|
||||
} else {
|
||||
sprintf(pBueffel, "ERROR: %s invalid as CountMode", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s invalid as CountMode", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1336,7 +1336,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
/* enough arguments */
|
||||
if (argc < 3) {
|
||||
sprintf(pBueffel, "ERROR: insufficient number of arguments to %s %s",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: insufficient number of arguments to %s %s",
|
||||
argv[0], argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@ -1355,7 +1355,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
/* enough arguments */
|
||||
if (argc < 3) {
|
||||
sprintf(pBueffel, "ERROR: insufficient number of arguments to %s %s",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: insufficient number of arguments to %s %s",
|
||||
argv[0], argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@ -1370,7 +1370,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
} else if (strcmp(argv[1], "get") == 0) { /* get a histogram */
|
||||
/* check parameters, first required: no of Hist */
|
||||
if (argc < 3) {
|
||||
sprintf(pBueffel, "ERROR: insufficient number of arguments to %s %s",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: insufficient number of arguments to %s %s",
|
||||
argv[0], argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@ -1415,7 +1415,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
lData, iEnd * sizeof(long));
|
||||
}
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: cannot retrieve histogram %d", iNum);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: cannot retrieve histogram %d", iNum);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
free(lData);
|
||||
return 0;
|
||||
@ -1425,7 +1425,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
Tcl_DStringInit(&tResult);
|
||||
Tcl_DStringAppend(&tResult, "Histogram =", -1);
|
||||
for (i = 0; i < iEnd - iStart; i++) {
|
||||
sprintf(pNumber, " %d", lData[i]);
|
||||
snprintf(pNumber,sizeof(pNumber)-1, " %d", lData[i]);
|
||||
Tcl_DStringAppend(&tResult, pNumber, -1);
|
||||
}
|
||||
|
||||
@ -1441,7 +1441,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
else if (strcmp(argv[1], "uuget") == 0) { /* get a histogram */
|
||||
/* check parameters, first required: no of Hist */
|
||||
if (argc < 3) {
|
||||
sprintf(pBueffel, "ERROR: insufficient number of arguments to %s %s",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: insufficient number of arguments to %s %s",
|
||||
argv[0], argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@ -1477,7 +1477,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
iRet = GetHistogram(self, pCon, iNum, iStart, iEnd,
|
||||
&lData[1], iEnd * sizeof(HistInt));
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: cannot retrieve histogram %d", iNum);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: cannot retrieve histogram %d", iNum);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
free(lData);
|
||||
return 0;
|
||||
@ -1499,7 +1499,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
} else if (strcmp(argv[1], "zipget") == 0) { /* get a histogram */
|
||||
/* check parameters, first required: no of Hist */
|
||||
if (argc < 3) {
|
||||
sprintf(pBueffel, "ERROR: insufficient number of arguments to %s %s",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: insufficient number of arguments to %s %s",
|
||||
argv[0], argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
@ -1535,7 +1535,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
iRet = GetHistogram(self, pCon, iNum, iStart, iEnd,
|
||||
&lData[0], iEnd * sizeof(HistInt));
|
||||
if (!iRet) {
|
||||
sprintf(pBueffel, "ERROR: cannot retrieve histogram %d", iNum);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: cannot retrieve histogram %d", iNum);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
free(lData);
|
||||
return 0;
|
||||
@ -1554,7 +1554,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
/* retrive no of Timebins */
|
||||
else if (strcmp(argv[1], "notimebin") == 0) {
|
||||
sprintf(pBueffel,
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1,
|
||||
"%s.notimebin = %d", argv[0],
|
||||
getNoOfTimebins(self->pDriv->data));
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
@ -1565,7 +1565,7 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
Tcl_DStringInit(&tResult);
|
||||
Tcl_DStringAppend(&tResult, "histogram.timebins =", -1);
|
||||
for (i = 0; i < self->pDriv->data->nTimeChan; i++) {
|
||||
sprintf(pBueffel, "%.2f ", self->pDriv->data->timeBinning[i]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%.2f ", self->pDriv->data->timeBinning[i]);
|
||||
Tcl_DStringAppend(&tResult, pBueffel, -1);
|
||||
}
|
||||
/* Write it */
|
||||
@ -1614,19 +1614,19 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
iRet = Tcl_GetDouble(pSics->pTcl, argv[2], &dStart);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: Failed to convert %s to number", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: Failed to convert %s to number", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
iRet = Tcl_GetDouble(pSics->pTcl, argv[3], &dStep);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: Failed to convert %s to number", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: Failed to convert %s to number", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
iRet = Tcl_GetInt(pSics->pTcl, argv[4], &iNum);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: Failed to convert %s to number", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: Failed to convert %s to number", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1662,13 +1662,13 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
iRet = Tcl_GetInt(pSics->pTcl, argv[2], &iNum);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: Failed to convert %s to number", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: Failed to convert %s to number", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
iRet = Tcl_GetDouble(pSics->pTcl, argv[3], &dStep);
|
||||
if (iRet != TCL_OK) {
|
||||
sprintf(pBueffel, "ERROR: Failed to convert %s to number", argv[2]);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: Failed to convert %s to number", argv[2]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
@ -1718,11 +1718,11 @@ int HistAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
}
|
||||
}
|
||||
lVal = HistSum(self, pCon, iaStart, iaEnd);
|
||||
sprintf(pBueffel, "%s.sum = %ld", argv[0], lVal);
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "%s.sum = %ld", argv[0], lVal);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else {
|
||||
sprintf(pBueffel, "ERROR: %s does not understand command %s",
|
||||
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s does not understand command %s",
|
||||
argv[0], argv[1]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user