style fixes

missing newlines
nullptr instead of NULL
bracket tweak
This commit is contained in:
Frédéric Mangano
2016-02-24 09:55:23 +01:00
committed by Frédéric Mangano
parent 326c164e09
commit 12327e6f68
5 changed files with 13 additions and 10 deletions

View File

@ -7,7 +7,7 @@ void opustags::list_tags(ogg::Decoder &dec, TagsHandler &handler)
ogg::Stream *s;
while (!handler.done()) {
s = dec.read_page();
if (s == NULL)
if (s == nullptr)
break; // end of stream
switch (s->state) {
case ogg::HEADER_READY:
@ -29,7 +29,7 @@ void opustags::edit_tags(ogg::Decoder &in, ogg::Encoder &out, TagsHandler &handl
ogg::Stream *s;
while (true) {
s = in.read_page();
if (s == NULL)
if (s == nullptr)
break; // end of stream
switch (s->state) {

View File

@ -8,7 +8,8 @@ namespace opustags {
// TagsHandler define various operations related to tags and stream in
// order to control the main loop.
// In its implementation, it is expected to receive an option structure.
struct TagsHandler {
struct TagsHandler
{
// Irrelevant streams don't even need to be parsed, so we can save some
// effort with this method.

View File

@ -62,6 +62,7 @@ void ogg::Stream::handle_packet(const ogg_packet &op)
parse_tags(op);
// else shrug
}
void ogg::Stream::parse_header(const ogg_packet &op)
{
// TODO
@ -97,7 +98,7 @@ ogg::Decoder::~Decoder()
ogg_sync_clear(&sync);
}
ogg::Stream* ogg::Decoder::read_page()
ogg::Stream *ogg::Decoder::read_page()
{
while (page_out()) {
int streamno = ogg_page_serialno(&current_page);
@ -109,7 +110,7 @@ ogg::Stream* ogg::Decoder::read_page()
if (i->second.page_in(current_page))
return &(i->second);
}
return NULL; // end of stream
return nullptr; // end of stream
}
// Read the next page and return true on success, false on end of stream.
@ -137,7 +138,7 @@ bool ogg::Decoder::buff()
if (input->eof())
return false;
char *buf = ogg_sync_buffer(&sync, 65536);
if (buf == NULL)
if (buf == nullptr)
throw std::runtime_error("ogg_sync_buffer failed");
input->read(buf, 65536);
ogg_sync_wrote(&sync, input->gcount());
@ -184,6 +185,7 @@ void ogg::Encoder::forward_stream(ogg::Stream &in, ogg::Stream &out)
}
}
}
void ogg::Encoder::flush_stream(ogg::Stream &out)
{
ogg_page og;
@ -193,8 +195,8 @@ void ogg::Encoder::flush_stream(ogg::Stream &out)
void ogg::Encoder::write_raw_page(const ogg_page &og)
{
output->write((const char*) og.header, og.header_len);
output->write((const char*) og.body, og.body_len);
output->write(reinterpret_cast<const char*>(og.header), og.header_len);
output->write(reinterpret_cast<const char*>(og.body), og.body_len);
}
void ogg::Encoder::write_tags(int streamno, const Tags&)

View File

@ -77,7 +77,7 @@ namespace ogg
// The read page is given to Stream::page_in before this function
// returns.
// After the end of the file is reached, it returns NULL.
Stream* read_page();
Stream *read_page();
std::istream *input;

View File

@ -30,7 +30,7 @@ Options opustags::parse_args(const int argc, char **argv)
{"set", required_argument, 0, 's'},
{"delete-all", no_argument, 0, 'D'},
{"set-all", no_argument, 0, 'S'},
{NULL, 0, 0, 0}
{nullptr, 0, 0, 0}
};
Options options;