bufr_descriptor_set_svalue() doesn't work on "fresh" descriptors

Bug #567869 reported by cpb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libECBUFR
Fix Committed
High
cpb

Bug Description

Sample code:

   BufrDescriptor* d = bufr_create_descriptor( tables, desc );
   bufr_descriptor_set_svalue(d, value);
   fprintf(stderr,"set string to '%s' ('%s')\n", bufr_descriptor_get_svalue(d, &l),value);

The output ends up being an empty string rather than what we're assigning.

the root of the problem is that bufr_create_descriptor() does a lookup in the table and sets d->encoding.type, but that's all it sets in the encoding section. Well, bufr_descriptor_set_svalue() comes along and falls down to:

  bufr_value_set_string( cb->value, sval, cb->encoding.nbits/8 );

which, obviously, is going to fail miserably since cb->encoding.nbits==0.

Proper fix is to ensure that bufr_create_descriptor() fully defines the encoding based on the table entry.

cpb (chris-beauregard)
Changed in libecbufr:
status: New → In Progress
importance: Undecided → High
assignee: nobody → cpb (chris-beauregard)
cpb (chris-beauregard)
Changed in libecbufr:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.