From 79c8e2488513ce7aa84ae36742adaeba95182616 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 16 Jul 2009 14:17:03 +0100 Subject: [PATCH] docs: fix API docs for gst_{adapter|byte_reader}_masked_scan_uint32 Clarify byte reader docs a bit: offset is relative to the current position of the reader, not to the start of the data. Also, the examples in both the adapter docs and the byte reader docs have the mask and pattern arguments swapped (see #587561). Spotted by Carl-Anton Ingmarsson. --- libs/gst/base/gstadapter.c | 14 +++++++------- libs/gst/base/gstbytereader.c | 24 +++++++++++++----------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/libs/gst/base/gstadapter.c b/libs/gst/base/gstadapter.c index 3c44e8e..0505827 100644 --- a/libs/gst/base/gstadapter.c +++ b/libs/gst/base/gstadapter.c @@ -756,19 +756,19 @@ gst_adapter_prev_timestamp (GstAdapter * adapter, guint64 * distance) * * // Assume the adapter contains 0x00 0x01 0x02 ... 0xfe 0xff * - * gst_adapter_masked_scan_uint32 (adapter, 0x00010203, 0xffffffff, 0, 256); + * gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x00010203, 0, 256); * // -> returns 0 - * gst_adapter_masked_scan_uint32 (adapter, 0x00010203, 0xffffffff, 1, 255); + * gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x00010203, 1, 255); * // -> returns -1 - * gst_adapter_masked_scan_uint32 (adapter, 0x01020304, 0xffffffff, 1, 255); + * gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x01020304, 1, 255); * // -> returns 1 - * gst_adapter_masked_scan_uint32 (adapter, 0x0001, 0xffff, 0, 256); + * gst_adapter_masked_scan_uint32 (adapter, 0xffff, 0x0001, 0, 256); * // -> returns -1 - * gst_adapter_masked_scan_uint32 (adapter, 0x0203, 0xffff, 0, 256); + * gst_adapter_masked_scan_uint32 (adapter, 0xffff, 0x0203, 0, 256); * // -> returns 0 - * gst_adapter_masked_scan_uint32 (adapter, 0x02030000, 0xffff0000, 0, 256); + * gst_adapter_masked_scan_uint32 (adapter, 0xffff0000, 0x02030000, 0, 256); * // -> returns 2 - * gst_adapter_masked_scan_uint32 (adapter, 0x02030000, 0xffff0000, 0, 4); + * gst_adapter_masked_scan_uint32 (adapter, 0xffff0000, 0x02030000, 0, 4); * // -> returns -1 * * diff --git a/libs/gst/base/gstbytereader.c b/libs/gst/base/gstbytereader.c index 7ba435a..406526f 100644 --- a/libs/gst/base/gstbytereader.c +++ b/libs/gst/base/gstbytereader.c @@ -1239,15 +1239,17 @@ gst_byte_reader_dup_data (GstByteReader * reader, guint size, guint8 ** val) * @reader: a #GstByteReader * @mask: mask to apply to data before matching against @pattern * @pattern: pattern to match (after mask is applied) - * @offset: offset into the adapter data from which to start scanning + * @offset: offset from which to start scanning, relative to the current + * position * @size: number of bytes to scan from offset * - * Scan for pattern @pattern with applied mask @mask in the adapter data, - * starting from offset @offset. + * Scan for pattern @pattern with applied mask @mask in the byte reader data, + * starting from offset @offset relative to the current position. * * The bytes in @pattern and @mask are interpreted left-to-right, regardless * of endianness. All four bytes of the pattern must be present in the - * adapter for it to match, even if the first or last bytes are masked out. + * byte reader data for it to match, even if the first or last bytes are masked + * out. * * It is an error to call this function without making sure that there is * enough data (offset+size bytes) in the byte reader. @@ -1258,19 +1260,19 @@ gst_byte_reader_dup_data (GstByteReader * reader, guint size, guint8 ** val) * * // Assume the reader contains 0x00 0x01 0x02 ... 0xfe 0xff * - * gst_byte_reader_masked_scan_uint32 (reader, 0x00010203, 0xffffffff, 0, 256); + * gst_byte_reader_masked_scan_uint32 (reader, 0xffffffff, 0x00010203, 0, 256); * // -> returns 0 - * gst_byte_reader_masked_scan_uint32 (reader, 0x00010203, 0xffffffff, 1, 255); + * gst_byte_reader_masked_scan_uint32 (reader, 0xffffffff, 0x00010203, 1, 255); * // -> returns -1 - * gst_byte_reader_masked_scan_uint32 (reader, 0x01020304, 0xffffffff, 1, 255); + * gst_byte_reader_masked_scan_uint32 (reader, 0xffffffff, 0x01020304, 1, 255); * // -> returns 1 - * gst_byte_reader_masked_scan_uint32 (reader, 0x0001, 0xffff, 0, 256); + * gst_byte_reader_masked_scan_uint32 (reader, 0xffff, 0x0001, 0, 256); * // -> returns -1 - * gst_byte_reader_masked_scan_uint32 (reader, 0x0203, 0xffff, 0, 256); + * gst_byte_reader_masked_scan_uint32 (reader, 0xffff, 0x0203, 0, 256); * // -> returns 0 - * gst_byte_reader_masked_scan_uint32 (reader, 0x02030000, 0xffff0000, 0, 256); + * gst_byte_reader_masked_scan_uint32 (reader, 0xffff0000, 0x02030000, 0, 256); * // -> returns 2 - * gst_byte_reader_masked_scan_uint32 (reader, 0x02030000, 0xffff0000, 0, 4); + * gst_byte_reader_masked_scan_uint32 (reader, 0xffff0000, 0x02030000, 0, 4); * // -> returns -1 * * -- 2.7.4