diff --git a/src/actions.h b/src/actions.h index 9d0ee98..ea462e6 100644 --- a/src/actions.h +++ b/src/actions.h @@ -10,7 +10,7 @@ namespace opustags { // // Use: // std::ifstream in("in.ogg"); - // ogg::Decoder dec(&in); + // ogg::Decoder dec(in); // TagsLister lister(options); // list_tags(dec, lister); // @@ -21,9 +21,9 @@ namespace opustags { // // Use: // std::ifstream in("in.ogg"); - // ogg::Decoder dec(&in); + // ogg::Decoder dec(in); // std::ofstream out("out.ogg"); - // std::Encoder enc(&out); + // std::Encoder enc(out); // TagsEditor editor(options); // edit_tags(dec, enc, editor); // diff --git a/src/ogg.cc b/src/ogg.cc index cc00ced..9bc0684 100644 --- a/src/ogg.cc +++ b/src/ogg.cc @@ -136,10 +136,10 @@ void ogg::Stream::downgrade() //////////////////////////////////////////////////////////////////////////////// // ogg::Decoder -ogg::Decoder::Decoder(std::istream *in) +ogg::Decoder::Decoder(std::istream &in) : input(in) { - input->exceptions(std::ifstream::badbit); + input.exceptions(std::ifstream::badbit); ogg_sync_init(&sync); } @@ -185,23 +185,23 @@ bool ogg::Decoder::page_out() // Read data from the stream into the sync's buffer. bool ogg::Decoder::buff() { - if (input->eof()) + if (input.eof()) return false; char *buf = ogg_sync_buffer(&sync, 65536); if (buf == nullptr) throw std::runtime_error("ogg_sync_buffer failed"); - input->read(buf, 65536); - ogg_sync_wrote(&sync, input->gcount()); + input.read(buf, 65536); + ogg_sync_wrote(&sync, input.gcount()); return true; } //////////////////////////////////////////////////////////////////////////////// // ogg::Encoder -ogg::Encoder::Encoder(std::ostream *out) +ogg::Encoder::Encoder(std::ostream &out) : output(out) { - output->exceptions(std::ifstream::badbit); + output.exceptions(std::ifstream::badbit); } ogg::Stream& ogg::Encoder::get_stream(int streamno) @@ -245,8 +245,8 @@ void ogg::Encoder::flush_stream(ogg::Stream &out) void ogg::Encoder::write_raw_page(const ogg_page &og) { - output->write(reinterpret_cast(og.header), og.header_len); - output->write(reinterpret_cast(og.body), og.body_len); + output.write(reinterpret_cast(og.header), og.header_len); + output.write(reinterpret_cast(og.body), og.body_len); } void ogg::Encoder::write_tags(int streamno, const Tags &tags) diff --git a/src/ogg.h b/src/ogg.h index efa8218..caf56f8 100644 --- a/src/ogg.h +++ b/src/ogg.h @@ -70,7 +70,7 @@ namespace ogg struct Decoder { - Decoder(std::istream*); + Decoder(std::istream&); ~Decoder(); // Read a page, dispatch it, and return the stream it belongs to. @@ -79,7 +79,7 @@ namespace ogg // After the end of the file is reached, it returns NULL. Stream *read_page(); - std::istream *input; + std::istream &input; ogg_sync_state sync; ogg_page current_page; @@ -92,7 +92,7 @@ namespace ogg struct Encoder { - Encoder(std::ostream*); + Encoder(std::ostream&); // Copy the input stream's current page. void forward(Stream &in); @@ -104,7 +104,7 @@ namespace ogg void write_tags(int streamno, const Tags&); - std::ostream *output; + std::ostream &output; // We're gonna need some ogg_stream_state for adjusting the page // numbers and splitting large packets as it's gotta be done.