diff options
author | Mathias Hasselmann <hasselmm@src.gnome.org> | 2007-11-24 14:23:56 +0000 |
---|---|---|
committer | Mathias Hasselmann <hasselmm@src.gnome.org> | 2007-11-24 14:23:56 +0000 |
commit | 0dc0c36381289aaa5cfa5f7374d8c313a710cd33 (patch) | |
tree | 81f203dfdbbf7ff1c0901ccbadef62f1a80cac58 | |
parent | d1f53ac66361d332a6818c4b01c056cd156d9560 (diff) | |
download | totem-0dc0c36381289aaa5cfa5f7374d8c313a710cd33.tar.gz |
Resync with libepc trunk.
* src/plugins/publish/totem-publish.c: Adopt to new memory management.
svn path=/branches/LIBEPC/; revision=4896
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/plugins/publish/totem-publish.c | 24 |
2 files changed, 23 insertions, 7 deletions
@@ -1,3 +1,9 @@ +2007-11-24 Mathias Hasselmann <mathias@openismus.com> + + Resync with libepc trunk. + + * src/plugins/publish/totem-publish.c: Adopt to new memory management. + 2007-11-22 Mathias Hasselmann <mathias@openismus.com> Implement server side of the publish plugin. diff --git a/src/plugins/publish/totem-publish.c b/src/plugins/publish/totem-publish.c index 3190c2f60..76ce330db 100644 --- a/src/plugins/publish/totem-publish.c +++ b/src/plugins/publish/totem-publish.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* * -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Copyright (C) 2007 Openismus GmbH * @@ -174,30 +174,40 @@ totem_publish_plugin_playlist_cb (EpcPublisher *publisher, g_list_free (files); - contents = epc_contents_new ("audio/x-scpls", buffer->str, buffer->len); + contents = epc_contents_new ("audio/x-scpls", + buffer->str, buffer->len, + g_free); + g_string_free (buffer, FALSE); return contents; } -static gpointer +static gboolean totem_publish_plugin_stream_cb (EpcContents *contents, + gpointer buffer, gsize *length, gpointer data) { GnomeVFSHandle *handle = data; GnomeVFSFileSize size = 65536; - gpointer slice = g_malloc (size); - if (GNOME_VFS_OK != gnome_vfs_read (handle, slice, size, &size)) { - slice = (g_free (slice), NULL); + g_return_val_if_fail (NULL != contents, FALSE); + g_return_val_if_fail (NULL != length, FALSE); + + if (NULL == data || *length < size) { + *length = MAX (*length, size); + return FALSE; + } + + if (GNOME_VFS_OK != gnome_vfs_read (handle, buffer, size, &size)) { gnome_vfs_close (handle); size = 0; } *length = size; - return slice; + return size > 0; } static EpcContents* |