ion-c icon indicating copy to clipboard operation
ion-c copied to clipboard

Determine desired behavior of ion_reader_get_value_length for text readers.

Open tgregg opened this issue 5 years ago • 0 comments

Currently, text readers always provide -1 for this function because text values are not length-prefixed like they are in binary. Implementing this properly for text readers would require probing forward to find the end of the value, which would be expensive.

A cleaner alternative is to instruct the user to calculate the length of the desired value by subtracting the current value's offset (see ion_reader_get_value_offset) from the next value's offset. This works for both text and binary.

tgregg avatar Nov 28 '19 01:11 tgregg