[libshumate] vector-renderer: Fix compile error



commit d4e23adc49e1f31ef413525c538f1ef686820d1f
Author: James Westman <james jwestman net>
Date:   Thu Sep 15 12:36:28 2022 -0500

    vector-renderer: Fix compile error
    
    Remove a `return FALSE` in a void function, which is a compiler error in
    clang (but not in gcc).

 shumate/shumate-vector-renderer.c | 11 +++++++----
 shumate/shumate-vector-renderer.h |  8 ++++----
 2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/shumate/shumate-vector-renderer.c b/shumate/shumate-vector-renderer.c
index aa8d2ab..30294af 100644
--- a/shumate/shumate-vector-renderer.c
+++ b/shumate/shumate-vector-renderer.c
@@ -443,20 +443,23 @@ shumate_vector_renderer_get_style_json (ShumateVectorRenderer *self)
  * See <https://maplibre.org/maplibre-gl-js-docs/style-spec/sprite/> for
  * details about the spritesheet format. Most stylesheets provide these files
  * along with the main style JSON.
+ *
+ * Returns: whether the sprite sheet was loaded successfully
  */
-void
+gboolean
 shumate_vector_renderer_set_sprite_sheet_data (ShumateVectorRenderer  *self,
                                                GdkPixbuf              *sprites_pixbuf,
                                                const char             *sprites_json,
                                                GError                **error)
 {
-  g_return_if_fail (SHUMATE_IS_VECTOR_RENDERER (self));
-  g_return_if_fail (GDK_IS_PIXBUF (sprites_pixbuf));
-  g_return_if_fail (sprites_json != NULL);
+  g_return_val_if_fail (SHUMATE_IS_VECTOR_RENDERER (self), FALSE);
+  g_return_val_if_fail (GDK_IS_PIXBUF (sprites_pixbuf), FALSE);
+  g_return_val_if_fail (sprites_json != NULL, FALSE);
 
 #ifdef SHUMATE_HAS_VECTOR_RENDERER
   g_clear_object (&self->sprites);
   self->sprites = shumate_vector_sprite_sheet_new (sprites_pixbuf, sprites_json, NULL, error);
+  return self->sprites != NULL;
 #else
   g_set_error (error,
                SHUMATE_STYLE_ERROR,
diff --git a/shumate/shumate-vector-renderer.h b/shumate/shumate-vector-renderer.h
index fddabd0..83df51b 100644
--- a/shumate/shumate-vector-renderer.h
+++ b/shumate/shumate-vector-renderer.h
@@ -35,10 +35,10 @@ ShumateVectorRenderer *shumate_vector_renderer_new (const char  *id,
                                                     const char  *style_json,
                                                     GError     **error);
 
-void shumate_vector_renderer_set_sprite_sheet_data (ShumateVectorRenderer  *self,
-                                                    GdkPixbuf              *sprites_pixbuf,
-                                                    const char             *sprites_json,
-                                                    GError                **error);
+gboolean shumate_vector_renderer_set_sprite_sheet_data (ShumateVectorRenderer  *self,
+                                                        GdkPixbuf              *sprites_pixbuf,
+                                                        const char             *sprites_json,
+                                                        GError                **error);
 
 /**
  * SHUMATE_STYLE_ERROR:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]