GNOME Bugzilla – Bug 586568
[bytereader] add misc. string functions and gst_byte_reader_dup_data()
Last modified: 2009-06-23 01:21:19 UTC
I'd like to add the following functions to GstByteReader: bytereader: add a bunch of utility functions for strings and a data dup function API: gst_byte_reader_dup_data API: gst_byte_reader_skip_string API: gst_byte_reader_skip_string_utf8 API: gst_byte_reader_skip_string_utf16 API: gst_byte_reader_skip_string_utf32 API: gst_byte_reader_peek_string API: gst_byte_reader_peek_string_utf8 API: gst_byte_reader_peek_string_utf16 API: gst_byte_reader_peek_string_utf32 They're useful for tag/chunk/atom parsing (making sure that theres's actually a full 0-terminated string in the byte reader).
Sounds like a very good idea to me, go for it! :)
Created attachment 137137 [details] [review] bytereader: add a bunch of utility functions for strings and a data dup function (Note: the patch also moves gst_byte_reader_get_data() up to where its gtk-doc chunk is, hence the stuff at the beginning)
Looks good, but what about get_string() and dup_string() variants? :)
Hrm, I'm wondering about whether providing _peek() and _get() functions for utf16/utf32 is really a good idea - might that not cause problems with alignment? Maybe we should only provide dup functions for these?
Oh right, yes... then only dup functions would be the best, assuming that normally UTF16/32 is handled by accessing the 16/32 bit integers directly and not byte based.
commit 6b64d419373e3dcf6f243826410091cd589b2a75 Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Fri May 22 14:47:33 2009 +0100 bytereader: add a bunch of utility functions for strings and a data dup function API: gst_byte_reader_dup_data API: gst_byte_reader_dup_string API: gst_byte_reader_dup_string_utf8 API: gst_byte_reader_dup_string_utf16 API: gst_byte_reader_dup_string_utf32 API: gst_byte_reader_skip_string API: gst_byte_reader_skip_string_utf8 API: gst_byte_reader_skip_string_utf16 API: gst_byte_reader_skip_string_utf32 API: gst_byte_reader_peek_string API: gst_byte_reader_peek_string_utf8 API: gst_byte_reader_get_string API: gst_byte_reader_get_string_utf8 And some basic unit tests. Fixes #586568.