Commit b7bed792 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

added a cancellable to the g_load_file_in_buffer function

parent ff7d711d
......@@ -1160,7 +1160,7 @@ gth_catalog_load_from_file (GFile *file)
gsize buffer_size;
gio_file = gth_catalog_file_to_gio_file (file);
if (! g_load_file_in_buffer (gio_file, &buffer, &buffer_size, NULL))
if (! g_load_file_in_buffer (gio_file, &buffer, &buffer_size, NULL, NULL))
return NULL;
catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", buffer);
......
......@@ -317,7 +317,7 @@ gth_comment_new_for_file (GFile *file,
if (comment_file == NULL)
return NULL;
if (! g_load_file_in_buffer (comment_file, &zipped_buffer, &zipped_size, error)) {
if (! g_load_file_in_buffer (comment_file, &zipped_buffer, &zipped_size, NULL, error)) {
g_object_unref (comment_file);
return NULL;
}
......
......@@ -323,6 +323,7 @@ add_themes_from_dir (DialogData *data,
if (! g_load_file_in_buffer (file,
(void **) &buffer,
&size,
NULL,
NULL))
{
g_object_unref (file);
......
......@@ -129,7 +129,7 @@ gth_metadata_provider_exiv2_write (GthMetadataProvider *self,
if (! exiv2_supports_writes (gth_file_data_get_mime_type (file_data)))
return;
if (! g_load_file_in_buffer (file_data->file, &buffer, &size, &error))
if (! g_load_file_in_buffer (file_data->file, &buffer, &size, NULL, &error))
return;
metadata = g_file_info_get_attribute_object (file_data->info, "general::description");
......
......@@ -459,7 +459,7 @@ flickr_thumbnail_loader (GthFileData *file_data,
gsize size;
file = g_file_new_for_uri (uri);
if (g_load_file_in_buffer (file, &buffer, &size, error)) {
if (g_load_file_in_buffer (file, &buffer, &size, cancellable, error)) {
GInputStream *stream;
GdkPixbuf *pixbuf;
......
......@@ -897,7 +897,7 @@ picasa_web_thumbnail_loader (GthFileData *file_data,
gsize size;
file = g_file_new_for_uri (uri);
if (g_load_file_in_buffer (file, &buffer, &size, error)) {
if (g_load_file_in_buffer (file, &buffer, &size, cancellable, error)) {
GInputStream *stream;
GdkPixbuf *pixbuf;
......
......@@ -1920,10 +1920,11 @@ _g_delete_files_async (GList *file_list,
gboolean
g_load_file_in_buffer (GFile *file,
void **buffer,
gsize *size,
GError **error)
g_load_file_in_buffer (GFile *file,
void **buffer,
gsize *size,
GCancellable *cancellable,
GError **error)
{
GFileInputStream *istream;
gboolean retval;
......@@ -1932,7 +1933,7 @@ g_load_file_in_buffer (GFile *file,
gssize n;
char tmp_buffer[BUFFER_SIZE];
istream = g_file_read (file, NULL, error);
istream = g_file_read (file, cancellable, error);
if (istream == NULL)
return FALSE;
......@@ -1940,7 +1941,11 @@ g_load_file_in_buffer (GFile *file,
local_buffer = NULL;
count = 0;
for (;;) {
n = g_input_stream_read (G_INPUT_STREAM (istream), tmp_buffer, BUFFER_SIZE, NULL, error);
n = g_input_stream_read (G_INPUT_STREAM (istream),
tmp_buffer,
BUFFER_SIZE,
cancellable,
error);
if (n < 0) {
g_free (local_buffer);
retval = FALSE;
......
......@@ -151,6 +151,7 @@ void _g_delete_files_async (GList *file_list,
gboolean g_load_file_in_buffer (GFile *file,
void **buffer,
gsize *size,
GCancellable *cancellable,
GError **error);
void g_load_file_async (GFile *file,
int io_priority,
......
......@@ -83,6 +83,7 @@ migration_for_each_file (GFile *file,
if (! g_load_file_in_buffer (file,
(void **) &buffer,
&buffer_size,
NULL,
&error))
{
g_warning ("%s", error->message);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment