diff --git a/.gitignore b/.gitignore index fc8c56a29..b6a2ceee8 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ O.*/ *.swp *_BAK.adl /QtC-* +/.qtc_* cdCommands envPaths dllPath.bat diff --git a/asyn/asynDriver/asynManager.c b/asyn/asynDriver/asynManager.c index e063a4fc2..2061131ed 100644 --- a/asyn/asynDriver/asynManager.c +++ b/asyn/asynDriver/asynManager.c @@ -3000,7 +3000,7 @@ static int traceVprintIOSource(asynUser *pasynUser,int reason, } } /* If the traceIOMask is 0 or traceTruncateSize <=0 we need to output a newline */ - if((traceIOMask == 0) || (traceTruncateSize <=0)) { + if((traceIOMask == 0) || (traceTruncateSize ==0)) { if(fp) { nout += fprintf(fp,"\n"); } else { diff --git a/asyn/asynGpib/drvSkeleton.c b/asyn/asynGpib/drvSkeleton.c index b7b393dc8..fa4388d19 100644 --- a/asyn/asynGpib/drvSkeleton.c +++ b/asyn/asynGpib/drvSkeleton.c @@ -136,7 +136,7 @@ static asynGpib skeletonDriver = { serialPollEnd }; -int skeletonDriverConfig(const char *name, /*Start of device dependent args*/) +int skeletonDriverConfig(const char *name /*, ... Start of device dependent args*/) { skeletonPvt *pskeletonPvt; char *portName; diff --git a/asyn/asynPortClient/asynPortClient.cpp b/asyn/asynPortClient/asynPortClient.cpp index cc3b9329f..b2bc0f896 100644 --- a/asyn/asynPortClient/asynPortClient.cpp +++ b/asyn/asynPortClient/asynPortClient.cpp @@ -29,7 +29,7 @@ asynParamClient::asynParamClient(const char *portName, int addr, const char *asynInterfaceType, const char *drvInfo, double timeout) : pasynUser_(NULL), pasynUserSyncIO_(NULL), timeout_(timeout), portName_(epicsStrDup(portName)), - addr_(addr), asynInterfaceType_(epicsStrDup(asynInterfaceType)), drvInfo_(NULL) + addr_(addr), asynInterfaceType_(epicsStrDup(asynInterfaceType)), drvInfo_(NULL), drvPvt(NULL) ,interruptPvt_(NULL) { asynStatus status; diff --git a/asyn/devEpics/devAsynOctet.c b/asyn/devEpics/devAsynOctet.c index d25fb81cb..240e5b89f 100644 --- a/asyn/devEpics/devAsynOctet.c +++ b/asyn/devEpics/devAsynOctet.c @@ -315,7 +315,7 @@ static long initCommon(dbCommon *precord, DBLINK *plink, userCallback callback, goto bad; } } - if(valSize <= 0) { + if (valSize == 0) { printf("%s record size must be > 0\n",precord->name); precord->pact = 1; goto bad; @@ -629,7 +629,7 @@ static int initCmdBuffer(devPvt *pPvt) static const char *functionName="initCmdBuffer"; len = strlen(pPvt->userParam); - if(len<=0) { + if (len == 0) { printf("%s %s::%s no userParam\n",precord->name, driverName, functionName); precord->pact = 1; recGblSetSevr(precord,LINK_ALARM,INVALID_ALARM); diff --git a/asyn/devGpib/devGpibConvertExample.c b/asyn/devGpib/devGpibConvertExample.c index cd4d51ec8..30828f0cf 100644 --- a/asyn/devGpib/devGpibConvertExample.c +++ b/asyn/devGpib/devGpibConvertExample.c @@ -201,7 +201,7 @@ static int writeCvtio(gpibDpvt *pgpibDpvt,int P1, int P2, char **P3) pgpibDpvt->msgInputLen = 0; lenmsg = writeString(pgpibDpvt,P1,P2,P3); - if(lenmsg <= 0) return -1; + if (lenmsg == 0) return -1; status = pasynOctet->write(asynOctetPvt,pasynUser, pgpibDpvt->msg,lenmsg,&nsent); if(nsent==lenmsg) { diff --git a/asyn/drvAsynFTDI/drvAsynFTDIPort.cpp b/asyn/drvAsynFTDI/drvAsynFTDIPort.cpp index e66ac8f73..6bae50277 100644 --- a/asyn/drvAsynFTDI/drvAsynFTDIPort.cpp +++ b/asyn/drvAsynFTDI/drvAsynFTDIPort.cpp @@ -428,7 +428,7 @@ static asynStatus readIt(void *drvPvt, asynUser *pasynUser, return status; } } - if (maxchars <= 0) { + if (maxchars == 0) { epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize, "%d:%d maxchars %d. Why <=0?\n",ftdi->FTDIvendor, ftdi->FTDIproduct,(int)maxchars); return asynError; @@ -447,9 +447,6 @@ static asynStatus readIt(void *drvPvt, asynUser *pasynUser, } } - if (thisRead < 0){ - thisRead = 0; - } *nbytesTransfered = thisRead; /* If there is room add a null byte */ @@ -523,7 +520,7 @@ drvAsynFTDIPortConfigure(const char *portName, int SPI = ((mode & UART_SPI_BIT)==UART_SPI_BIT)? 1:0; printf("drvAsynFTDIPortConfigure: latency=%d\n", latency); - printf("drvAsynFTDIPortConfigure: priority=%d\n", priority); + printf("drvAsynFTDIPortConfigure: priority=%u\n", priority); printf("drvAsynFTDIPortConfigure: noAutoconnect=%d\n", noAutoConnect); printf("drvAsynFTDIPortConfigure: noProcessEos=%d\n", noProcessEos); printf("drvAsynFTDIPortConfigure: mode="); SPI ? printf("SPI\n") : printf("UART\n"); diff --git a/asyn/drvAsynFTDI/ftdiDriver.cpp b/asyn/drvAsynFTDI/ftdiDriver.cpp index b2d27d0dc..1c5aec151 100644 --- a/asyn/drvAsynFTDI/ftdiDriver.cpp +++ b/asyn/drvAsynFTDI/ftdiDriver.cpp @@ -45,7 +45,13 @@ void debugPrint(...){} * @param vendor - Vendor ID * @param product - Product ID */ -FTDIDriver::FTDIDriver(int mode):spi(mode) +FTDIDriver::FTDIDriver(int mode) + : ftdi_(nullptr) + , spi(mode) + , spiInit(0) + , buf({0}) + , pinState(0) + , pinDirection(0) { static const char *functionName = "FTDIDriver::FTDIDriver"; debugPrint("%s : Method called - ", functionName); @@ -66,8 +72,6 @@ FTDIDriver::FTDIDriver(int mode):spi(mode) parity_ = NONE; break_ = BREAK_OFF; flowctrl_ = SIO_DISABLE_FLOW_CTRL; - spiInit = 0; // Status whether init done - memset(buf, 0, sizeof(buf)); } FTDIDriverStatus FTDIDriver::initSPI() { @@ -88,7 +92,7 @@ FTDIDriverStatus FTDIDriver::initSPI() { // MASTER RESET pinState = Pin::CS|Pin::SYNCIO|Pin::RESET; pinDirection = Pin::SK|Pin::DO|Pin::CS|Pin::SYNCIO|Pin::RESET; - pbuf = (unsigned char *)&buf[0]; + unsigned char *pbuf = (unsigned char *)&buf[0]; *(pbuf + i++) = TCK_DIVISOR; // opcode: set clk divisor *(pbuf + i++) = 0x05; // argument: low bit. 60 MHz / (5+1) = 1 MHz *(pbuf + i++) = 0x00; // argument: high bit. @@ -574,7 +578,7 @@ FTDIDriverStatus FTDIDriver::write(const unsigned char *buffer, int bufferSize, if( spi ) { if( !spiInit ) initSPI(); i = 0; - pbuf = (unsigned char *)&buf[0]; + unsigned char *pbuf = (unsigned char *)&buf[0]; memcpy((pbuf+i), buffer, bufferSize); i+= bufferSize; @@ -602,11 +606,11 @@ FTDIDriverStatus FTDIDriver::write(const unsigned char *buffer, int bufferSize, if (rc[3] > 0){ // Since we write also the address byte byteswritten = sz+1 *bytesWritten = (size_t)(sz+1); - debugPrint("%s : %d bytes written err=%d: ", functionName, *bytesWritten, err); + debugPrint("%s : %llu bytes written err=%d: ", functionName, (unsigned long long) *bytesWritten, err); if( err == FTDIDriverError ) debugPrint("FTDIDriverError\n"); else debugPrint("FTDIDriverSUCCESS\n"); } else { - debugPrint("FTDI write error: %d (%s)\n", rc, ftdi_get_error_string(ftdi_)); + debugPrint("FTDI write error: %llu (%s)\n", (unsigned long long) rc, ftdi_get_error_string(ftdi_)); *bytesWritten = 0; return FTDIDriverError; } @@ -636,7 +640,8 @@ FTDIDriverStatus FTDIDriver::read(unsigned char *buffer, size_t bufferSize, size return FTDIDriverError; } - debugPrint("%s : Reading: bufferSize=%d, timeout=%d\n", functionName, bufferSize, timeout); + debugPrint("%s : Reading: bufferSize=%llu, timeout=%d\n", + functionName, (unsigned long long) bufferSize, timeout); timeval stime; timeval ctime; diff --git a/asyn/drvAsynFTDI/ftdiDriver.h b/asyn/drvAsynFTDI/ftdiDriver.h index fd1e661c6..c235add29 100644 --- a/asyn/drvAsynFTDI/ftdiDriver.h +++ b/asyn/drvAsynFTDI/ftdiDriver.h @@ -94,7 +94,6 @@ class FTDIDriver { int spi; int spiInit; int buf[0x10000]; - unsigned char *pbuf; int connected_; int vendor_; diff --git a/asyn/drvAsynSerial/drvAsynIPPort.c b/asyn/drvAsynSerial/drvAsynIPPort.c index ff521f06a..a5fd1415f 100644 --- a/asyn/drvAsynSerial/drvAsynIPPort.c +++ b/asyn/drvAsynSerial/drvAsynIPPort.c @@ -733,7 +733,7 @@ static asynStatus readIt(void *drvPvt, asynUser *pasynUser, return asynError; } } - if (maxchars <= 0) { + if (maxchars == 0) { epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize, "%s maxchars %d. Why <=0?",tty->IPDeviceName,(int)maxchars); return asynError; diff --git a/asyn/drvAsynSerial/drvAsynIPServerPort.c b/asyn/drvAsynSerial/drvAsynIPServerPort.c index de123594a..7a7f27bdd 100644 --- a/asyn/drvAsynSerial/drvAsynIPServerPort.c +++ b/asyn/drvAsynSerial/drvAsynIPServerPort.c @@ -177,7 +177,7 @@ static asynStatus readIt(void *drvPvt, asynUser *pasynUser, asynPrint(pasynUser, ASYN_TRACE_FLOW, "%s %p read.\n", tty->IPDeviceName, tty->pasynUser); - if (maxchars <= 0) { + if (maxchars == 0) { epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, "%s maxchars %d. Why <=0?\n", tty->IPDeviceName, (int) maxchars); return asynError; @@ -416,7 +416,7 @@ int createServerSocket(ttyController_t *tty) { srvaddrtxt[sizeof(srvaddrtxt) - 1] = '\0'; printf("serverAddr: %s\n", srvaddrtxt); } - printf("serverPort: %i\n", tty->portNumber); + printf("serverPort: %u\n", tty->portNumber); if (tty->socketType == SOCK_DGRAM) { /* For Port reuse, multiple IOCs */ epicsSocketEnableAddressUseForDatagramFanout(tty->fd); @@ -530,7 +530,7 @@ int drvAsynIPServerPortConfigure(const char *portName, printf("TCP server information missing.\n"); return -1; } - if (maxClients <= 0) { + if (maxClients == 0) { printf("No clients.\n"); return -1; } diff --git a/asyn/drvAsynSerial/drvAsynSerialPort.c b/asyn/drvAsynSerial/drvAsynSerialPort.c index 1ed6ab475..012ef178e 100644 --- a/asyn/drvAsynSerial/drvAsynSerialPort.c +++ b/asyn/drvAsynSerial/drvAsynSerialPort.c @@ -838,7 +838,7 @@ static asynStatus readIt(void *drvPvt, asynUser *pasynUser, "%s disconnected:", tty->serialDeviceName); return asynError; } - if (maxchars <= 0) { + if (maxchars == 0) { epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize, "%s maxchars %d Why <=0?",tty->serialDeviceName,(int)maxchars); return asynError; diff --git a/asyn/drvAsynSerial/drvAsynSerialPortWin32.c b/asyn/drvAsynSerial/drvAsynSerialPortWin32.c index 2ffbf1548..e27ea0639 100644 --- a/asyn/drvAsynSerial/drvAsynSerialPortWin32.c +++ b/asyn/drvAsynSerial/drvAsynSerialPortWin32.c @@ -524,7 +524,7 @@ static asynStatus readIt(void *drvPvt, asynUser *pasynUser, "%s disconnected:", tty->serialDeviceName); return asynError; } - if (maxchars <= 0) { + if (maxchars == 0) { epicsSnprintf(pasynUser->errorMessage,pasynUser->errorMessageSize, "%s maxchars %d Why <=0?",tty->serialDeviceName,(int)maxchars); return asynError; diff --git a/asyn/linuxGpib/drvLinuxGpib.c b/asyn/linuxGpib/drvLinuxGpib.c index 382ef32e1..f89422b89 100644 --- a/asyn/linuxGpib/drvLinuxGpib.c +++ b/asyn/linuxGpib/drvLinuxGpib.c @@ -570,7 +570,7 @@ static asynStatus setEos(void *pdrvPvt,asynUser *pasynUser,const char *eos,int e ibconfig(pGpibBoardPvt->uddev[primaryAddr][secondaryAddr],IbcEOSrd,1); if(DEBUG) - printf("Seting EOS: %u\n",*eos); + printf("Seting EOS: %d\n", *eos); status=checkError(pdrvPvt,pasynUser,addr); if(status!=asynSuccess)return status; diff --git a/asyn/miscellaneous/asynShellCommands.c b/asyn/miscellaneous/asynShellCommands.c index 2b6f6662f..83a8f41c4 100644 --- a/asyn/miscellaneous/asynShellCommands.c +++ b/asyn/miscellaneous/asynShellCommands.c @@ -264,7 +264,7 @@ getEos(asynUser *pasynUser) default: getFunc = NULL; break; } if (getFunc) { - int l; + int l = 0; peosargs->status = (*getFunc)(peosargs->drvPvt, pasynUser, peosargs->eos, sizeof peosargs->eos, &l); peosargs->eosLen = l; }