[retro-gtk] glsl-filter: Simplify reading the filter manifest
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] glsl-filter: Simplify reading the filter manifest
- Date: Thu, 16 Nov 2017 12:54:20 +0000 (UTC)
commit d83ed7a05bd17d328ba6616620b5af6807be8f60
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Nov 16 13:48:12 2017 +0100
glsl-filter: Simplify reading the filter manifest
retro-gtk/retro-glsl-filter.c | 17 ++---------------
1 files changed, 2 insertions(+), 15 deletions(-)
---
diff --git a/retro-gtk/retro-glsl-filter.c b/retro-gtk/retro-glsl-filter.c
index 1620b8c..3476021 100644
--- a/retro-gtk/retro-glsl-filter.c
+++ b/retro-gtk/retro-glsl-filter.c
@@ -124,7 +124,6 @@ retro_glsl_filter_new (const char *uri,
GKeyFile *key_file;
GFile *file;
GFile *parent;
- GFileInputStream *stream;
GBytes *bytes;
const gchar *value;
GError *inner_error = NULL;
@@ -132,25 +131,13 @@ retro_glsl_filter_new (const char *uri,
g_return_val_if_fail (uri != NULL, NULL);
file = g_file_new_for_uri (uri);
- stream = g_file_read (file, NULL, &inner_error);
- if (G_UNLIKELY (inner_error != NULL)) {
- g_propagate_error (error, inner_error);
- g_object_unref (file);
-
- return NULL;
- }
-
- bytes = g_input_stream_read_bytes (G_INPUT_STREAM (stream), 4096, NULL, error);
- if (G_UNLIKELY (inner_error != NULL)) {
- g_propagate_error (error, inner_error);
+ bytes = g_file_try_read_bytes (file);
+ if (G_UNLIKELY (bytes == NULL)) {
g_object_unref (file);
- g_object_unref (stream);
return NULL;
}
- g_object_unref (stream);
-
key_file = g_key_file_new ();
g_key_file_load_from_bytes (key_file, bytes, G_KEY_FILE_NONE, &inner_error);
if (G_UNLIKELY (inner_error != NULL)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]