lib/xiph: add "noexcept"

This commit is contained in:
Max Kellermann 2017-11-12 18:35:49 +01:00
parent 4b2bb88375
commit 4b2b89eb5e
8 changed files with 25 additions and 25 deletions

View File

@ -29,7 +29,7 @@
#include <stdint.h>
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);

View File

@ -26,7 +26,7 @@
static std::atomic_uint next_ogg_serial;
int
GenerateOggSerial()
GenerateOggSerial() noexcept
{
unsigned serial = ++next_ogg_serial;
if (gcc_unlikely(serial < 16)) {

View File

@ -24,6 +24,6 @@
* Generate the next pseudo-random Ogg serial.
*/
int
GenerateOggSerial();
GenerateOggSerial() noexcept;
#endif

View File

@ -32,7 +32,7 @@ class OggStreamState {
ogg_stream_state state;
public:
explicit OggStreamState(int serialno) {
explicit OggStreamState(int serialno) noexcept {
ogg_stream_init(&state, serialno);
}
@ -40,53 +40,53 @@ public:
* Initialize a decoding #ogg_stream_state with the first
* page.
*/
explicit OggStreamState(ogg_page &page) {
explicit OggStreamState(ogg_page &page) noexcept {
ogg_stream_init(&state, ogg_page_serialno(&page));
PageIn(page);
}
~OggStreamState() {
~OggStreamState() noexcept {
ogg_stream_clear(&state);
}
operator ogg_stream_state &() {
operator ogg_stream_state &() noexcept {
return state;
}
void Reinitialize(int serialno) {
void Reinitialize(int serialno) noexcept {
ogg_stream_reset_serialno(&state, serialno);
}
long GetSerialNo() const {
long GetSerialNo() const noexcept {
return state.serialno;
}
void Reset() {
void Reset() noexcept {
ogg_stream_reset(&state);
}
/* encoding */
void PacketIn(const ogg_packet &packet) {
void PacketIn(const ogg_packet &packet) noexcept {
ogg_stream_packetin(&state,
const_cast<ogg_packet *>(&packet));
}
bool PageOut(ogg_page &page) {
bool PageOut(ogg_page &page) noexcept {
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;
}
/* decoding */
bool PageIn(ogg_page &page) {
bool PageIn(ogg_page &page) noexcept {
return ogg_stream_pagein(&state, &page) == 0;
}
int PacketOut(ogg_packet &packet) {
int PacketOut(ogg_packet &packet) noexcept {
return ogg_stream_packetout(&state, &packet);
}
};

View File

@ -49,7 +49,7 @@ public:
OggSyncState(const OggSyncState &) = delete;
OggSyncState &operator=(const OggSyncState &) = delete;
void Reset() {
void Reset() noexcept {
ogg_sync_reset(&oy);
}

View File

@ -31,26 +31,26 @@ class VorbisComment {
vorbis_comment vc;
public:
VorbisComment() {
VorbisComment() noexcept {
vorbis_comment_init(&vc);
}
~VorbisComment() {
~VorbisComment() noexcept {
vorbis_comment_clear(&vc);
}
VorbisComment(const VorbisComment &) = delete;
VorbisComment &operator=(const VorbisComment &) = delete;
operator vorbis_comment &() {
operator vorbis_comment &() noexcept {
return vc;
}
operator vorbis_comment *() {
operator vorbis_comment *() noexcept {
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);
}
};

View File

@ -29,7 +29,7 @@
#include "util/DivideString.hxx"
bool
vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments)
vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments) noexcept
{
rgi.Clear();
@ -100,7 +100,7 @@ vorbis_comments_scan(char **comments,
}
Tag *
vorbis_comments_to_tag(char **comments)
vorbis_comments_to_tag(char **comments) noexcept
{
TagBuilder tag_builder;
vorbis_comments_scan(comments, add_tag_handler, &tag_builder);

View File

@ -27,13 +27,13 @@ struct TagHandler;
struct Tag;
bool
vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments);
vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments) noexcept;
void
vorbis_comments_scan(char **comments,
const TagHandler &handler, void *handler_ctx);
Tag *
vorbis_comments_to_tag(char **comments);
vorbis_comments_to_tag(char **comments) noexcept;
#endif