Commit 4b2b89eb authored by Max Kellermann's avatar Max Kellermann

lib/xiph: add "noexcept"

parent 4b2bb883
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <stdint.h> #include <stdint.h>
static size_t static size_t
ReadPage(const ogg_page &page, void *_buffer, size_t size) ReadPage(const ogg_page &page, void *_buffer, size_t size) noexcept
{ {
assert(page.header_len > 0 || page.body_len > 0); assert(page.header_len > 0 || page.body_len > 0);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
static std::atomic_uint next_ogg_serial; static std::atomic_uint next_ogg_serial;
int int
GenerateOggSerial() GenerateOggSerial() noexcept
{ {
unsigned serial = ++next_ogg_serial; unsigned serial = ++next_ogg_serial;
if (gcc_unlikely(serial < 16)) { if (gcc_unlikely(serial < 16)) {
......
...@@ -24,6 +24,6 @@ ...@@ -24,6 +24,6 @@
* Generate the next pseudo-random Ogg serial. * Generate the next pseudo-random Ogg serial.
*/ */
int int
GenerateOggSerial(); GenerateOggSerial() noexcept;
#endif #endif
...@@ -32,7 +32,7 @@ class OggStreamState { ...@@ -32,7 +32,7 @@ class OggStreamState {
ogg_stream_state state; ogg_stream_state state;
public: public:
explicit OggStreamState(int serialno) { explicit OggStreamState(int serialno) noexcept {
ogg_stream_init(&state, serialno); ogg_stream_init(&state, serialno);
} }
...@@ -40,53 +40,53 @@ public: ...@@ -40,53 +40,53 @@ public:
* Initialize a decoding #ogg_stream_state with the first * Initialize a decoding #ogg_stream_state with the first
* page. * page.
*/ */
explicit OggStreamState(ogg_page &page) { explicit OggStreamState(ogg_page &page) noexcept {
ogg_stream_init(&state, ogg_page_serialno(&page)); ogg_stream_init(&state, ogg_page_serialno(&page));
PageIn(page); PageIn(page);
} }
~OggStreamState() { ~OggStreamState() noexcept {
ogg_stream_clear(&state); ogg_stream_clear(&state);
} }
operator ogg_stream_state &() { operator ogg_stream_state &() noexcept {
return state; return state;
} }
void Reinitialize(int serialno) { void Reinitialize(int serialno) noexcept {
ogg_stream_reset_serialno(&state, serialno); ogg_stream_reset_serialno(&state, serialno);
} }
long GetSerialNo() const { long GetSerialNo() const noexcept {
return state.serialno; return state.serialno;
} }
void Reset() { void Reset() noexcept {
ogg_stream_reset(&state); ogg_stream_reset(&state);
} }
/* encoding */ /* encoding */
void PacketIn(const ogg_packet &packet) { void PacketIn(const ogg_packet &packet) noexcept {
ogg_stream_packetin(&state, ogg_stream_packetin(&state,
const_cast<ogg_packet *>(&packet)); const_cast<ogg_packet *>(&packet));
} }
bool PageOut(ogg_page &page) { bool PageOut(ogg_page &page) noexcept {
return ogg_stream_pageout(&state, &page) != 0; return ogg_stream_pageout(&state, &page) != 0;
} }
bool Flush(ogg_page &page) { bool Flush(ogg_page &page) noexcept {
return ogg_stream_flush(&state, &page) != 0; return ogg_stream_flush(&state, &page) != 0;
} }
/* decoding */ /* decoding */
bool PageIn(ogg_page &page) { bool PageIn(ogg_page &page) noexcept {
return ogg_stream_pagein(&state, &page) == 0; return ogg_stream_pagein(&state, &page) == 0;
} }
int PacketOut(ogg_packet &packet) { int PacketOut(ogg_packet &packet) noexcept {
return ogg_stream_packetout(&state, &packet); return ogg_stream_packetout(&state, &packet);
} }
}; };
......
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
OggSyncState(const OggSyncState &) = delete; OggSyncState(const OggSyncState &) = delete;
OggSyncState &operator=(const OggSyncState &) = delete; OggSyncState &operator=(const OggSyncState &) = delete;
void Reset() { void Reset() noexcept {
ogg_sync_reset(&oy); ogg_sync_reset(&oy);
} }
......
...@@ -31,26 +31,26 @@ class VorbisComment { ...@@ -31,26 +31,26 @@ class VorbisComment {
vorbis_comment vc; vorbis_comment vc;
public: public:
VorbisComment() { VorbisComment() noexcept {
vorbis_comment_init(&vc); vorbis_comment_init(&vc);
} }
~VorbisComment() { ~VorbisComment() noexcept {
vorbis_comment_clear(&vc); vorbis_comment_clear(&vc);
} }
VorbisComment(const VorbisComment &) = delete; VorbisComment(const VorbisComment &) = delete;
VorbisComment &operator=(const VorbisComment &) = delete; VorbisComment &operator=(const VorbisComment &) = delete;
operator vorbis_comment &() { operator vorbis_comment &() noexcept {
return vc; return vc;
} }
operator vorbis_comment *() { operator vorbis_comment *() noexcept {
return &vc; return &vc;
} }
void AddTag(const char *tag, const char *contents) { void AddTag(const char *tag, const char *contents) noexcept {
vorbis_comment_add_tag(&vc, tag, contents); vorbis_comment_add_tag(&vc, tag, contents);
} }
}; };
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "util/DivideString.hxx" #include "util/DivideString.hxx"
bool bool
vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments) vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments) noexcept
{ {
rgi.Clear(); rgi.Clear();
...@@ -100,7 +100,7 @@ vorbis_comments_scan(char **comments, ...@@ -100,7 +100,7 @@ vorbis_comments_scan(char **comments,
} }
Tag * Tag *
vorbis_comments_to_tag(char **comments) vorbis_comments_to_tag(char **comments) noexcept
{ {
TagBuilder tag_builder; TagBuilder tag_builder;
vorbis_comments_scan(comments, add_tag_handler, &tag_builder); vorbis_comments_scan(comments, add_tag_handler, &tag_builder);
......
...@@ -27,13 +27,13 @@ struct TagHandler; ...@@ -27,13 +27,13 @@ struct TagHandler;
struct Tag; struct Tag;
bool bool
vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments); vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments) noexcept;
void void
vorbis_comments_scan(char **comments, vorbis_comments_scan(char **comments,
const TagHandler &handler, void *handler_ctx); const TagHandler &handler, void *handler_ctx);
Tag * Tag *
vorbis_comments_to_tag(char **comments); vorbis_comments_to_tag(char **comments) noexcept;
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment