diff --git a/src/db/dbAccess.c b/src/db/dbAccess.c index d30455e2e..871347092 100644 --- a/src/db/dbAccess.c +++ b/src/db/dbAccess.c @@ -326,18 +326,18 @@ static void getOptions(DBADDR *paddr,void **poriginal,long *options,void *pflin) /* Process options */ pcommon = (dbCommon *)(paddr->precord); if( (*options) & DBR_STATUS ) { + unsigned short *pushort = (unsigned short *)pbuffer; + if(pfl!=NULL) { - /* This gives warning: - * ANSI C forbids use of cast expressions as lvalues - */ - *((unsigned short *)pbuffer)++ = pfl->stat; - *((unsigned short *)pbuffer)++ = pfl->sevr; + *pushort++ = pfl->stat; + *pushort++ = pfl->sevr; } else { - *((unsigned short *)pbuffer)++ = pcommon->stat; - *((unsigned short *)pbuffer)++ = pcommon->sevr; + *pushort++ = pcommon->stat; + *pushort++ = pcommon->sevr; } - *((unsigned short *)pbuffer)++ = pcommon->acks; - *((unsigned short *)pbuffer)++ = pcommon->ackt; + *pushort++ = pcommon->acks; + *pushort++ = pcommon->ackt; + pbuffer = pushort; } if( (*options) & DBR_UNITS ) { memset(pbuffer,'\0',dbr_units_size); @@ -368,13 +368,15 @@ static void getOptions(DBADDR *paddr,void **poriginal,long *options,void *pflin) pbuffer = (char *)pbuffer + dbr_precision_size; } if( (*options) & DBR_TIME ) { + unsigned long *pulong = (unsigned long *)pbuffer; if(pfl!=NULL) { - *((unsigned long *)pbuffer)++ = pfl->time.secPastEpoch; - *((unsigned long *)pbuffer)++ = pfl->time.nsec; + *pulong++ = pfl->time.secPastEpoch; + *pulong++ = pfl->time.nsec; } else { - *((unsigned long *)pbuffer)++ = pcommon->time.secPastEpoch; - *((unsigned long *)pbuffer)++ = pcommon->time.nsec; + *pulong++ = pcommon->time.secPastEpoch; + *pulong++ = pcommon->time.nsec; } + pbuffer = pulong; } if( (*options) & DBR_ENUM_STRS ) get_enum_strs(paddr,&pbuffer,prset,options); @@ -632,10 +634,10 @@ long dbNameToAddr(const char *pname,DBADDR *paddr) if(!pdbbase) return(S_db_notFound); dbInitEntry(pdbbase,&dbEntry); - if(status = dbFindRecord(&dbEntry,pname)) return(status); + if((status = dbFindRecord(&dbEntry,pname))) return(status); paddr->precord = dbEntry.precnode->precord; if(!dbEntry.pfield) { - if(status=dbFindField(&dbEntry,"VAL"))return(status); + if((status=dbFindField(&dbEntry,"VAL"))) return(status); } paddr->pfield = dbEntry.pfield; pflddes = dbEntry.pflddes; @@ -835,8 +837,8 @@ long dbGetField( DBADDR *paddr,short dbrType,void *pbuffer, getOptions(paddr,(void **)&pbuf,options,pflin); if(nRequest && *nRequest==0) goto done; dbInitEntry(pdbbase,&dbEntry); - if(status = dbFindRecord(&dbEntry,precord->name)) goto done; - if(status = dbFindField(&dbEntry,pfldDes->name)) goto done; + if((status = dbFindRecord(&dbEntry,precord->name))) goto done; + if((status = dbFindField(&dbEntry,pfldDes->name))) goto done; rtnString = dbGetString(&dbEntry); /*begin kludge for old db_access MAX_STRING_SIZE*/ if(strlen(rtnString)>=MAX_STRING_SIZE) { @@ -997,14 +999,14 @@ long dbPutField(DBADDR *paddr,short dbrType,const void *pbuffer,long nRequest) plink->type = PV_LINK; } dbInitEntry(pdbbase,&dbEntry); - if(status=dbFindRecord(&dbEntry,precord->name)) goto done; - if(status=dbFindField(&dbEntry,pfldDes->name)) goto done; + if((status=dbFindRecord(&dbEntry,precord->name))) goto done; + if((status=dbFindField(&dbEntry,pfldDes->name))) goto done; /* check for special processing is required */ if(special) { status = putSpecial(paddr,0); if(status) return(status); } - if(status=dbPutString(&dbEntry,buffer)) goto done; + if((status=dbPutString(&dbEntry,buffer))) goto done; if(special) { status = putSpecial(paddr,1); if(status) return(status); diff --git a/src/db/dbCa.c b/src/db/dbCa.c index 5ff3641ee..790ee7220 100644 --- a/src/db/dbCa.c +++ b/src/db/dbCa.c @@ -613,7 +613,7 @@ void dbCaTask() semTake(caWakeupSem,WAIT_FOREVER); while(TRUE) { /* process all requests in caList*/ semTake(caListSem,WAIT_FOREVER); - if(pca = (caLink *)ellFirst(&caList)){/*Take off list head*/ + if((pca = (caLink *)ellFirst(&caList))){/*Take off list head*/ ellDelete(&caList,&pca->node); link_action = pca->link_action; pca->link_action = 0; diff --git a/src/db/dbNotify.c b/src/db/dbNotify.c index 53c432aa8..0007b85e6 100644 --- a/src/db/dbNotify.c +++ b/src/db/dbNotify.c @@ -258,7 +258,7 @@ static void notifyCancel(PUTNOTIFY *ppn) PNRESTARTNODE *pfirst; /*Remove everything on waitList*/ - while(ppnnode = (PNWAITNODE *)ellLast(&ppn->waitList)) { + while((ppnnode = (PNWAITNODE *)ellLast(&ppn->waitList))) { precord = ppnnode->precord; precord->ppn = NULL; ellDelete(&ppn->waitList,&ppnnode->node); @@ -268,7 +268,7 @@ static void notifyCancel(PUTNOTIFY *ppn) ellDelete(&ppn->restartNode.ppnrestartList->restartList, &ppn->restartNode.node); /*If this ppn has a restartList move it */ - if(pfirst = (PNRESTARTNODE *)ellFirst(&ppn->restartList)) { + if((pfirst = (PNRESTARTNODE *)ellFirst(&ppn->restartList))) { PNRESTARTNODE *pnext; PUTNOTIFY *pfirstppn; diff --git a/src/db/dbScan.c b/src/db/dbScan.c index b8ef05d6d..927627578 100644 --- a/src/db/dbScan.c +++ b/src/db/dbScan.c @@ -542,7 +542,7 @@ static void spawnPeriodic(int ind) char taskName[20]; psl = papPeriodic[ind]; - sprintf(taskName,"scan%d",psl->ticks); + sprintf(taskName,"scan%ld",psl->ticks); periodicTaskId[ind] = taskSpawn(taskName,PERIODSCAN_PRI-ind, PERIODSCAN_OPT,PERIODSCAN_STACK, (FUNCPTR )periodicTask,(int)psl, diff --git a/src/db/dbTest.c b/src/db/dbTest.c index 3c6496057..72f7a21eb 100644 --- a/src/db/dbTest.c +++ b/src/db/dbTest.c @@ -797,7 +797,7 @@ static void printBuffer( if (retOptions & DBR_TIME) { struct dbr_time *pdbr_time = (void *)pbuffer; - printf("time=%lu %lu\n", pdbr_time->time.secPastEpoch, + printf("time=%u %u\n", pdbr_time->time.secPastEpoch, pdbr_time->time.nsec); }else{ printf("time not returned\n"); @@ -1110,13 +1110,11 @@ static int dbpr_report( char *ptemp_buf = &temp_buf[0]; short n = pdbFldDes->size; short i; - unsigned long value; strcpy(ptemp_buf,"0x"); ptemp_buf+=2; if(n>(sizeof(temp_buf)-2)/2) n = (sizeof(temp_buf)-2)/2; for (i=0; istatus,pvalue->severity); - printf("\tTimeStamp: %lx %lx", + printf("\tTimeStamp: %u %u", pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); printf("\tValue: "); printf("%s",pvalue->value); @@ -347,7 +347,7 @@ static void print_returned(type,pbuffer,count) = (struct dbr_time_short *)pbuffer; short *pshort = &pvalue->value; printf("%2d %2d",pvalue->status,pvalue->severity); - printf("\tTimeStamp: %lx %lx", + printf("\tTimeStamp: %u %u", pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pshort++){ @@ -362,7 +362,7 @@ static void print_returned(type,pbuffer,count) = (struct dbr_time_float *)pbuffer; float *pfloat = &pvalue->value; printf("%2d %2d",pvalue->status,pvalue->severity); - printf("\tTimeStamp: %lx %lx", + printf("\tTimeStamp: %u %u", pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pfloat++){ @@ -377,7 +377,7 @@ static void print_returned(type,pbuffer,count) = (struct dbr_time_char *)pbuffer; unsigned char *pchar = &pvalue->value; printf("%2d %2d",pvalue->status,pvalue->severity); - printf("\tTimeStamp: %lx %lx", + printf("\tTimeStamp: %u %u", pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pchar++){ @@ -392,12 +392,12 @@ static void print_returned(type,pbuffer,count) = (struct dbr_time_long *)pbuffer; dbr_long_t *plong = &pvalue->value; printf("%2d %2d",pvalue->status,pvalue->severity); - printf("\tTimeStamp: %lx %lx", + printf("\tTimeStamp: %u %u", pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,plong++){ if(count!=1 && (i%10 == 0)) printf("\n"); - printf("0x%lx ",*plong); + printf("%ld ",*plong); } break; } @@ -407,7 +407,7 @@ static void print_returned(type,pbuffer,count) = (struct dbr_time_double *)pbuffer; double *pdouble = &pvalue->value; printf("%2d %2d",pvalue->status,pvalue->severity); - printf("\tTimeStamp: %lx %lx", + printf("\tTimeStamp: %u %u", pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pdouble++){ @@ -500,7 +500,7 @@ static void print_returned(type,pbuffer,count) if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,plong++){ if(count!=1 && (i%10 == 0)) printf("\n"); - printf("0x%lx ",*plong); + printf("%ld ",*plong); } break; } @@ -603,7 +603,7 @@ static void print_returned(type,pbuffer,count) if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,plong++){ if(count!=1 && (i%10 == 0)) printf("\n"); - printf("0x%lx ",*plong); + printf("%ld ",*plong); } break; } diff --git a/src/db/drvTS.c b/src/db/drvTS.c index 64169e253..e9f34138e 100644 --- a/src/db/drvTS.c +++ b/src/db/drvTS.c @@ -1,6 +1,9 @@ /* * $Log$ + * Revision 1.21 1998/01/20 16:20:04 mrk + * Fix include statements + * * Revision 1.20 1997/05/30 13:17:21 mrk * get rid of warning messages when using TS_1900_TO_* * @@ -238,11 +241,13 @@ void TSprintCurrentTime(); #endif /* data used by all */ -TSinfo TSdata = { TS_master_dead, TS_async_slave, TS_async_none, - 0,NULL, - TS_SYNC_RATE_SEC,TS_CLOCK_RATE_HZ,0,TS_TIME_OUT_MS,0, - TS_MASTER_PORT,TS_SLAVE_PORT,1,0,0,0,0, - NULL, NULL, NULL }; +TSinfo TSdata = +{ TS_master_dead, TS_async_slave, TS_async_none, + 0,NULL, + TS_SYNC_RATE_SEC,TS_CLOCK_RATE_HZ,0,TS_TIME_OUT_MS,0, + TS_MASTER_PORT,TS_SLAVE_PORT,1,0,0,0,0, + NULL, {NULL}, {NULL} +}; extern char* sysBootLine; diff --git a/src/db/recGbl.c b/src/db/recGbl.c index a94a09a8e..0b5cbd9f1 100644 --- a/src/db/recGbl.c +++ b/src/db/recGbl.c @@ -234,10 +234,10 @@ int recGblInitConstantLink(struct link *plink,short dbftype,void *pdest) sscanf(plink->value.constantStr,"%hu",(unsigned short *)pdest); break; case DBF_LONG : - sscanf(plink->value.constantStr,"%d",(long *)pdest); + sscanf(plink->value.constantStr,"%ld",(long *)pdest); break; case DBF_ULONG : - sscanf(plink->value.constantStr,"%u",(unsigned long *)pdest); + sscanf(plink->value.constantStr,"%lu",(unsigned long *)pdest); break; case DBF_FLOAT : sscanf(plink->value.constantStr,"%f",(float *)pdest); diff --git a/src/dbStatic/dbStaticLib.c b/src/dbStatic/dbStaticLib.c index 069e8276b..28b9c9748 100644 --- a/src/dbStatic/dbStaticLib.c +++ b/src/dbStatic/dbStaticLib.c @@ -350,7 +350,7 @@ void dbFreePath(DBBASE *pdbbase) if(!pdbbase) return; ppathList = (ELLLIST *)pdbbase->pathPvt; if(!ppathList) return; - while(pdbPathNode = (dbPathNode *)ellFirst(ppathList)) { + while((pdbPathNode = (dbPathNode *)ellFirst(ppathList))) { ellDelete(ppathList,&pdbPathNode->node); free((void *)pdbPathNode->directory); free((void *)pdbPathNode); @@ -1309,7 +1309,7 @@ long dbCreateRecord(DBENTRY *pdbentry,char *precordName) pNewRecNode = dbCalloc(1,sizeof(dbRecordNode)); /* create a new record of this record type */ pdbentry->precnode = pNewRecNode; - if(status = dbAllocRecord(pdbentry,precordName)) return(status); + if((status = dbAllocRecord(pdbentry,precordName))) return(status); pNewRecNode->recordname = dbRecordName(pdbentry); /* install record node in list in sorted postion */ precnode = (dbRecordNode *)ellFirst(preclist); @@ -1337,7 +1337,7 @@ long dbDeleteRecord(DBENTRY *pdbentry) preclist = &precordType->recList; ellDelete(preclist,&precnode->node); dbPvdDelete(pdbbase,precnode); - if(status = dbFreeRecord(pdbentry)) return(status); + if((status = dbFreeRecord(pdbentry))) return(status); free((void *)precnode); pdbentry->precnode = NULL; return (0); @@ -1456,7 +1456,7 @@ long dbRenameRecord(DBENTRY *pdbentry,char *newName) if(!status) return(S_dbLib_recExists); dbPvdDelete(pdbbase,precnode); pdbentry->pflddes = precordType->papFldDes[0]; - if(status = dbGetFieldAddress(pdbentry)) return(status); + if((status = dbGetFieldAddress(pdbentry))) return(status); strcpy(pdbentry->pfield,newName); ppvd = dbPvdAdd(pdbbase,precordType,precnode); if(!ppvd) {errMessage(-1,"Logic Err: Could not add to PVD");return(-1);} @@ -1530,10 +1530,10 @@ long dbCopyRecord(DBENTRY *pdbentry,char *newRecordName,int overWriteOK) if(status) return(status); } dbFinishEntry(&dbentry); - if(status = dbFindRecordType(&dbentry,precordType->name)) return(status); - if(status = dbCreateRecord(&dbentry,newRecordName)) return(status); - if(status = dbFirstField(pdbentry,TRUE)) return(status); - if(status = dbFirstField(&dbentry,TRUE)) return(status); + if((status = dbFindRecordType(&dbentry,precordType->name))) return(status); + if((status = dbCreateRecord(&dbentry,newRecordName))) return(status); + if((status = dbFirstField(pdbentry,TRUE))) return(status); + if((status = dbFirstField(&dbentry,TRUE))) return(status); while(!status) { if(!dbIsDefaultValue(pdbentry)) { pvalue = dbGetString(pdbentry); @@ -2124,7 +2124,7 @@ long dbPutString(DBENTRY *pdbentry,char *pstring) pstr = end + 1; sscanf(pstr,"%hd",&plink->value.vxiio.slot); } - if(end = strchr(pstr,'S')) { + if((end = strchr(pstr,'S'))) { pstr = end + 1; sscanf(pstr,"%hd",&plink->value.vxiio.signal); } else { diff --git a/src/dbStatic/dbStaticRun.c b/src/dbStatic/dbStaticRun.c index 2d4691eda..4bb9155e0 100644 --- a/src/dbStatic/dbStaticRun.c +++ b/src/dbStatic/dbStaticRun.c @@ -630,7 +630,7 @@ long dbPutMenuIndex(DBENTRY *pdbentry,int index) dbMenu *pdbMenu = (dbMenu *)pflddes->ftPvt; if(!pdbMenu) return(S_dbLib_menuNotFound); - if(index<0 | index>=pdbMenu->nChoice) return(S_dbLib_badField); + if(index<0 || index>=pdbMenu->nChoice) return(S_dbLib_badField); *pfield = (unsigned short)index; return(0); } @@ -639,7 +639,7 @@ long dbPutMenuIndex(DBENTRY *pdbentry,int index) pdbDeviceMenu = dbGetDeviceMenu(pdbentry); if(!pdbDeviceMenu) return(S_dbLib_menuNotFound); - if(index<0 | index>=pdbDeviceMenu->nChoice) + if(index<0 || index>=pdbDeviceMenu->nChoice) return(S_dbLib_badField); return(dbPutString(pdbentry,pdbDeviceMenu->papChoice[index])); } diff --git a/src/vxWorks/db/drvTS.c b/src/vxWorks/db/drvTS.c index 64169e253..e9f34138e 100644 --- a/src/vxWorks/db/drvTS.c +++ b/src/vxWorks/db/drvTS.c @@ -1,6 +1,9 @@ /* * $Log$ + * Revision 1.21 1998/01/20 16:20:04 mrk + * Fix include statements + * * Revision 1.20 1997/05/30 13:17:21 mrk * get rid of warning messages when using TS_1900_TO_* * @@ -238,11 +241,13 @@ void TSprintCurrentTime(); #endif /* data used by all */ -TSinfo TSdata = { TS_master_dead, TS_async_slave, TS_async_none, - 0,NULL, - TS_SYNC_RATE_SEC,TS_CLOCK_RATE_HZ,0,TS_TIME_OUT_MS,0, - TS_MASTER_PORT,TS_SLAVE_PORT,1,0,0,0,0, - NULL, NULL, NULL }; +TSinfo TSdata = +{ TS_master_dead, TS_async_slave, TS_async_none, + 0,NULL, + TS_SYNC_RATE_SEC,TS_CLOCK_RATE_HZ,0,TS_TIME_OUT_MS,0, + TS_MASTER_PORT,TS_SLAVE_PORT,1,0,0,0,0, + NULL, {NULL}, {NULL} +}; extern char* sysBootLine;