get_enum_str must take address from DBADDR.pfield not from record

This commit is contained in:
Marty Kraimer
1997-06-11 15:19:09 +00:00
parent 4908e28d31
commit 5824a6096c
4 changed files with 31 additions and 9 deletions
+8 -2
View File
@@ -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 {
+8 -2
View File
@@ -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 {
+8 -3
View File
@@ -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));
+7 -2
View File
@@ -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));