[grilo-plugins] lua-factory: fix use of wrong grl_data_set_int



commit 8cc02f2b5cbd1d0974531ff6ff01b051f27d8551
Author: Victor Toso <me victortoso com>
Date:   Thu Sep 24 17:56:03 2015 +0200

    lua-factory: fix use of wrong grl_data_set_int
    
    commit 1e20497737db94c0932a12b4395859 changed the behavior and current
    tests got it. grl_data_set_int64 should be used with G_TYPE_INT64 or
    else we would fail with:
    
    data/grl-related-keys.c:253: value has type gint, but expected gint64
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755447

 src/lua-factory/grl-lua-library.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-library.c b/src/lua-factory/grl-lua-library.c
index 37c9c38..5db3380 100644
--- a/src/lua-factory/grl-lua-library.c
+++ b/src/lua-factory/grl-lua-library.c
@@ -352,11 +352,15 @@ grl_util_build_media (lua_State *L,
         if (lua_isnumber (L, -1)) {
           gint success;
           gint value = lua_tointegerx (L, -1, &success);
-          if (success)
-            grl_data_set_int (GRL_DATA (media), key_id, value);
-          else
+          if (success) {
+            if (type == G_TYPE_INT)
+              grl_data_set_int (GRL_DATA (media), key_id, value);
+            else
+              grl_data_set_int64 (GRL_DATA (media), key_id, value);
+          } else {
             GRL_WARNING ("'%s' requires an INT type, while a value '%s' was provided",
                        key_name, lua_tostring(L, -1));
+          }
         } else if (lua_istable (L, -1)) {
           grl_util_add_table_to_media (L, media, key_id, key_name, type);
         } else if (!lua_isnil (L, -1)) {


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