From 52c10ca4feff121b39afeb9f158dfa1c91aee5b6 Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Mon, 7 Sep 2015 07:41:56 +0000 Subject: Revert "lua-factory: Stricter integer typization for Lua" This reverts commit 495dad41cd8ac32a1ec2d17e89f2f6c0bd30d386. Only keeps bump Lua 5.3 --- src/lua-factory/grl-lua-factory.c | 2 +- src/lua-factory/grl-lua-library.c | 42 +++++++++++++++++----------------- src/lua-factory/lua-library/lua-json.c | 4 ++-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/lua-factory/grl-lua-factory.c b/src/lua-factory/grl-lua-factory.c index 1b18ca4..f3b1e16 100644 --- a/src/lua-factory/grl-lua-factory.c +++ b/src/lua-factory/grl-lua-factory.c @@ -1274,7 +1274,7 @@ lua_plugin_source_info (lua_State *L, /* Auto-split-threshold */ lua_getfield (L, -6, LUA_SOURCE_AUTO_SPLIT_THRESHOLD); - lua_auto_split_threshold = lua_tointeger (L, -1); + lua_auto_split_threshold = lua_tonumber (L, -1); /* Source Tags */ lua_getfield (L, -7, LUA_SOURCE_TAGS); diff --git a/src/lua-factory/grl-lua-library.c b/src/lua-factory/grl-lua-library.c index b93260b..1fafbf0 100644 --- a/src/lua-factory/grl-lua-library.c +++ b/src/lua-factory/grl-lua-library.c @@ -265,18 +265,18 @@ grl_util_add_table_to_media (lua_State *L, lua_gettable (L, -2); switch (type) { case G_TYPE_INT: - if (lua_isinteger (L, -1)) + if (lua_isnumber (L, -1)) grl_data_add_int (GRL_DATA (media), key_id, lua_tointeger (L, -1)); break; case G_TYPE_INT64: - if (lua_isinteger (L, -1)) + if (lua_isnumber (L, -1)) grl_data_add_int64 (GRL_DATA (media), key_id, lua_tointeger (L, -1)); break; case G_TYPE_FLOAT: if (lua_isnumber (L, -1)) - grl_data_add_float (GRL_DATA (media), key_id, lua_tonumber (L, -1)); + grl_data_add_float (GRL_DATA (media), key_id, lua_tointeger (L, -1)); break; case G_TYPE_STRING: @@ -348,7 +348,7 @@ grl_util_build_media (lua_State *L, switch (type) { case G_TYPE_INT: - if (lua_isinteger (L, -1)) { + if (lua_isnumber (L, -1)) { grl_data_set_int (GRL_DATA (media), key_id, lua_tointeger (L, -1)); } else if (lua_istable (L, -1)) { grl_util_add_table_to_media (L, media, key_id, key_name, type); @@ -370,7 +370,7 @@ grl_util_build_media (lua_State *L, break; case G_TYPE_INT64: - if (lua_isinteger (L, -1)) { + if (lua_isnumber (L, -1)) { grl_data_set_int64 (GRL_DATA (media), key_id, lua_tointeger (L, -1)); } else if (lua_istable (L, -1)) { grl_util_add_table_to_media (L, media, key_id, key_name, type); @@ -498,7 +498,7 @@ grl_util_fetch_done (GObject *source_object, } else { lua_newtable (L); for (i = 0; i < fo->num_urls; i++) { - lua_pushinteger (L, i + 1); + lua_pushnumber (L, i + 1); lua_pushlstring (L, fo->results[i], strlen (fo->results[i])); lua_settable (L, -3); } @@ -635,7 +635,7 @@ grl_util_unzip_done (GObject *source_object, lua_newtable (L); for (i = 0; results[i] != NULL; i++) { - lua_pushinteger (L, i + 1); + lua_pushnumber (L, i + 1); lua_pushlstring (L, results[i], strlen (results[i])); lua_settable (L, -3); } @@ -674,7 +674,7 @@ net_wc_new_with_options(lua_State *L, } else if (g_strcmp0 (key, "cache-size") == 0 || g_strcmp0 (key, "cache_size") == 0) { - guint size = lua_tointeger (L, -1); + guint size = lua_tonumber (L, -1); grl_net_wc_set_cache_size (wc, size); } else if (g_strcmp0 (key, "cache") == 0) { @@ -682,11 +682,11 @@ net_wc_new_with_options(lua_State *L, grl_net_wc_set_cache (wc, use_cache); } else if (g_strcmp0 (key, "throttling") == 0) { - guint throttling = lua_tointeger (L, -1); + guint throttling = lua_tonumber (L, -1); grl_net_wc_set_throttling (wc, throttling); } else if (g_strcmp0 (key, "loglevel") == 0) { - guint level = lua_tointeger (L, -1); + guint level = lua_tonumber (L, -1); grl_net_wc_set_log_level (wc, level); } else { @@ -746,21 +746,21 @@ grl_l_operation_get_options (lua_State *L) if (g_strcmp0 (option, "count") == 0) { gint count = grl_operation_options_get_count (os->options); - lua_pushinteger (L, count); + lua_pushnumber (L, count); return 1; } if (g_strcmp0 (option, "skip") == 0) { guint skip = grl_operation_options_get_skip (os->options); - lua_pushinteger (L, skip); + lua_pushnumber (L, skip); return 1; } if (g_strcmp0 (option, "flags") == 0) { GrlResolutionFlags flags = grl_operation_options_get_resolution_flags (os->options); - lua_pushinteger (L, (gint) flags); + lua_pushnumber (L, (gint) flags); return 1; } @@ -777,7 +777,7 @@ grl_l_operation_get_options (lua_State *L) value = grl_operation_options_get_key_filter (os->options, key); switch (grl_registry_lookup_metadata_key_type (registry, key)) { case G_TYPE_INT: - (value) ? (void) lua_pushinteger (L, g_value_get_int (value)) : lua_pushnil (L); + (value) ? (void) lua_pushnumber (L, g_value_get_int (value)) : lua_pushnil (L); break; case G_TYPE_FLOAT: @@ -814,8 +814,8 @@ grl_l_operation_get_options (lua_State *L) grl_operation_options_get_key_range_filter (os->options, key, &min, &max); switch (grl_registry_lookup_metadata_key_type (registry, key)) { case G_TYPE_INT: - (min) ? (void) lua_pushinteger (L, g_value_get_int (min)) : lua_pushnil (L); - (max) ? (void) lua_pushinteger (L, g_value_get_int (max)) : lua_pushnil (L); + (min) ? (void) lua_pushnumber (L, g_value_get_int (min)) : lua_pushnil (L); + (max) ? (void) lua_pushnumber (L, g_value_get_int (max)) : lua_pushnil (L); break; case G_TYPE_FLOAT: @@ -837,7 +837,7 @@ grl_l_operation_get_options (lua_State *L) } if (g_strcmp0 (option, "operation-id") == 0) { - lua_pushinteger (L, (gint) os->operation_id); + lua_pushnumber (L, (gint) os->operation_id); return 1; } @@ -937,7 +937,7 @@ grl_l_media_get_keys (lua_State *L) type = grl_registry_lookup_metadata_key_type (registry, key_id); switch (type) { case G_TYPE_INT: - lua_pushinteger (L, grl_data_get_int (GRL_DATA (os->media), key_id)); + lua_pushnumber (L, grl_data_get_int (GRL_DATA (os->media), key_id)); break; case G_TYPE_FLOAT: lua_pushnumber (L, grl_data_get_float (GRL_DATA (os->media), key_id)); @@ -946,7 +946,7 @@ grl_l_media_get_keys (lua_State *L) lua_pushstring (L, grl_data_get_string (GRL_DATA (os->media), key_id)); break; case G_TYPE_INT64: - lua_pushinteger (L, grl_data_get_int64 (GRL_DATA (os->media), key_id)); + lua_pushnumber (L, grl_data_get_int64 (GRL_DATA (os->media), key_id)); break; case G_TYPE_BOOLEAN: lua_pushboolean (L, grl_data_get_boolean (GRL_DATA (os->media), key_id)); @@ -1063,7 +1063,7 @@ grl_l_fetch (lua_State *L) * grl.callback * * @media: (table) The media content to be returned. -* @count: (integer) Number of media remaining to the application. +* @count: (number) Number of media remaining to the application. * @return: Nothing; */ static gint @@ -1087,7 +1087,7 @@ grl_l_callback (lua_State *L) media = (os->op_type == LUA_RESOLVE) ? os->media : NULL; if (nparam > 0) { media = grl_util_build_media (L, media); - count = (lua_isinteger (L, 2)) ? lua_tointeger (L, 2) : 0; + count = (lua_isnumber (L, 2)) ? lua_tonumber (L, 2) : 0; } switch (os->op_type) { diff --git a/src/lua-factory/lua-library/lua-json.c b/src/lua-factory/lua-library/lua-json.c index 1424c2e..c3f0640 100644 --- a/src/lua-factory/lua-library/lua-json.c +++ b/src/lua-factory/lua-library/lua-json.c @@ -79,7 +79,7 @@ build_table_from_json_reader (lua_State *L, lua_createtable (L, num_elements, 0); for (index_element = 0; index_element < num_elements; index_element++) { json_reader_read_element (reader, index_element); - lua_pushinteger (L, index_element + 1); + lua_pushnumber (L, index_element + 1); build_table_from_json_reader (L, reader); json_reader_end_element (reader); } @@ -95,7 +95,7 @@ build_table_from_json_reader (lua_State *L, lua_pushstring (L, json_reader_get_string_value (reader)); break; case G_TYPE_INT64: - lua_pushinteger (L, json_reader_get_int_value (reader)); + lua_pushnumber (L, json_reader_get_int_value (reader)); break; case G_TYPE_DOUBLE: lua_pushnumber (L, json_reader_get_double_value (reader)); -- cgit v1.2.1