get rid of some warning messages

This commit is contained in:
Marty Kraimer
1998-01-22 14:48:43 +00:00
parent 94b3a7f5f9
commit df1d467188
11 changed files with 72 additions and 62 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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,

View File

@@ -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; i<n; i++, (ptemp_buf+=2), pchar++) {
value = *((unsigned char *)pchar);
sprintf(ptemp_buf,"%02x",value);
sprintf(ptemp_buf,"%02x",*pchar);
}
*ptemp_buf = 0;
sprintf(pmsg, "%s: %s", pfield_name,temp_buf);

View File

@@ -237,7 +237,7 @@ static void print_returned(type,pbuffer,count)
long *pvalue = (long *)pbuffer;
for (i = 0; i < count; i++,pvalue++){
if(count!=1 && (i%10 == 0)) printf("\n");
printf("0x%lx ", (unsigned long)*pvalue);
printf("%ld ", (unsigned long)*pvalue);
}
break;
}
@@ -312,7 +312,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%x ",(unsigned)*plong);
printf("%ld ",*plong);
}
break;
}
@@ -334,7 +334,7 @@ static void print_returned(type,pbuffer,count)
struct dbr_time_string *pvalue
= (struct dbr_time_string *) pbuffer;
printf("%2d %2d",pvalue->status,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;
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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]));
}

View File

@@ -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;