diff --git a/src/rec/biRecord.c b/src/rec/biRecord.c index fe314702b..dcfb923b4 100644 --- a/src/rec/biRecord.c +++ b/src/rec/biRecord.c @@ -191,11 +191,17 @@ static long get_enum_str(paddr,pstring) char *pstring; { struct biRecord *pbi=(struct biRecord *)paddr->precord; + int index; + unsigned short *pfield = (unsigned short *)paddr->pfield; - if(pbi->val==0) { + + index = dbGetFieldIndex(paddr); + if(index!=biRecordVAL) { + strcpy(pstring,"Illegal_Value"); + } else if(*pfield==0) { strncpy(pstring,pbi->znam,sizeof(pbi->znam)); pstring[sizeof(pbi->znam)] = 0; - } else if(pbi->val==1) { + } else if(*pfield==1) { strncpy(pstring,pbi->onam,sizeof(pbi->onam)); pstring[sizeof(pbi->onam)] = 0; } else { diff --git a/src/rec/boRecord.c b/src/rec/boRecord.c index 633f0f3b2..bbbbb963e 100644 --- a/src/rec/boRecord.c +++ b/src/rec/boRecord.c @@ -335,11 +335,17 @@ static long get_enum_str(paddr,pstring) char *pstring; { struct boRecord *pbo=(struct boRecord *)paddr->precord; + int index; + unsigned short *pfield = (unsigned short *)paddr->pfield; - if(pbo->val==0) { + + index = dbGetFieldIndex(paddr); + if(index!=boRecordVAL) { + strcpy(pstring,"Illegal_Value"); + } else if(*pfield==0) { strncpy(pstring,pbo->znam,sizeof(pbo->znam)); pstring[sizeof(pbo->znam)] = 0; - } else if(pbo->val==1) { + } else if(*pfield==1) { strncpy(pstring,pbo->onam,sizeof(pbo->onam)); pstring[sizeof(pbo->onam)] = 0; } else { diff --git a/src/rec/mbbiRecord.c b/src/rec/mbbiRecord.c index 85c8d3374..4ece11323 100644 --- a/src/rec/mbbiRecord.c +++ b/src/rec/mbbiRecord.c @@ -1,4 +1,4 @@ -/* recMbbi.c */ +/* mbbiRecord.c */ /* base/src/rec $Id$ */ /* * Original Author: Bob Dalesio @@ -262,9 +262,14 @@ static long get_enum_str(paddr,pstring) { struct mbbiRecord *pmbbi=(struct mbbiRecord *)paddr->precord; char *psource; - unsigned short val=pmbbi->val; + int index; + unsigned short *pfield = (unsigned short *)paddr->pfield; + unsigned short val=*pfield; - if(val<= 15) { + index = dbGetFieldIndex(paddr); + if(index!=mbbiRecordVAL) { + strcpy(pstring,"Illegal_Value"); + } else if(val<= 15) { psource = (pmbbi->zrst); psource += (val * sizeof(pmbbi->zrst)); strncpy(pstring,psource,sizeof(pmbbi->zrst)); diff --git a/src/rec/mbboRecord.c b/src/rec/mbboRecord.c index e5e032b3d..f8352e05b 100644 --- a/src/rec/mbboRecord.c +++ b/src/rec/mbboRecord.c @@ -324,9 +324,14 @@ static long get_enum_str(paddr,pstring) { struct mbboRecord *pmbbo=(struct mbboRecord *)paddr->precord; char *psource; - unsigned short val=pmbbo->val; + int index; + unsigned short *pfield = (unsigned short *)paddr->pfield; + unsigned short val=*pfield; - if(val<= 15) { + index = dbGetFieldIndex(paddr); + if(index!=mbboRecordVAL) { + strcpy(pstring,"Illegal_Value"); + } else if(val<= 15) { psource = (pmbbo->zrst); psource += (val * sizeof(pmbbo->zrst)); strncpy(pstring,psource,sizeof(pmbbo->zrst));