diff --git a/confvirtualmot.c b/confvirtualmot.c index 59e1aeae..ad6b8aa2 100644 --- a/confvirtualmot.c +++ b/confvirtualmot.c @@ -71,7 +71,7 @@ static char *invokeMotorScript(pConfigurableVirtualMotor self, self->parseOK = 0; return NULL; } - return Tcl_GetStringResult(pTcl); + return (char *)Tcl_GetStringResult(pTcl); } diff --git a/conman.c b/conman.c index 110b90b0..bdd07942 100644 --- a/conman.c +++ b/conman.c @@ -877,6 +877,7 @@ static void writeToLogFiles(SConnection *self, char *buffer) return 0; } self->write = SCFileWrite; + return 0; } /*------------------------------------------------------------------------*/ int SCWriteUUencoded(SConnection *pCon, char *pName, void *pData, diff --git a/devexec.c b/devexec.c index a7500d6c..876aa585 100644 --- a/devexec.c +++ b/devexec.c @@ -885,7 +885,7 @@ SCWrite(pCon,"All done",eStatus); iRet = 1; } - else if(iRet = DEVERROR) + else if(iRet == DEVERROR) { SCWrite(pCon,"Finished with Problems",eStatus); iRet = 1; diff --git a/diffscan.c b/diffscan.c index 91d5b809..604cbf65 100644 --- a/diffscan.c +++ b/diffscan.c @@ -325,7 +325,7 @@ static int DiffScanTask(void *pData){ /* print progress */ - snprintf(pBueffel,255,"%5d %12.4f %12.4f RAW: %10d %10d", + snprintf(pBueffel,255,"%5d %12.4f %12.4f RAW: %10ld %10ld", self->scanObject->iCounts -1, fPos, countValue, rawCount, rawMon); diff --git a/drive.c b/drive.c index 37739af5..dd04e9e6 100644 --- a/drive.c +++ b/drive.c @@ -377,7 +377,7 @@ } else if(iRet == DEVINT) { - sprintf(pBueffel,"Driving Interrupted!",argv[0]); + sprintf(pBueffel,"Driving Interrupted!"); SCWrite(pCon,pBueffel,eError); ClearExecutor(GetExecutor()); SetStatus(eOld); @@ -456,14 +456,14 @@ iRet = AddCommand(pSics,"drive", DriveWrapper,NULL,NULL); if(!iRet) { - sprintf(pBueffel,"ERROR: duplicate command drive not created",argv[2]); + sprintf(pBueffel,"ERROR: duplicate command drive not created"); SCWrite(pCon,pBueffel,eError); return 0; } iRet = AddCommand(pSics,"run", RunWrapper,NULL,NULL); if(!iRet) { - sprintf(pBueffel,"ERROR: duplicate command run not created",argv[2]); + sprintf(pBueffel,"ERROR: duplicate command run not created"); SCWrite(pCon,pBueffel,eError); return 0; } diff --git a/evcontroller.c b/evcontroller.c index 16bfabfb..1da38864 100644 --- a/evcontroller.c +++ b/evcontroller.c @@ -1420,6 +1420,7 @@ int RemoveEVController(SConnection *pCon, char *name) { SCWrite(pCon,pBueffel,eError); return 0; } + return 1; } /*------------------------------------------------------------------------- EVControlFactory implements a SICS command which creates and deletes diff --git a/exeman.c b/exeman.c index d0969818..c29443a2 100644 --- a/exeman.c +++ b/exeman.c @@ -540,6 +540,7 @@ static int infoHandler(pExeMan self, SConnection *pCon, return 1; } } + return 1; /* statement inserted, guessed return value M.Z. */ } else { strtolower(argv[2]); if(strcmp(argv[2],"stack") == 0){ @@ -553,6 +554,7 @@ static int infoHandler(pExeMan self, SConnection *pCon, return 1; } else { SCWrite(pCon,"ERROR: subcommand to info unknown",eError); + return 0; /* statement inserted, guessed return value M.Z. */ } } } diff --git a/fitcenter.c b/fitcenter.c index 555403ba..ceb37452 100644 --- a/fitcenter.c +++ b/fitcenter.c @@ -407,7 +407,7 @@ if(!iRet || !iRet1) { sprintf(pBueffel, - "ERROR: duplicate commands peak and center not created",argv[2]); + "ERROR: duplicate commands peak and center not created"); SCWrite(pCon,pBueffel,eError); DeleteFitCenter((void *)self); return 0; diff --git a/fourlib.c b/fourlib.c index da99e2a5..69421c67 100644 --- a/fourlib.c +++ b/fourlib.c @@ -447,7 +447,7 @@ double sign(double a, double b){ if(b >= .0){ return ABS(a); } else { - -ABS(a); + return -ABS(a); } } /*----------------------------------------------------------------------*/ diff --git a/help.c b/help.c index 6db7c9c9..82a5bdb5 100644 --- a/help.c +++ b/help.c @@ -145,4 +145,5 @@ int SicsHelp(SConnection *pCon,SicsInterp *pSics, void *pData, } printHelpFile(pCon,fd); fclose(fd); + return 1; } diff --git a/histmem.c b/histmem.c index 5f1a2362..250c5b47 100644 --- a/histmem.c +++ b/histmem.c @@ -1559,6 +1559,7 @@ static int checkHMEnd(pHistMem self, char *text){ { clearTimeBinning(self->pDriv->data); SCSendOK(pCon); + return 1; } /*-------- sum */ else if(strcmp(argv[1],"sum") == 0) diff --git a/hmdata.c b/hmdata.c index 2e4e2f77..c55117d5 100644 --- a/hmdata.c +++ b/hmdata.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "fortify.h" #include "hmdata.h" #include "HistMem.h" diff --git a/lomax.c b/lomax.c index 1c73458b..57721a6a 100644 --- a/lomax.c +++ b/lomax.c @@ -24,6 +24,8 @@ #define COGWINDOW 3 #define COGCONTOUR 4 +extern float nintf(float f); + /*-------------------------------------------------------------------*/ static int testBoundaries(int xsize, int ysize, int window, int i, int j) diff --git a/makefile_slinux b/makefile_slinux index 86e230c9..0c8d93ed 100644 --- a/makefile_slinux +++ b/makefile_slinux @@ -21,7 +21,8 @@ include $(SRC)sllinux_def CC = gcc CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) \ -I$(SRC)psi/hardsup -I$(SRC). \ - -fwritable-strings -DCYGNUS -DNONINTF -g $(DFORTIFY) + -fwritable-strings -DCYGNUS -DNONINTF -g $(DFORTIFY) \ + -Wall -Wno-unused -Wno-comment -Wno-switch BINTARGET = bin EXTRA=nintf.o diff --git a/maximize.c b/maximize.c index 6b1c6e7b..4857e45f 100644 --- a/maximize.c +++ b/maximize.c @@ -331,7 +331,7 @@ return 0; } #ifdef DEBUG - sprintf(pBueffel,"iBot = %d, iTop = %d, lMax = %d", + sprintf(pBueffel,"iBot = %d, iTop = %d, lMax = %ld", iBot, iTop, lMax); SCWrite(pCon,pBueffel,eWarning); #endif diff --git a/mesure.c b/mesure.c index f36e4d8f..493431af 100644 --- a/mesure.c +++ b/mesure.c @@ -32,6 +32,7 @@ #include "lld.h" extern void SNXFormatTime(char *pBueffel, int iLen); + extern float nintf(float f); #define ANGERR 0.2 /* @@ -854,7 +855,7 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon) /* write it */ if(self->fRefl) { - fprintf(self->fRefl,"%4d%8.3f%8.3f%8.3f%8.2f%8.2f%8.2f%8.2f%8.0f%8.2f\n", + fprintf(self->fRefl,"%4d %7.3f %7.3f %7.3f %7.2f %7.2f %7.2f %7.2f %7.0f %7.2f\n", self->iCount, fHKL[0],fHKL[1],fHKL[2], self->fPosition[0], self->fPosition[1], self->fPosition[2],self->fPosition[3], @@ -862,13 +863,13 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon) } if(self->fHKL) { - fprintf(self->fHKL,"%5d%7.2f%7.2f%7.2f%8.2f%8.2f%8.2f%8.2f%8.0f%8.2f\n", + fprintf(self->fHKL,"%5d %6.2f %6.2f %6.2f %7.2f %7.2f %7.2f %7.2f %7.0f %7.2f\n", self->iCount, fHKL[0],fHKL[1],fHKL[2], self->fPosition[0], self->fPosition[1], self->fPosition[2],self->fPosition[3], fSum,fSigma); } - sprintf(pBueffel,"%5d%7.2f%7.2f%7.2f%8.2f%8.2f%8.2f%8.2f%8.0f%8.2f\n", + sprintf(pBueffel,"%5d %6.2f %6.2f %6.2f %7.2f %7.2f %7.2f %7.2f %7.0f %7.2f\n", self->iCount, fHKL[0],fHKL[1],fHKL[2], self->fPosition[0], self->fPosition[1], self->fPosition[2],self->fPosition[3], @@ -892,13 +893,13 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon) GetScanVarStep(self->pScanner,0,&fStep); iNP = GetScanNP(self->pScanner); fPreset = GetScanPreset(self->pScanner); - fprintf(self->fRefl,"%3d%8.3f%10.0f%8.3f %s\n",iNP,fStep, + fprintf(self->fRefl,"%3d %7.3f %9.0f %7.3f %s\n",iNP,fStep, fPreset,fTemp,pBueffel); for(i = 0; i < iNP; i++) { for(ii = 0; ii < 10 && i < iNP; ii++) { - fprintf(self->fRefl,"%8d",self->lCounts[i]); + fprintf(self->fRefl," %7ld",self->lCounts[i]); iLF = 1; i++; } @@ -925,7 +926,7 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon) { for(ii = 0; ii < 10 && i < iNP; ii++) { - sprintf(pNum,"%7d",self->lCounts[i]); + sprintf(pNum," %6ld",self->lCounts[i]); strcat(pBueffel,pNum); iLF = 1; i++; @@ -1375,6 +1376,7 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon) else if(strcmp(argv[1],"list") == 0) { ListMesure(self,argv[0],pCon); + return 1; } /*------ file */ else if(strcmp(argv[1],"file") == 0) diff --git a/motreg.c b/motreg.c index f47bc4ed..5cef0767 100644 --- a/motreg.c +++ b/motreg.c @@ -128,6 +128,7 @@ int CheckRegMot(pMotReg self, SConnection *pCon){ if(stat != HWBusy){ self->iActive = 0; } + return stat; } else { return HWIdle; } diff --git a/mumo.c b/mumo.c index f5d9cb93..3311b032 100644 --- a/mumo.c +++ b/mumo.c @@ -451,7 +451,8 @@ static int SaveMumo(void *pData, char *name, FILE *fd) { SCWrite(pCon,"ERROR: Incomplete command",eError); return 0; - } + } + return 1; /* inserted return statement, guessed return value M.Z.*/ } /*-------------------------------------------------------------------------- @@ -618,6 +619,7 @@ static int SaveMumo(void *pData, char *name, FILE *fd) return 0; } } + return 1; /* inserted return statement, guessed return value M.Z */ } /*-------------------------------------------------------------------------*/ static int CheckPermission(SConnection *pCon, pMulMot self) diff --git a/network.c b/network.c index 310019ec..b6bfb62b 100644 --- a/network.c +++ b/network.c @@ -378,7 +378,7 @@ CreateSocketAdress( iRet = send(self->sockid,buffer,lLen,0); if(iRet != lLen) { - printf("Incomplete send: %d to %d\n",iRet,lLen); + printf("Incomplete send: %d to %ld\n",iRet,lLen); if(iRet < 0) { printf("System error: %s\n",strerror(errno)); diff --git a/nigpib.c b/nigpib.c index 35f46e68..32384f13 100644 --- a/nigpib.c +++ b/nigpib.c @@ -65,8 +65,9 @@ static int NIread(int devID, void *buffer, int bytesToRead){ } } /*--------------------------------------------------------------------*/ -static void NIclear(int devID){ +static int NIclear(int devID){ ibclr(devID); + return 1; } /*-----------------------------------------------------------------*/ static void NIerror(int code, char *buffer, int maxBuffer){ diff --git a/nread.c b/nread.c index d9491924..c6e17795 100644 --- a/nread.c +++ b/nread.c @@ -40,7 +40,7 @@ #include "commandlog.h" extern pServer pServ; -extern VerifyChannel(mkChannel *self); /* defined in network.c */ +extern int VerifyChannel(mkChannel *self); /* defined in network.c */ #define NRMAGIC 1061996 /* #define TELNETDEBUG 1 diff --git a/nxscript.c b/nxscript.c index 4b104a11..cbc75442 100644 --- a/nxscript.c +++ b/nxscript.c @@ -29,6 +29,11 @@ #include "udpquieck.h" #include "nxdict.h" #include "nxscript.h" + +extern char *trim(char *str); + +/* missing in nxdict.h: */ +NXstatus NXDdefget(NXdict handle, char *pKey, char *pBuffer, int iBufLen); /*------------------------------------------------------------------------*/ char *makeFilename(SicsInterp *pSics, SConnection *pCon) { pSicsVariable pPath = NULL, pPref = NULL, pEnd = NULL; @@ -659,7 +664,7 @@ static void putArray(SConnection *pCon, SicsInterp *pSics, get array length */ status = Tcl_GetInt(tcl,argv[4],&length); - if(status = TCL_OK){ + if(status == TCL_OK){ sprintf(buffer,"ERROR: failed to convert %s to integer",argv[4]); SCWrite(pCon,buffer,eError); return; @@ -682,10 +687,10 @@ static void putArray(SConnection *pCon, SicsInterp *pSics, */ for(i = 0; i < length; i++){ sprintf(num,"%d",i); - varData = Tcl_GetVar2(tcl,argv[3],num,0); + varData = (char *)Tcl_GetVar2(tcl,argv[3],num,0); if(varData != NULL){ status = Tcl_GetDouble(tcl,varData,&dVal); - if(status = TCL_OK){ + if(status == TCL_OK){ sprintf(buffer,"ERROR: failed to convert %s to double", varData); SCWrite(pCon,buffer,eError); diff --git a/nxupdate.c b/nxupdate.c index fbaf427e..b9478de0 100644 --- a/nxupdate.c +++ b/nxupdate.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "fortify.h" #include "sics.h" #include "splitter.h" diff --git a/o2t.c b/o2t.c index 16ac975d..4e166d6e 100644 --- a/o2t.c +++ b/o2t.c @@ -143,7 +143,8 @@ { iRet = pDrivInt->SetValue(self->pTheta,pCon, fVal); return iRet; - } + } + return 0; /* inserted statement, guessed return value M.Z. */ } /*-------------------------------------------------------------------------*/ static int O2TCheckStatus(void *pData, SConnection *pCon) diff --git a/scan.c b/scan.c index 0a760682..ae3148f2 100644 --- a/scan.c +++ b/scan.c @@ -335,7 +335,7 @@ static void ConfigureScanDict(pStringDict dict) pCount = (pCountEntry)pData; if(pCount != NULL) { - fprintf(fd,"%s storecounts %d %f %d %d %d %d %d %d %d %d %d %d\n", + fprintf(fd,"%s storecounts %ld %f %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", self->objectName, pCount->lCount, pCount->fTime, @@ -1326,7 +1326,7 @@ int isScanVarSoft(pScanData self){ strcpy(pPtr,"scan.Counts= {"); for(i = 0; i < self->iNP; i++) { - sprintf(pItem,"%d ",lData[i]); + sprintf(pItem,"%ld ",lData[i]); strcat(pPtr,pItem); } strcat(pPtr,"}"); @@ -1386,7 +1386,7 @@ int isScanVarSoft(pScanData self){ } else { lVal = -9999.99; } - snprintf(pBueffel,255,"%s.scanpoint = {%d %f %d}", + snprintf(pBueffel,255,"%s.scanpoint = {%d %f %ld}", self->objectName,i,fVal,lVal); SCWrite(pCon,pBueffel,eValue); } @@ -2374,5 +2374,6 @@ static int InterpretScanFunctions(pScanData self, SConnection *pCon, argv[1], argv[0]); SCWrite(pCon,pBueffel,eError); return 0; - } + } + return 0; } diff --git a/sicvar.c b/sicvar.c index 3a4502a9..f0ef44c7 100644 --- a/sicvar.c +++ b/sicvar.c @@ -443,6 +443,7 @@ static int VarSetFromText(pSicsVariable self, SConnection *pCon, char *text) { return VarSetFloat(self,(float)dVal,SCGetRights(pCon)); } + return 0; } /*-------------------------------------------------------------------------- Variables understands some commands: diff --git a/stdscan.c b/stdscan.c index b39f9414..7c6354a4 100644 --- a/stdscan.c +++ b/stdscan.c @@ -260,7 +260,7 @@ } /* make the data header */ - sprintf(pLine,"%-5s","NP"); + sprintf(pLine,"%-4s ","NP"); strcpy(pInfo,"Scanning Variables: "); for(i = 0; i < self->iScanVar;i++) { @@ -297,7 +297,7 @@ /* now the scan points */ for(i = 0; i < self->iCounts; i++) { - sprintf(pLine,"%-5d",i); + sprintf(pLine,"%-4d ",i); /* print vars */ for(i2 = 0; i2 < self->iScanVar; i2++) { @@ -305,7 +305,7 @@ pVar = (pVarEntry)pPtr; if(pVar) { - sprintf(pItem,"%-10.3f",GetScanVarPos(pVar,i)); + sprintf(pItem,"%-9.3f ",GetScanVarPos(pVar,i)); strcat(pLine,pItem); } } @@ -314,15 +314,15 @@ pData = (pCountEntry)pPtr; if(pData) { - sprintf(pItem," %-12ld",pData->lCount); + sprintf(pItem," %-11ld ",pData->lCount); strcat(pLine,pItem); - sprintf(pItem,"%-12ld",pData->Monitors[0]); + sprintf(pItem,"%-11ld ",pData->Monitors[0]); strcat(pLine,pItem); - sprintf(pItem,"%-12ld",pData->Monitors[1]); + sprintf(pItem,"%-11ld ",pData->Monitors[1]); strcat(pLine,pItem); - sprintf(pItem,"%-12ld",pData->Monitors[2]); + sprintf(pItem,"%-11ld ",pData->Monitors[2]); strcat(pLine,pItem); - sprintf(pItem,"%-6.1f",pData->fTime); + sprintf(pItem,"%-5.1f ",pData->fTime); strcat(pLine,pItem); } fprintf(self->fd,"%s\n",pLine); @@ -450,8 +450,8 @@ InitCountEntry(&sCount); /* prepare output header */ - sprintf(pHead,"%-5.5s","NP"); - sprintf(pStatus,"%-5d",iPoint); + sprintf(pHead,"%-4.4s ","NP"); + sprintf(pStatus,"%-4d ",iPoint); /* loop over all scan variables */ status = 1; @@ -471,9 +471,9 @@ fVal = pVar->pInter->GetValue(pVar->pObject,self->pCon); } AppendScanVar(pVar,fVal); - sprintf(pItem,"%-10.10s",ScanVarName(pVar)); + sprintf(pItem,"%-9.9s ",ScanVarName(pVar)); strcat(pHead,pItem); - sprintf(pItem,"%-10.3f",fVal); + sprintf(pItem,"%-9.3f ",fVal); strcat(pStatus,pItem); } } @@ -486,17 +486,17 @@ */ strcat(pHead,"Counts "); - sprintf(pItem,"%-15d",sCount.lCount); + sprintf(pItem,"%-14ld ",sCount.lCount); strcat(pStatus,pItem); strcat(pHead,"Monitor1 "); - sprintf(pItem,"%-12d",sCount.Monitors[0]); + sprintf(pItem,"%-11ld ",sCount.Monitors[0]); strcat(pStatus,pItem); strcat(pHead,"Monitor2 "); - sprintf(pItem,"%-12d",sCount.Monitors[1]); + sprintf(pItem,"%-11ld ",sCount.Monitors[1]); strcat(pStatus,pItem); strcat(pHead,"Monitor3 "); - sprintf(pItem,"%-12d",sCount.Monitors[2]); + sprintf(pItem,"%-11ld ",sCount.Monitors[2]); strcat(pStatus,pItem); strcat(pHead,"Time "); sprintf(pItem,"%-6.1f",sCount.fTime); diff --git a/token.c b/token.c index 75148b1d..4df9e587 100644 --- a/token.c +++ b/token.c @@ -56,7 +56,7 @@ NULL); if(!iRet) { - SCWrite(pCon,"ERROR: token command already exixts???!!",eError); + SCWrite(pCon,"ERROR: token command already exists ??? !!",eError); } return iRet; diff --git a/varlog.c b/varlog.c index 965eada0..16b5cd22 100644 --- a/varlog.c +++ b/varlog.c @@ -450,7 +450,7 @@ static void VarLogDumpFile(pVarLog self, FILE *fd) } else /* print */ { - sprintf(pBueffel,"%s.frequency = %d",pVarName,self->tFrequency); + sprintf(pBueffel,"%s.frequency = %d",pVarName,(int)self->tFrequency); SCWrite(pCon,pBueffel,eValue); return 1; }