diff --git a/src/base64.cc b/src/base64.cc index 9b275d7..aeb0b6b 100644 --- a/src/base64.cc +++ b/src/base64.cc @@ -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; } } diff --git a/src/cli.cc b/src/cli.cc index 072f6ec..0635d30 100644 --- a/src/cli.cc +++ b/src/cli.cc @@ -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); diff --git a/src/ogg.cc b/src/ogg.cc index c19f226..21bce59 100644 --- a/src/ogg.cc +++ b/src/ogg.cc @@ -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."}; diff --git a/src/opustags.h b/src/opustags.h index 520ffa1..ec41596 100644 --- a/src/opustags.h +++ b/src/opustags.h @@ -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.