get_enum_str must take address from DBADDR.pfield not from record
This commit is contained in:
+8
-2
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user