- 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:
koennecke
2009-12-04 12:58:31 +00:00
parent 297f9f2e02
commit 8cc5474334
80 changed files with 899 additions and 881 deletions

View File

@ -339,18 +339,18 @@ int FitFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
pCom = FindCommand(pSics, argv[1]);
if (!pCom) {
sprintf(pBueffel, "ERROR: scan command %s not found", argv[1]);
snprintf(pBueffel,sizeof(pBueffel), "ERROR: scan command %s not found", argv[1]);
SCWrite(pCon, pBueffel, eError);
return 0;
}
pDum = (pDummy) pCom->pData;
if (!pDum) {
sprintf(pBueffel, "ERROR: scan command %s not found", argv[1]);
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: scan command %s not found", argv[1]);
SCWrite(pCon, pBueffel, eError);
return 0;
}
if (strcmp(pDum->pDescriptor->name, "ScanObject") != 0) {
sprintf(pBueffel, "ERROR: %s is no scan command", argv[1]);
snprintf(pBueffel,sizeof(pBueffel)-1, "ERROR: %s is no scan command", argv[1]);
SCWrite(pCon, pBueffel, eError);
return 0;
}
@ -366,7 +366,7 @@ int FitFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
iRet = AddCommand(pSics, "peak", FitWrapper, DeleteFitCenter, self);
iRet1 = AddCommand(pSics, "center", CenterWrapper, NULL, self);
if (!iRet || !iRet1) {
sprintf(pBueffel,
snprintf(pBueffel,sizeof(pBueffel)-1,
"ERROR: duplicate commands peak and center not created");
SCWrite(pCon, pBueffel, eError);
DeleteFitCenter((void *) self);
@ -423,7 +423,7 @@ int FitWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
if (argc > 1) {
strtolower(argv[1]);
if (strcmp(argv[1], "value") == 0) {
sprintf(pBueffel, "%f", self->fCenter);
snprintf(pBueffel,sizeof(pBueffel)-1, "%f", self->fCenter);
SCWrite(pCon, pBueffel, eValue);
return 1;
}
@ -437,12 +437,12 @@ int FitWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
/* print results */
SCStartBuffering(pCon);
sprintf(pBueffel, "Estimated Peak Center: %f, StdDev: %f \n",
snprintf(pBueffel,sizeof(pBueffel)-1, "Estimated Peak Center: %f, StdDev: %f \n",
self->fCenter, self->fStddev);
SCWrite(pCon, pBueffel, eValue);
sprintf(pBueffel, "Maximum peak height: %ld\n", self->lPeak);
snprintf(pBueffel,sizeof(pBueffel)-1, "Maximum peak height: %ld\n", self->lPeak);
SCWrite(pCon, pBueffel, eValue);
sprintf(pBueffel, "Approximate FWHM: %f\n", self->FWHM);
snprintf(pBueffel,sizeof(pBueffel)-1, "Approximate FWHM: %f\n", self->FWHM);
SCWrite(pCon, pBueffel, eValue);
buf = SCEndBuffering(pCon);
if (buf != NULL) {