summaryrefslogtreecommitdiff
path: root/glib/src/iochannel.ccg
diff options
context:
space:
mode:
Diffstat (limited to 'glib/src/iochannel.ccg')
-rw-r--r--glib/src/iochannel.ccg52
1 files changed, 26 insertions, 26 deletions
diff --git a/glib/src/iochannel.ccg b/glib/src/iochannel.ccg
index d0a18aae..93faefa7 100644
--- a/glib/src/iochannel.ccg
+++ b/glib/src/iochannel.ccg
@@ -50,8 +50,8 @@ public:
ForeignIOChannel(GIOChannel* gobject, bool take_copy)
: Glib::IOChannel(gobject, take_copy), ref_count_(0) {}
- virtual void reference() const;
- virtual void unreference() const;
+ void reference() const override;
+ void unreference() const override;
private:
mutable int ref_count_;
@@ -136,7 +136,7 @@ IOChannel::IOChannel(GIOChannel* gobject, bool take_copy)
gobject_ (gobject)
{
// This ctor should never be called for GlibmmIOChannel instances.
- g_assert(gobject != 0);
+ g_assert(gobject != nullptr);
g_assert(gobject->funcs != &GlibmmIOChannel::vfunc_table);
if(take_copy)
@@ -157,11 +157,11 @@ IOChannel::~IOChannel()
if(gobject_->funcs == &GlibmmIOChannel::vfunc_table)
{
// Disconnect the wrapper object so that it won't be deleted twice.
- reinterpret_cast<GlibmmIOChannel*>(gobject_)->wrapper = 0;
+ reinterpret_cast<GlibmmIOChannel*>(gobject_)->wrapper = nullptr;
}
- GIOChannel *const tmp_gobject = gobject_;
- gobject_ = 0;
+ const auto tmp_gobject = gobject_;
+ gobject_ = nullptr;
g_io_channel_unref(tmp_gobject);
}
@@ -169,8 +169,8 @@ IOChannel::~IOChannel()
Glib::RefPtr<IOChannel> IOChannel::create_from_file(const std::string& filename, const std::string& mode)
{
- GError* gerror = 0;
- GIOChannel *const channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &gerror);
+ GError* gerror = nullptr;
+ const auto channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &gerror);
if(gerror)
{
@@ -208,10 +208,10 @@ IOStatus IOChannel::write(const Glib::ustring& str)
IOStatus IOChannel::read_line(Glib::ustring& line)
{
Glib::ScopedPtr<char> buf;
- GError* gerror = 0;
+ GError* gerror = nullptr;
gsize bytes = 0;
- const GIOStatus status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, 0, &gerror);
+ const auto status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, 0, &gerror);
if(gerror)
{
@@ -229,10 +229,10 @@ IOStatus IOChannel::read_line(Glib::ustring& line)
IOStatus IOChannel::read_to_end(Glib::ustring& str)
{
Glib::ScopedPtr<char> buf;
- GError* gerror = 0;
+ GError* gerror = nullptr;
gsize bytes = 0;
- const GIOStatus status = g_io_channel_read_to_end(gobj(), buf.addr(), &bytes, &gerror);
+ const auto status = g_io_channel_read_to_end(gobj(), buf.addr(), &bytes, &gerror);
if(gerror)
{
@@ -250,10 +250,10 @@ IOStatus IOChannel::read_to_end(Glib::ustring& str)
IOStatus IOChannel::read(Glib::ustring& str, gsize count)
{
Glib::ScopedPtr<char> buf (g_new(char, count));
- GError* gerror = 0;
+ GError* gerror = nullptr;
gsize bytes = 0;
- const GIOStatus status = g_io_channel_read_chars(gobj(), buf.get(), count, &bytes, &gerror);
+ const auto status = g_io_channel_read_chars(gobj(), buf.get(), count, &bytes, &gerror);
if(gerror)
{
@@ -270,9 +270,9 @@ IOStatus IOChannel::read(Glib::ustring& str, gsize count)
IOStatus IOChannel::set_encoding(const std::string& encoding)
{
- GError* gerror = 0;
+ GError* gerror = nullptr;
- const GIOStatus status = g_io_channel_set_encoding(
+ const auto status = g_io_channel_set_encoding(
gobj(), (encoding.empty()) ? 0 : encoding.c_str(), &gerror);
if(gerror)
@@ -367,7 +367,7 @@ void IOChannel::unreference() const
Glib::RefPtr<IOChannel> wrap(GIOChannel* gobject, bool take_copy)
{
- IOChannel* cpp_object = 0;
+ IOChannel* cpp_object = nullptr;
if(gobject)
{
@@ -394,7 +394,7 @@ Glib::RefPtr<IOChannel> wrap(GIOChannel* gobject, bool take_copy)
GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count,
gsize* bytes_read, GError** err)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
@@ -415,7 +415,7 @@ GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count,
GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize count,
gsize* bytes_written, GError** err)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
@@ -435,7 +435,7 @@ GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize
GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** err)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
@@ -455,7 +455,7 @@ GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType
GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
@@ -477,11 +477,11 @@ GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err)
// static
GSource* GlibmmIOChannel::io_create_watch(GIOChannel* channel, GIOCondition condition)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
- const Glib::RefPtr<Source> source = wrapper->create_watch_vfunc((IOCondition) condition);
+ const auto source = wrapper->create_watch_vfunc((IOCondition) condition);
return (source) ? source->gobj_copy() : 0;
}
catch(...)
@@ -497,7 +497,7 @@ void GlibmmIOChannel::io_free(GIOChannel* channel)
{
if(IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper)
{
- wrapper->gobject_ = 0;
+ wrapper->gobject_ = nullptr;
delete wrapper;
}
@@ -506,7 +506,7 @@ void GlibmmIOChannel::io_free(GIOChannel* channel)
GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
@@ -527,7 +527,7 @@ GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GEr
// static
GIOFlags GlibmmIOChannel::io_get_flags(GIOChannel* channel)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{