Added Lua error messages when:
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 25 Oct 2011 11:13:11 +0000 (11:13 +0000)
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 25 Oct 2011 11:13:11 +0000 (11:13 +0000)
- Adding a INT64/UINT64 field with a value string (currently unsupported).
- Trying to display a signed integer as hexadecimal.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39562 f5534014-38df-0310-8fa8-9805f1628bb7

epan/wslua/wslua_proto.c

index e44d1603d0ffeda562aeb717cd2e7b5160f18f95..eeb5be0fc6031529710a2e1c8cb3a2def3cd829b 100644 (file)
@@ -673,6 +673,13 @@ static int ProtoField_integer(lua_State* L, enum ftenum type) {
         luaL_argerror(L, 3, "Base must be either BASE_DEC, BASE_HEX, BASE_OCT,"
                       " BASE_DEC_HEX, BASE_DEC_HEX or BASE_HEX_DEC");
         return 0;
+    } else if (vs && (type == FT_INT64 || type == FT_UINT64)) {
+      luaL_argerror(L, 4, "This type does not support value string");
+      return 0;
+    } else if ((base == BASE_HEX || base == BASE_HEX_DEC || base == BASE_OCT) &&
+              (type == FT_INT8 || type == FT_INT16 || type == FT_INT24 || type == FT_INT32 || type == FT_INT64)) {
+      luaL_argerror(L, 3, "This type does not display as hexadecimal");
+      return 0;
     }
 
     if (proto_check_field_name(abbr)) {