Replies inline.
Diff comments:
> diff --git a/modules/database/src/ioc/db/dbAccess.c b/modules/database/src/ioc/db/dbAccess.c
> index 9cda401..4fbfa96 100644
> --- a/modules/database/src/ioc/db/dbAccess.c
> +++ b/modules/database/src/ioc/db/dbAccess.c
> @@ -1329,25 +1334,21 @@ long dbPut(DBADDR *paddr, short dbrType,
> status = prset->get_array_info(paddr, &dummy, &offset);
> /* paddr->pfield may be modified */
> if (status) goto done;
> - } else
> - offset = 0;
> -
> - if (no_elements <= 1) {
> - status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer,
> - paddr->pfield, paddr);
> - nRequest = 1;
> - } else {
> if (no_elements < nRequest)
> nRequest = no_elements;
> status = dbPutConvertRoutine[dbrType][field_type](paddr, pbuffer,
> nRequest, no_elements, offset);
> - }
> -
> - /* update array info */
> - if (!status &&
> - paddr->pfldDes->special == SPC_DBADDR &&
Where?
The way diff shows it makes it a bit confusing to read. I have merged the two branches which checked for SPC_DBADDR.
The new code is now:
if (paddr->pfldDes->special == SPC_DBADDR &&
prset && prset->get_array_info) {
long dummy;
status = prset->get_array_info(paddr, &dummy, &offset);
/* paddr->pfield may be modified */
if (status) goto done;
if (no_elements < nRequest)
nRequest = no_elements;
status = dbPutConvertRoutine[dbrType][field_type](paddr, pbuffer,
nRequest, no_elements, offset);
/* update array info */
if (!status)
status = prset->put_array_info(paddr, nRequest);
} else {
if (nRequest < 1) {
recGblSetSevr(precord, LINK_ALARM, INVALID_ALARM);
} else {
status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer,
paddr->pfield, paddr);
nRequest = 1;
}
}
> - prset && prset->put_array_info) {
> - status = prset->put_array_info(paddr, nRequest);
> + /* update array info */
> + if (!status)
> + status = prset->put_array_info(paddr, nRequest);
> + } else {
> + if (nRequest < 1) {
> + recGblSetSevr(precord, LINK_ALARM, INVALID_ALARM);
> + } else {
> + status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer,
> + paddr->pfield, paddr);
> + nRequest = 1;
> + }
> }
>
> /* Always do special processing if needed */
> diff --git a/modules/database/src/ioc/db/dbTest.c b/modules/database/src/ioc/db/dbTest.c
> index 1193954..25782a2 100644
> --- a/modules/database/src/ioc/db/dbTest.c
> +++ b/modules/database/src/ioc/db/dbTest.c
> @@ -379,16 +380,41 @@ long dbpf(const char *pname,const char *pvalue)
> return -1;
> }
>
> - if (addr.no_elements > 1 &&
> - (addr.dbr_field_type == DBR_CHAR || addr.dbr_field_type == DBR_UCHAR)) {
> - dbrType = addr.dbr_field_type;
> - n = strlen(pvalue) + 1;
> - }
> - else {
> - dbrType = DBR_STRING;
> + if (addr.no_elements > 1) {
> + if (addr.dbr_field_type == DBR_CHAR || addr.dbr_field_type == DBR_UCHAR) {
> + dbrType = addr.dbr_field_type;
> + n = (long)strlen(pvalue) + 1;
> + } else {
> + const char *p = pvalue;
> +
I would prefer to have the same syntax in vxWorks and iocsh, plus/minus some quotes.
I need to find out how the yajl parser works. Have never looked at it before.
> + for (n = 0; *p && n < addr.no_elements; n++) {
> + while (isspace(*p)) p++;
> + while (*p && !isspace(*p)) {
> + if (p[0] == '\\' && p[1]) p++;
> + p++;
> + }
> + }
> + p = pvalue;
> + array = dbCalloc(n, MAX_STRING_SIZE);
Agreed. Freezing the shell is not polite.
> + for (n = 0; *p && n < addr.no_elements; n++) {
> + char* c = &array[n*MAX_STRING_SIZE];
> + while (isspace(*p)) p++;
> + pvalue = p;
> + while (*p && !isspace(*p)) {
> + if (p[0] == '\\' && p[1]) p++;
> + if (c >= &array[(n+1)*MAX_STRING_SIZE]-1) {
> + printf("Value [%ld] %.*s too long\n", n, (int)(p-pvalue), pvalue);
> + free(array);
> + return -1;
> + }
> + *c++=*p++;
> + }
> + }
> + pvalue = array;
> + }
> }
> -
> - status = dbPutField(&addr, dbrType, pvalue, (long) n);
> + status = dbPutField(&addr, dbrType, pvalue, n);
> + free(array);
> dbgf(pname);
> return status;
> }
--
https://code.launchpad.net/~dirk.zimoch/epics-base/+git/epics-base/+merge/386175
Your team EPICS Core Developers is subscribed to branch epics-base:7.0.
- References:
- [Merge] ~dirk.zimoch/epics-base:fix_zero_size_arrays into epics-base:7.0 Dirk Zimoch via Core-talk
- Navigate by Date:
- Prev:
epics-base-7.0-win64s-test - Build # 196 - Unstable! APS Jenkins via Core-talk
- Next:
Re: [Merge] ~dirk.zimoch/epics-base:fix_zero_size_arrays into epics-base:7.0 Dirk Zimoch via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
<2020>
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: [Merge] ~dirk.zimoch/epics-base:fix_zero_size_arrays into epics-base:7.0 Dirk Zimoch via Core-talk
- Next:
Re: [Merge] ~dirk.zimoch/epics-base:fix_zero_size_arrays into epics-base:7.0 Dirk Zimoch via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
<2020>
2021
2022
2023
2024
|