diff options
Diffstat (limited to 'gio')
-rw-r--r-- | gio/src/application.ccg | 2 | ||||
-rw-r--r-- | gio/src/dbusconnection.ccg | 52 | ||||
-rw-r--r-- | gio/src/dbusproxy.ccg | 50 | ||||
-rw-r--r-- | gio/src/dbusserver.ccg | 22 | ||||
-rw-r--r-- | gio/src/file.ccg | 38 | ||||
-rw-r--r-- | gio/src/resolver.ccg | 6 |
6 files changed, 78 insertions, 92 deletions
diff --git a/gio/src/application.ccg b/gio/src/application.ccg index c7488acc..5331887d 100644 --- a/gio/src/application.ccg +++ b/gio/src/application.ccg @@ -272,7 +272,7 @@ Application::Application(const Glib::ustring& application_id, ApplicationFlags f // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(nullptr), Glib::Object(Glib::ConstructParams(custom_class_init(), "application_id", - (application_id.empty() ? nullptr : application_id.c_str()), + Glib::c_str_or_nullptr(application_id), "flags", ((GApplicationFlags)(flags)), nullptr)) { diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg index 9397525d..113a7758 100644 --- a/gio/src/dbusconnection.ccg +++ b/gio/src/dbusconnection.ccg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -104,7 +102,7 @@ Connection::Connection(const Glib::RefPtr<IOStream>& stream, ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", Glib::unwrap(observer)) { @@ -118,7 +116,7 @@ Connection::Connection(const Glib::RefPtr<IOStream>& stream, ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr)) { @@ -132,7 +130,7 @@ Connection::Connection(const Glib::RefPtr<IOStream>& stream, ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", Glib::unwrap(observer)) { @@ -145,7 +143,7 @@ Connection::Connection(const Glib::RefPtr<IOStream>& stream, ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr)) { @@ -158,7 +156,7 @@ Connection::Connection(const std::string& address, const Glib::RefPtr<Cancellable>& cancellable, ConnectionFlags flags) : - _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()), + _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", Glib::unwrap(observer)) { @@ -170,7 +168,7 @@ Connection::Connection(const std::string& address, const Glib::RefPtr<Cancellable>& cancellable, ConnectionFlags flags) : - _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()), + _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr)) { @@ -182,7 +180,7 @@ Connection::Connection(const std::string& address, const SlotAsyncReady& slot, ConnectionFlags flags) : - _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()), + _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", Glib::unwrap(observer)) { @@ -193,7 +191,7 @@ Connection::Connection(const std::string& address, const SlotAsyncReady& slot, ConnectionFlags flags) : - _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()), + _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr)) { @@ -207,7 +205,7 @@ Connection::Connection(const Glib::RefPtr<IOStream>& stream, ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", Glib::unwrap(observer)) { @@ -220,7 +218,7 @@ Connection::Connection(const Glib::RefPtr<IOStream>& stream, ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr)) { @@ -233,7 +231,7 @@ Connection::Connection(const Glib::RefPtr<IOStream>& stream, ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", Glib::unwrap(observer)) { @@ -245,7 +243,7 @@ Connection::Connection(const Glib::RefPtr<IOStream>& stream, ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr)) { @@ -257,7 +255,7 @@ Connection::Connection(const std::string& address, const Glib::RefPtr<Cancellable>& cancellable, ConnectionFlags flags) : - _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()), + _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", Glib::unwrap(observer)) { @@ -268,7 +266,7 @@ Connection::Connection(const std::string& address, const Glib::RefPtr<Cancellable>& cancellable, ConnectionFlags flags) : - _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()), + _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr)) { @@ -279,7 +277,7 @@ Connection::Connection(const std::string& address, const Glib::RefPtr<AuthObserver>& observer, ConnectionFlags flags) : - _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()), + _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", Glib::unwrap(observer)) { @@ -289,7 +287,7 @@ Connection::Connection(const std::string& address, Connection::Connection(const std::string& address, ConnectionFlags flags) : - _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()), + _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusConnectionFlags>(flags), "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr)) { @@ -786,10 +784,10 @@ void Connection::emit_signal( // the bus name can be nullptr in the C API meaning that the signal should be // emitted to all the listeners. g_dbus_connection_emit_signal(gobj(), - (destination_bus_name.empty() ? nullptr : destination_bus_name.c_str()), - (object_path.empty()? nullptr : object_path.c_str()), - (interface_name.empty() ? nullptr : interface_name.c_str()), - (signal_name.empty() ? nullptr : signal_name.c_str()), + Glib::c_str_or_nullptr(destination_bus_name), + Glib::c_str_or_nullptr(object_path), + Glib::c_str_or_nullptr(interface_name), + Glib::c_str_or_nullptr(signal_name), const_cast<GVariant*>(parameters.gobj()), &gerror); if(gerror) @@ -808,11 +806,11 @@ guint Connection::signal_subscribe( auto slot_copy = new SlotSignal(slot); return g_dbus_connection_signal_subscribe(gobj(), - (sender.empty() ? nullptr : sender.c_str()), - (interface_name.empty() ? nullptr : interface_name.c_str()), - (member.empty() ? nullptr : member.c_str()), - (object_path.empty() ? nullptr : object_path.c_str()), - (arg0.empty() ? nullptr : arg0.c_str()), + Glib::c_str_or_nullptr(sender), + Glib::c_str_or_nullptr(interface_name), + Glib::c_str_or_nullptr(member), + Glib::c_str_or_nullptr(object_path), + Glib::c_str_or_nullptr(arg0), static_cast<GDBusSignalFlags>(flags), &DBusConnection_Signal_giomm_callback, slot_copy, &DBusConnection_Signal_giomm_callback_destroy); diff --git a/gio/src/dbusproxy.ccg b/gio/src/dbusproxy.ccg index 5e9874e5..aac660ec 100644 --- a/gio/src/dbusproxy.ccg +++ b/gio/src/dbusproxy.ccg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -47,9 +45,9 @@ Proxy::Proxy(const Glib::RefPtr<Connection>& connection, _CONSTRUCT("g-connection", Glib::unwrap(connection), "g-flags", static_cast<GDBusProxyFlags>(flags), "g-interface-info", Glib::unwrap(info), - "g-name", (name.empty() ? nullptr : name.c_str()), - "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()), - "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str())) + "g-name", Glib::c_str_or_nullptr(name), + "g-object-path", Glib::c_str_or_nullptr(object_path), + "g-interface-name", Glib::c_str_or_nullptr(interface_name)) { init_async(slot, cancellable); } @@ -65,9 +63,9 @@ Proxy::Proxy(const Glib::RefPtr<Connection>& connection, _CONSTRUCT("g-connection", Glib::unwrap(connection), "g-flags", static_cast<GDBusProxyFlags>(flags), "g-interface-info", Glib::unwrap(info), - "g-name", (name.empty() ? nullptr : name.c_str()), - "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()), - "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str())) + "g-name", Glib::c_str_or_nullptr(name), + "g-object-path", Glib::c_str_or_nullptr(object_path), + "g-interface-name", Glib::c_str_or_nullptr(interface_name)) { init_async(slot); } @@ -83,9 +81,9 @@ Proxy::Proxy(const Glib::RefPtr<Connection>& connection, _CONSTRUCT("g-connection", Glib::unwrap(connection), "g-flags", static_cast<GDBusProxyFlags>(flags), "g-interface-info", Glib::unwrap(info), - "g-name", (name.empty() ? nullptr : name.c_str()), - "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()), - "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str())) + "g-name", Glib::c_str_or_nullptr(name), + "g-object-path", Glib::c_str_or_nullptr(object_path), + "g-interface-name", Glib::c_str_or_nullptr(interface_name)) { init(cancellable); } @@ -100,9 +98,9 @@ Proxy::Proxy(const Glib::RefPtr<Connection>& connection, _CONSTRUCT("g-connection", Glib::unwrap(connection), "g-flags", static_cast<GDBusProxyFlags>(flags), "g-interface-info", Glib::unwrap(info), - "g-name", (name.empty() ? nullptr : name.c_str()), - "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()), - "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str())) + "g-name", Glib::c_str_or_nullptr(name), + "g-object-path", Glib::c_str_or_nullptr(object_path), + "g-interface-name", Glib::c_str_or_nullptr(interface_name)) { init(); } @@ -119,9 +117,9 @@ Proxy::Proxy(BusType bus_type, _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), "g-flags", static_cast<GDBusProxyFlags>(flags), "g-interface-info", Glib::unwrap(info), - "g-name", (name.empty() ? nullptr : name.c_str()), - "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()), - "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str())) + "g-name", Glib::c_str_or_nullptr(name), + "g-object-path", Glib::c_str_or_nullptr(object_path), + "g-interface-name", Glib::c_str_or_nullptr(interface_name)) { init_async(slot, cancellable); } @@ -137,9 +135,9 @@ Proxy::Proxy(BusType bus_type, _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), "g-flags", static_cast<GDBusProxyFlags>(flags), "g-interface-info", Glib::unwrap(info), - "g-name", (name.empty() ? nullptr : name.c_str()), - "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()), - "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str())) + "g-name", Glib::c_str_or_nullptr(name), + "g-object-path", Glib::c_str_or_nullptr(object_path), + "g-interface-name", Glib::c_str_or_nullptr(interface_name)) { init_async(slot); } @@ -155,9 +153,9 @@ Proxy::Proxy(BusType bus_type, _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), "g-flags", static_cast<GDBusProxyFlags>(flags), "g-interface-info", Glib::unwrap(info), - "g-name", (name.empty() ? nullptr : name.c_str()), - "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()), - "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str())) + "g-name", Glib::c_str_or_nullptr(name), + "g-object-path", Glib::c_str_or_nullptr(object_path), + "g-interface-name", Glib::c_str_or_nullptr(interface_name)) { init(cancellable); } @@ -172,9 +170,9 @@ Proxy::Proxy(BusType bus_type, _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), "g-flags", static_cast<GDBusProxyFlags>(flags), "g-interface-info", Glib::unwrap(info), - "g-name", (name.empty() ? nullptr : name.c_str()), - "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()), - "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str())) + "g-name", Glib::c_str_or_nullptr(name), + "g-object-path", Glib::c_str_or_nullptr(object_path), + "g-interface-name", Glib::c_str_or_nullptr(interface_name)) { init(); } diff --git a/gio/src/dbusserver.ccg b/gio/src/dbusserver.ccg index e726a16e..36c8af08 100644 --- a/gio/src/dbusserver.ccg +++ b/gio/src/dbusserver.ccg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -34,10 +32,9 @@ Server::Server(const std::string& address, const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, ServerFlags flags) - : _CONSTRUCT("address", - (address.empty() ? nullptr : address.c_str()), + : _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusServerFlags>(flags), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "authentication-observer", Glib::unwrap(observer)) { init(cancellable); @@ -47,10 +44,9 @@ Server::Server(const std::string& address, const std::string& guid, const Glib::RefPtr<Cancellable>& cancellable, ServerFlags flags) - : _CONSTRUCT("address", - (address.empty() ? nullptr : address.c_str()), + : _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusServerFlags>(flags), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr)) { init(cancellable); @@ -60,10 +56,9 @@ Server::Server(const std::string& address, const std::string& guid, const Glib::RefPtr<AuthObserver>& observer, ServerFlags flags) - : _CONSTRUCT("address", - (address.empty() ? nullptr : address.c_str()), + : _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusServerFlags>(flags), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "authentication-observer", Glib::unwrap(observer)) { init(); @@ -72,10 +67,9 @@ Server::Server(const std::string& address, Server::Server(const std::string& address, const std::string& guid, ServerFlags flags) - : _CONSTRUCT("address", - (address.empty() ? nullptr : address.c_str()), + : _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast<GDBusServerFlags>(flags), - "guid", (guid.empty() ? nullptr : guid.c_str()), + "guid", Glib::c_str_or_nullptr(guid), "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr)) { init(); diff --git a/gio/src/file.ccg b/gio/src/file.ccg index 81315aba..0aeb8ba4 100644 --- a/gio/src/file.ccg +++ b/gio/src/file.ccg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -340,7 +338,7 @@ File::replace_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); g_file_replace_async(gobj(), - etag.empty() ? nullptr : etag.c_str(), + Glib::c_str_or_nullptr(etag), make_backup, static_cast<GFileCreateFlags>(flags), io_priority, @@ -358,7 +356,7 @@ File::replace_async(const SlotAsyncReady& slot, const std::string& etag, bool ma SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); g_file_replace_async(gobj(), - etag.empty() ? nullptr : etag.c_str(), + Glib::c_str_or_nullptr(etag), make_backup, static_cast<GFileCreateFlags>(flags), io_priority, @@ -406,7 +404,7 @@ File::replace_readwrite_async(const SlotAsyncReady& slot, const Glib::RefPtr<Can SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); g_file_replace_readwrite_async(gobj(), - etag.empty() ? nullptr : etag.c_str(), + Glib::c_str_or_nullptr(etag), make_backup, static_cast<GFileCreateFlags>(flags), io_priority, @@ -424,7 +422,7 @@ File::replace_readwrite_async(const SlotAsyncReady& slot, const std::string& eta SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); g_file_replace_readwrite_async(gobj(), - etag.empty() ? nullptr : etag.c_str(), + Glib::c_str_or_nullptr(etag), make_backup, static_cast<GFileCreateFlags>(flags), io_priority, @@ -1284,7 +1282,7 @@ void File::replace_contents(const char* contents, gsize length, const std::strin { GError* gerror = nullptr; gchar* c_etag_new = nullptr; - g_file_replace_contents(gobj(), contents, length, etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)); + g_file_replace_contents(gobj(), contents, length, Glib::c_str_or_nullptr(etag), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -1298,7 +1296,7 @@ void File::replace_contents(const char* contents, gsize length, const std::strin { GError* gerror = nullptr; gchar* c_etag_new = nullptr; - g_file_replace_contents(gobj(), contents, length, etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, nullptr, &(gerror)); + g_file_replace_contents(gobj(), contents, length, Glib::c_str_or_nullptr(etag), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, nullptr, &(gerror)); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -1312,7 +1310,7 @@ void File::replace_contents(const std::string& contents, const std::string& etag { GError* gerror = nullptr; gchar* c_etag_new = nullptr; - g_file_replace_contents(gobj(), contents.c_str(), contents.size(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)); + g_file_replace_contents(gobj(), contents.c_str(), contents.size(), Glib::c_str_or_nullptr(etag), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -1326,7 +1324,7 @@ void File::replace_contents(const std::string& contents, const std::string& etag { GError* gerror = nullptr; gchar* c_etag_new = nullptr; - g_file_replace_contents(gobj(), contents.c_str(), contents.size(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, nullptr, &(gerror)); + g_file_replace_contents(gobj(), contents.c_str(), contents.size(), Glib::c_str_or_nullptr(etag), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, nullptr, &(gerror)); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -1353,7 +1351,7 @@ File::replace_contents_async(const SlotAsyncReady& slot, g_file_replace_contents_async(gobj(), contents, length, - etag.empty() ? nullptr : etag.c_str(), + Glib::c_str_or_nullptr(etag), make_backup, static_cast<GFileCreateFlags>(flags), Glib::unwrap(cancellable), @@ -1377,7 +1375,7 @@ File::replace_contents_async(const SlotAsyncReady& slot, g_file_replace_contents_async(gobj(), contents, length, - etag.empty() ? nullptr : etag.c_str(), + Glib::c_str_or_nullptr(etag), make_backup, static_cast<GFileCreateFlags>(flags), nullptr, @@ -1401,7 +1399,7 @@ File::replace_contents_async(const SlotAsyncReady& slot, g_file_replace_contents_async(gobj(), contents.c_str(), contents.size(), - etag.empty() ? nullptr : etag.c_str(), + Glib::c_str_or_nullptr(etag), make_backup, static_cast<GFileCreateFlags>(flags), Glib::unwrap(cancellable), @@ -1424,7 +1422,7 @@ File::replace_contents_async(const SlotAsyncReady& slot, g_file_replace_contents_async(gobj(), contents.c_str(), contents.size(), - etag.empty() ? nullptr : etag.c_str(), + Glib::c_str_or_nullptr(etag), make_backup, static_cast<GFileCreateFlags>(flags), nullptr, @@ -1471,7 +1469,7 @@ File::replace_contents_bytes_async(const SlotAsyncReady& slot, g_file_replace_contents_bytes_async(gobj(), const_cast<GBytes*>(Glib::unwrap(contents)), - etag.empty() ? nullptr : etag.c_str(), + Glib::c_str_or_nullptr(etag), make_backup, static_cast<GFileCreateFlags>(flags), Glib::unwrap(cancellable), @@ -1493,7 +1491,7 @@ File::replace_contents_bytes_async(const SlotAsyncReady& slot, g_file_replace_contents_bytes_async(gobj(), const_cast<GBytes*>(Glib::unwrap(contents)), - etag.empty() ? nullptr : etag.c_str(), + Glib::c_str_or_nullptr(etag), make_backup, static_cast<GFileCreateFlags>(flags), nullptr, @@ -1505,7 +1503,7 @@ File::replace_contents_bytes_async(const SlotAsyncReady& slot, Glib::RefPtr<FileOutputStream> File::replace(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags) { GError* gerror = nullptr; - auto retvalue = Glib::wrap(g_file_replace(gobj(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror))); + auto retvalue = Glib::wrap(g_file_replace(gobj(), Glib::c_str_or_nullptr(etag), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror))); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -1515,7 +1513,7 @@ Glib::RefPtr<FileOutputStream> File::replace(const Glib::RefPtr<Cancellable>& ca Glib::RefPtr<FileOutputStream> File::replace(const std::string& etag, bool make_backup, FileCreateFlags flags) { GError* gerror = nullptr; - auto retvalue = Glib::wrap(g_file_replace(gobj(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), nullptr, &(gerror))); + auto retvalue = Glib::wrap(g_file_replace(gobj(), Glib::c_str_or_nullptr(etag), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), nullptr, &(gerror))); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -1526,7 +1524,7 @@ Glib::RefPtr<FileOutputStream> File::replace(const std::string& etag, bool make_ Glib::RefPtr<FileIOStream> File::replace_readwrite(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags) { GError* gerror = nullptr; - auto retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror))); + auto retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), Glib::c_str_or_nullptr(etag), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror))); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -1536,7 +1534,7 @@ Glib::RefPtr<FileIOStream> File::replace_readwrite(const Glib::RefPtr<Cancellabl Glib::RefPtr<FileIOStream> File::replace_readwrite(const std::string& etag, bool make_backup, FileCreateFlags flags) { GError* gerror = nullptr; - auto retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), nullptr, &(gerror))); + auto retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), Glib::c_str_or_nullptr(etag), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), nullptr, &(gerror))); if(gerror) ::Glib::Error::throw_exception(gerror); diff --git a/gio/src/resolver.ccg b/gio/src/resolver.ccg index 05cb77b6..60d329d8 100644 --- a/gio/src/resolver.ccg +++ b/gio/src/resolver.ccg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2008 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -132,7 +130,7 @@ Resolver::lookup_records_async(const Glib::ustring& rrname, auto slot_copy = new SlotAsyncReady(slot); g_resolver_lookup_records_async(gobj(), - (rrname.empty() ? nullptr : rrname.c_str()), + Glib::c_str_or_nullptr(rrname), static_cast<GResolverRecordType>(record_type), Glib::unwrap(cancellable), &SignalProxy_async_callback, @@ -147,7 +145,7 @@ Resolver::lookup_records_async(const Glib::ustring& rrname, auto slot_copy = new SlotAsyncReady(slot); g_resolver_lookup_records_async(gobj(), - (rrname.empty() ? nullptr : rrname.c_str()), + Glib::c_str_or_nullptr(rrname), static_cast<GResolverRecordType>(record_type), nullptr, &SignalProxy_async_callback, |