# HG changeset patch # User Myhailo Danylenko # Date 1271266047 -10800 # Node ID 15f4c09ffb860c98e0f91c41fa6d53466a4b06c9 # Parent 5bcdb71ef2f2d12c242b82177f15966fe1655e66 Hopefully fix size issues on 64-bit architectures diff -r 5bcdb71ef2f2 -r 15f4c09ffb86 lua.c --- a/lua.c Wed Apr 14 11:21:02 2010 +0300 +++ b/lua.c Wed Apr 14 20:27:27 2010 +0300 @@ -132,10 +132,10 @@ } else if (type == LUA_TNIL) luaL_addstring (&B, "nil"); else { - char xbuf[9]; + char xbuf[32]; luaL_addstring (&B, luaL_typename (L, i)); luaL_addstring (&B, ": 0x"); - snprintf (&xbuf[0], 9, "%08x", (int) lua_topointer (L, i)); + snprintf (&xbuf[0], 32, "%p", lua_topointer (L, i)); luaL_addlstring (&B, xbuf, 8); // XXX } } @@ -980,7 +980,7 @@ cid = compl_new_category (); if (cid) { - lua_added_categories = g_slist_prepend (lua_added_categories, (gpointer) cid); + lua_added_categories = g_slist_prepend (lua_added_categories, (gpointer) ((gsize) cid)); lua_pushinteger (L, cid); } else lua_pushnil (L); @@ -995,7 +995,7 @@ { guint cid = luaL_checkinteger (L, 1); compl_del_category (cid); - lua_added_categories = g_slist_remove (lua_added_categories, (gpointer) cid); + lua_added_categories = g_slist_remove (lua_added_categories, (gpointer) ((gsize) cid)); return 0; } @@ -1046,7 +1046,7 @@ if (lua_type (L, 4) == LUA_TTABLE) { cid = compl_new_category (); if (cid) { - lua_added_categories = g_slist_prepend (lua_added_categories, (gpointer) cid); + lua_added_categories = g_slist_prepend (lua_added_categories, (gpointer) ((gsize) cid)); lua_pushnil (L); while (lua_next (L, 4)) { char *word = to_utf8 (luaL_checkstring (L, -1)); @@ -1156,7 +1156,7 @@ static void lua_timer_callback_destroy (lua_timer_callback_t *cb) { luaL_unref (cb->L, LUA_REGISTRYINDEX, cb->reference); - lua_timers = g_slist_remove (lua_timers, (gpointer) cb->source); + lua_timers = g_slist_remove (lua_timers, (gpointer) ((gsize) cb->source)); luaL_free (cb->L, cb); } @@ -1193,7 +1193,7 @@ source = g_timeout_add_seconds_full (MLUA_SOURCE_PRIORITY, interval, (GSourceFunc) lua_timer_callback, cb, (GDestroyNotify) lua_timer_callback_destroy); cb->source = source; - lua_timers = g_slist_prepend (lua_timers, (gpointer) source); + lua_timers = g_slist_prepend (lua_timers, (gpointer) ((gsize) source)); return 0; } @@ -1215,7 +1215,7 @@ { luaL_unref (cb->L, LUA_REGISTRYINDEX, cb->reference); pclose (cb->fd); // Not necessary? - lua_bgreads = g_slist_remove (lua_bgreads, (gpointer) cb->source); + lua_bgreads = g_slist_remove (lua_bgreads, (gpointer) ((gsize) cb->source)); luaL_free (cb->L, cb); } @@ -1299,7 +1299,7 @@ source = g_io_add_watch_full (channel, MLUA_SOURCE_PRIORITY, G_IO_IN|G_IO_HUP|G_IO_ERR, (GIOFunc) lua_bgread_callback, cb, (GDestroyNotify) lua_bgread_callback_destroy); cb->source = source; - lua_bgreads = g_slist_prepend (lua_bgreads, (gpointer) source); + lua_bgreads = g_slist_prepend (lua_bgreads, (gpointer) ((gsize) source)); // unref? @@ -1739,7 +1739,7 @@ if (cid) { const string2enum_t *word = lua_yesno; lua_completion_type[MLUA_YESNO_POS].value = cid; - lua_added_categories = g_slist_prepend (lua_added_categories, (gpointer) cid); + lua_added_categories = g_slist_prepend (lua_added_categories, (gpointer) ((gsize) cid)); while (word->string) { compl_add_category_word (cid, word->string); ++word;