Replaced sizeofTypes[] with dbValueSize().

This commit is contained in:
Andrew Johnson
2008-08-06 22:00:39 +00:00
parent 1d37abdaf4
commit 4290277dc7
2 changed files with 8 additions and 12 deletions

View File

@@ -91,9 +91,6 @@ struct sadset { /* subArray dset */
DEVSUPFUN read_sa; /*returns: (-1,0)=>(failure,success)*/
};
/*sizes of field types*/
static int sizeofTypes[] = {MAX_STRING_SIZE,1,1,2,2,4,4,4,8,2};
static void monitor(subArrayRecord *psa);
static long readValue(subArrayRecord *psa);
@@ -107,8 +104,8 @@ static long init_record(subArrayRecord *psa, int pass)
if (psa->malm <= 0)
psa->malm = 1;
if (psa->ftvl > DBF_ENUM)
psa->ftvl = 2;
psa->bptr = calloc(psa->malm, sizeofTypes[psa->ftvl]);
psa->ftvl = DBF_UCHAR;
psa->bptr = calloc(psa->malm, dbValueSize(psa->ftvl));
psa->nord = 0;
return 0;
}
@@ -171,7 +168,7 @@ static long cvt_dbaddr(DBADDR *paddr)
paddr->pfield = psa->bptr;
paddr->no_elements = psa->malm;
paddr->field_type = psa->ftvl;
paddr->field_size = sizeofTypes[psa->ftvl];
paddr->field_size = dbValueSize(psa->ftvl);
paddr->dbr_field_type = psa->ftvl;
return 0;

View File

@@ -83,8 +83,7 @@ struct wfdset { /* waveform dset */
DEVSUPFUN get_ioint_info;
DEVSUPFUN read_wf; /*returns: (-1,0)=>(failure,success)*/
};
/*sizes of field types*/
static int sizeofTypes[] = {MAX_STRING_SIZE,1,1,2,2,4,4,4,8,2};
static void monitor(waveformRecord *);
static long readValue(waveformRecord *);
@@ -96,9 +95,9 @@ static long init_record(waveformRecord *pwf, int pass)
if (pwf->nelm <= 0)
pwf->nelm = 1;
if (pwf->ftvl > DBF_ENUM)
pwf->ftvl = 2;
pwf->bptr = calloc(pwf->nelm, sizeofTypes[pwf->ftvl]);
if (pwf->nelm==1) {
pwf->ftvl = DBF_UCHAR;
pwf->bptr = calloc(pwf->nelm, dbValueSize(pwf->ftvl));
if (pwf->nelm == 1) {
pwf->nord = 1;
} else {
pwf->nord = 0;
@@ -163,7 +162,7 @@ static long cvt_dbaddr(DBADDR *paddr)
paddr->pfield = pwf->bptr;
paddr->no_elements = pwf->nelm;
paddr->field_type = pwf->ftvl;
paddr->field_size = sizeofTypes[pwf->ftvl];
paddr->field_size = dbValueSize(pwf->ftvl);
paddr->dbr_field_type = pwf->ftvl;
return 0;