diff options
author | Hadriel Kaplan <hadrielk@yahoo.com> | 2015-01-03 19:27:59 -0500 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2015-01-04 09:07:02 +0000 |
commit | 7c9d6ff73a40e3ebdf00650283ea87a66d1312ee (patch) | |
tree | bc55feeb475c907961fe8013c53374eb077856c0 /epan/wslua/wslua_tree.c | |
parent | 2ef85f5cda2d3289455a314a8bc16f25ef26850a (diff) |
Lua: replace proto_tree_add_text calls
Replace proto_tree_add_text() calls in Lua API code, to use Lua-specific hfinfo items.
Bug: 10828
Change-Id: I9b5899106502a9bdbc748b5ec0f27b787d374562
Reviewed-on: https://code.wireshark.org/review/6296
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/wslua/wslua_tree.c')
-rw-r--r-- | epan/wslua/wslua_tree.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/epan/wslua/wslua_tree.c b/epan/wslua/wslua_tree.c index 193727d1cc..5d8aac895b 100644 --- a/epan/wslua/wslua_tree.c +++ b/epan/wslua/wslua_tree.c @@ -396,7 +396,14 @@ static int TreeItem_add_item_any(lua_State *L, gboolean little_endian) { } else { if (lua_gettop(L)) { const gchar* s = lua_tostring(L,1); - item = proto_tree_add_text(tree_item->tree, tvbr->tvb->ws_tvb, tvbr->offset, tvbr->len,"%s",s); + const int hf = get_hf_wslua_text(); + if (hf > -1) { + /* use proto_tree_add_none_format() instead? */ + item = proto_tree_add_item(tree_item->tree, hf, tvbr->tvb->ws_tvb, tvbr->offset, tvbr->len, ENC_NA); + proto_item_set_text(item, "%s", s); + } else { + luaL_error(L,"Internal error: hf_wslua_text not registered"); + } lua_remove(L,1); } else { luaL_error(L,"Tree item ProtoField/Protocol handle is invalid (ProtoField/Proto not registered?)"); |