summaryrefslogtreecommitdiff
path: root/gio/src/memoryinputstream.ccg
diff options
context:
space:
mode:
Diffstat (limited to 'gio/src/memoryinputstream.ccg')
-rw-r--r--gio/src/memoryinputstream.ccg26
1 files changed, 15 insertions, 11 deletions
diff --git a/gio/src/memoryinputstream.ccg b/gio/src/memoryinputstream.ccg
index 72ceb52a..e8965282 100644
--- a/gio/src/memoryinputstream.ccg
+++ b/gio/src/memoryinputstream.ccg
@@ -26,9 +26,9 @@ class SlotWithData
{
public:
SlotWithData(const Gio::MemoryInputStream::SlotDestroyData& slot, void* data)
- :
- m_slot(new Gio::MemoryInputStream::SlotDestroyData(slot)), m_data(data)
- { }
+ : m_slot(new Gio::MemoryInputStream::SlotDestroyData(slot)), m_data(data)
+ {
+ }
~SlotWithData() { delete m_slot; }
@@ -39,7 +39,8 @@ private:
void* m_data;
};
-void destroy_data_callback(void* user_data)
+void
+destroy_data_callback(void* user_data)
{
auto slot_with_data = static_cast<SlotWithData*>(user_data);
g_return_if_fail(slot_with_data != nullptr);
@@ -62,27 +63,30 @@ namespace Gio
{
_DEPRECATE_IFDEF_START
-void MemoryInputStream::add_data(const std::string& data)
+void
+MemoryInputStream::add_data(const std::string& data)
{
- char *data_copy = g_strdup (data.c_str ());
+ char* data_copy = g_strdup(data.c_str());
g_memory_input_stream_add_data(gobj(), data_copy, -1, g_free);
}
-void MemoryInputStream::add_data(const void* data, gssize len)
+void
+MemoryInputStream::add_data(const void* data, gssize len)
{
- char *data_copy = nullptr;
+ char* data_copy = nullptr;
// copy the data so that the caller doesn't need to keep the data alive
if (len < 0)
- data_copy = g_strdup (static_cast<const gchar*>(data));
+ data_copy = g_strdup(static_cast<const gchar*>(data));
else
- data_copy = static_cast<gchar*>(g_memdup (data, len));
+ data_copy = static_cast<gchar*>(g_memdup(data, len));
g_memory_input_stream_add_data(gobj(), data_copy, len, g_free);
}
_DEPRECATE_IFDEF_END
-void MemoryInputStream::add_data(const void* data, gssize len, const SlotDestroyData& destroy_slot)
+void
+MemoryInputStream::add_data(const void* data, gssize len, const SlotDestroyData& destroy_slot)
{
auto slot_with_data = new SlotWithData(destroy_slot, const_cast<void*>(data));
auto bytes = g_bytes_new_with_free_func(data, len, &destroy_data_callback, slot_with_data);