mirror of
https://github.com/fmang/opustags.git
synced 2025-07-13 20:45:26 +02:00
Sanitize implicit conversions
Now, clang’s sanitizers do not report any warning when running the test suite with `-fsanitize=address,undefined,implicit-conversion`.
This commit is contained in:
@ -84,11 +84,11 @@ ot::byte_string ot::decode_base64(std::u8string_view src)
|
||||
|
||||
block[count++] = tmp;
|
||||
if (count == 2) {
|
||||
*pos++ = (block[0] << 2) | (block[1] >> 4);
|
||||
*pos++ = 0xFF & (block[0] << 2) | (block[1] >> 4);
|
||||
} else if (count == 3) {
|
||||
*pos++ = (block[1] << 4) | (block[2] >> 2);
|
||||
*pos++ = 0xFF & (block[1] << 4) | (block[2] >> 2);
|
||||
} else if (count == 4) {
|
||||
*pos++ = (block[2] << 6) | block[3];
|
||||
*pos++ = 0xFF & (block[2] << 6) | block[3];
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
@ -503,7 +503,7 @@ static void process(ot::ogg_reader& reader, ot::ogg_writer* writer, const ot::op
|
||||
* output stream, we need to renumber all the succeeding pages. If the input stream
|
||||
* contains gaps, the offset will naively reproduce the gaps: page numbers 0 (1) 2 4 will
|
||||
* become 0 (1 2) 3 5, where (…) is the OpusTags packet, and not 0 (1 2) 3 4. */
|
||||
int pageno_offset = 0;
|
||||
long pageno_offset = 0;
|
||||
|
||||
while (reader.next_page()) {
|
||||
auto serialno = ogg_page_serialno(&reader.page);
|
||||
|
@ -28,8 +28,8 @@ bool ot::ogg_reader::next_page()
|
||||
while ((rc = ogg_sync_pageout(&sync, &page)) != 1) {
|
||||
if (rc == -1) {
|
||||
throw status {st::bad_stream,
|
||||
absolute_page_no == (size_t) -1 ? "Input is not a valid Ogg file."
|
||||
: "Unsynced data in stream."};
|
||||
absolute_page_no == -1 ? "Input is not a valid Ogg file."
|
||||
: "Unsynced data in stream."};
|
||||
}
|
||||
if (ogg_sync_check(&sync) != 0)
|
||||
throw status {st::libogg_error, "ogg_sync_check signalled an error."};
|
||||
|
@ -266,10 +266,9 @@ struct ogg_reader {
|
||||
ogg_page page;
|
||||
/**
|
||||
* Page number in the physical stream of the last read page, disregarding multiplexed
|
||||
* streams. The first page number is 0. When no page has been read, its value is
|
||||
* (size_t) -1.
|
||||
* streams. The first page number is 0. When no page has been read, its value is -1.
|
||||
*/
|
||||
size_t absolute_page_no = -1;
|
||||
long absolute_page_no = -1;
|
||||
/**
|
||||
* The file is our source of binary data. It is not integrated to libogg, so we need to
|
||||
* handle it ourselves.
|
||||
|
Reference in New Issue
Block a user