aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2016-03-28 17:59:30 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2016-04-16 08:05:18 +0000
commit2226802826c4ba802696d5df274094cec3818af1 (patch)
tree08dce469defc94031858d74f78ee5fee85984a06 /epan/wslua
parent66417b17b3570b163a16ca81f71ce5bcb10548d2 (diff)
make-taps.pl: Enable "use warnings" pragma
Replace sprintf to fix newly generated warning. Change-Id: I85e8b0989c0caa4c9b079883b8653c9892df171c Reviewed-on: https://code.wireshark.org/review/14677 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/wslua')
-rwxr-xr-xepan/wslua/make-taps.pl37
1 files changed, 19 insertions, 18 deletions
diff --git a/epan/wslua/make-taps.pl b/epan/wslua/make-taps.pl
index 8e4b26b4e8..5faaa925d9 100755
--- a/epan/wslua/make-taps.pl
+++ b/epan/wslua/make-taps.pl
@@ -26,24 +26,25 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
+use warnings;
my %types = %{{
- 'gchar[]' => 'lua_pushstring(L,(const char*)v->%s);',
- 'gchar*' => 'lua_pushstring(L,(const char*)v->%s);',
- 'guint' => 'lua_pushnumber(L,(lua_Number)v->%s);',
- 'guint8' => 'lua_pushnumber(L,(lua_Number)v->%s);',
- 'guint16' => 'lua_pushnumber(L,(lua_Number)v->%s);',
- 'guint32' => 'lua_pushnumber(L,(lua_Number)v->%s);',
- 'gint' => 'lua_pushnumber(L,(lua_Number)v->%s);',
- 'gint8' => 'lua_pushnumber(L,(lua_Number)v->%s);',
- 'gint16' => 'lua_pushnumber(L,(lua_Number)v->%s);',
- 'gint32' => 'lua_pushnumber(L,(lua_Number)v->%s);',
- 'gboolean' => 'lua_pushboolean(L,(int)v->%s);',
- 'address' => '{ Address a = (Address)g_malloc(sizeof(address)); copy_address(a, &(v->%s)); pushAddress(L,a); }',
- 'address*' => '{ Address a = (Address)g_malloc(sizeof(address)); copy_address(a, v->%s); pushAddress(L,a); }',
- 'int' => 'lua_pushnumber(L,(lua_Number)v->%s);',
- 'nstime_t' => '{ lua_Number t = (lua_Number) v->%s.secs; t += v->%s.nsecs * 1e-9; lua_pushnumber(L,t); }',
- 'nstime_t*' => '{ lua_Number t = (lua_Number) v->%s->secs; t += v->%s->nsecs * 1e-9; lua_pushnumber(L,t); }',
+ 'gchar[]' => 'lua_pushstring(L,(const char*)v->STR);',
+ 'gchar*' => 'lua_pushstring(L,(const char*)v->STR);',
+ 'guint' => 'lua_pushnumber(L,(lua_Number)v->STR);',
+ 'guint8' => 'lua_pushnumber(L,(lua_Number)v->STR);',
+ 'guint16' => 'lua_pushnumber(L,(lua_Number)v->STR);',
+ 'guint32' => 'lua_pushnumber(L,(lua_Number)v->STR);',
+ 'gint' => 'lua_pushnumber(L,(lua_Number)v->STR);',
+ 'gint8' => 'lua_pushnumber(L,(lua_Number)v->STR);',
+ 'gint16' => 'lua_pushnumber(L,(lua_Number)v->STR);',
+ 'gint32' => 'lua_pushnumber(L,(lua_Number)v->STR);',
+ 'gboolean' => 'lua_pushboolean(L,(int)v->STR);',
+ 'address' => '{ Address a = (Address)g_malloc(sizeof(address)); copy_address(a, &(v->STR)); pushAddress(L,a); }',
+ 'address*' => '{ Address a = (Address)g_malloc(sizeof(address)); copy_address(a, v->STR); pushAddress(L,a); }',
+ 'int' => 'lua_pushnumber(L,(lua_Number)v->STR);',
+ 'nstime_t' => '{ lua_Number t = (lua_Number) v->STR.secs; t += v->STR.nsecs * 1e-9; lua_pushnumber(L,t); }',
+ 'nstime_t*' => '{ lua_Number t = (lua_Number) v->STR->secs; t += v->STR->nsecs * 1e-9; lua_pushnumber(L,t); }',
}};
my %comments = %{{
@@ -88,7 +89,7 @@ sub dotap {
my $enumre = "typedef\\s+enum[^{]*{([^}]*)}[\\s\\n]*" . ${ename} . "[\\s\\n]*;";
if ($buf =~ s/$enumre//ms ) {
- $types{$ename} = "lua_pushnumber(L,(lua_Number)v->%s); /* $ename */";
+ $types{$ename} = "lua_pushnumber(L,(lua_Number)v->STR); /* $ename */";
my $ebody = $1;
$ebody =~ s/\s+//msg;
$comments{$ename} = "$ename: { $ebody }";
@@ -132,7 +133,7 @@ sub dotap {
if ($fmt) {
$code .= "\tlua_pushstring(L,\"$n\");\n\t";
- $code .= sprintf($fmt,$n,$n) . "\n\tlua_settable(L,-3);\n";
+ $code .= $fmt =~ s/\bSTR\b/$n/rg . "\n\tlua_settable(L,-3);\n";
$doc .= "\t$n: $comments{$elems{$n}}\n";
}