aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/wslua_int64.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-20LUA: allow conversion from string to uint64 in any baseNardi Ivan1-1/+1
This is handy when you want to specify a mask in hex format
2023-01-04WSLUA: allow 64 bits bitmask for ProtoField objectsNardi Ivan1-1/+1
Mask might be specified using a (Lua) number, a string or a UInt64 object. It is useful to handle 64 bit bitfields.
2022-07-21wslua: Fix more argument definitions.Gerald Combs1-4/+4
2021-12-19Fix stdio.h conversions to use the scanf macrosJoão Valverde1-2/+2
2021-12-19epan: Convert to use stdio.h from GLibJoão Valverde1-4/+4
Replace: g_snprintf() -> snprintf() g_vsnprintf() -> vsnprintf() g_strdup_printf() -> ws_strdup_printf() g_strdup_vprintf() -> ws_strdup_vprintf() This is more portable, user-friendly and faster on platforms where GLib does not like the native I/O. Adjust the format string to use macros from intypes.h.
2020-03-31wslua: Update the Int64 docs.Gerald Combs1-133/+183
Add content from https://wiki.wireshark.org/LuaAPI/Int64. Update as needed. Change-Id: I6a5f8c1cdeddee6d552fde940224704daca980b5 Reviewed-on: https://code.wireshark.org/review/36639 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-24wslua: WSLUA_BIT_OP_FUNC macro already does return .Martin Mathieson1-6/+0
epan/wslua/wslua_int64.c:445: style: Consecutive return, break, continue, goto or throw statements are unnecessary. epan/wslua/wslua_int64.c:454: style: Consecutive return, break, continue, goto or throw statements are unnecessary. epan/wslua/wslua_int64.c:463: style: Consecutive return, break, continue, goto or throw statements are unnecessary. epan/wslua/wslua_int64.c:966: style: Consecutive return, break, continue, goto or throw statements are unnecessary. epan/wslua/wslua_int64.c:975: style: Consecutive return, break, continue, goto or throw statements are unnecessary. epan/wslua/wslua_int64.c:984: style: Consecutive return, break, continue, goto or throw statements are unnecessary. Change-Id: I98d8c07cb13c523ba21469b7ad84ff4738764d49 Reviewed-on: https://code.wireshark.org/review/36556 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2019-07-26HTTPS (almost) everywhere.Guy Harris1-1/+1
Change all wireshark.org URLs to use https. Fix some broken links while we're at it. Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c Reviewed-on: https://code.wireshark.org/review/34089 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-09spdx: more licenses converted.Dario Lombardo1-19/+1
Change-Id: I8f6693108c43959e54911d35b4fbf730c59add60 Reviewed-on: https://code.wireshark.org/review/26361 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-11wslua: Convert more comment markup to Asciidoctor.Gerald Combs1-3/+3
Convert links, source code blocks, and admonitions. Change-Id: I50c8daa19a115c23f7501b91dbfd904779a609c9 Reviewed-on: https://code.wireshark.org/review/25720 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-06-14wslua: Drop unused "push_code" macro parameterPeter Wu1-2/+2
Reduce noise, no caller has used this parameter since its introduction. Msotly automated regex search and replace. Change-Id: I4b1180bfee8544b38d19c9c440ff5b9b0dc080b2 Reviewed-on: https://code.wireshark.org/review/14790 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-09-04Coverity CID 1167971-1167974: constant expressions in wslua_int64Hadriel Kaplan1-4/+9
Get rid of false-positive coverity issues by using a macro instead of source code if-statement. Bug: 11501 Change-Id: I07f478ed334931f05bdfb87cb8f614b16bbf8fa8 Reviewed-on: https://code.wireshark.org/review/10376 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> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-08-21Lua: check sscanf return valueHadriel Kaplan1-2/+6
Wslua's Int64.fromhex() and UInt64.fromhex() need to check the sscanf return value. Found by coverity (CID 1191368 &1191369). Change-Id: I67fba027e18341d429787515f94c794573dc41c2 Reviewed-on: https://code.wireshark.org/review/10183 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-03-10Change a lot of http:// URLs to https://.Gerald Combs1-3/+3
Most of our sites are now HTTPS-only. Update URLs accordingly. Update other URLs while we're at it. Remove or comment out dead links. Change-Id: I7c4f323e6585d22760bb90bf28fc0faa6b893a33 Reviewed-on: https://code.wireshark.org/review/7621 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-13wslua*: Add editor modelines; Fix indentation, etc as needed.Bill Meier1-0/+13
Change-Id: I6df5d46f4b263104aa9cb6353cc987087cdb867e Reviewed-on: https://code.wireshark.org/review/7102 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-23Use luaL_{check,opt}integer() rather than luaL_{check,opt}int().Guy Harris1-4/+4
Lua prior to 5.3 defined luaL_{check,opt}int() as macros wrapping luaL_{check,opt}integer() with a cast to int; Lua 5.3 doesn't. It sounds as if the Lua developers are deprecating luaL_{check,opt}int(): http://osdir.com/ml/general/2014-10/msg46568.html Change-Id: I2d0b649dcd57ede124f31d39f7945f342ae9b18f Reviewed-on: https://code.wireshark.org/review/6744 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2014-11-09Convert the Lua reference to AsciiDoc.Gerald Combs1-1/+1
Move it to the Developer's Guide while we're here. Nudge the markup in epan/wslua where needed. Note that we should probably convert it to AsciiDoc (if we're going to keep it in the DG) or Doxygen. Change-Id: Ie175111043f98b7a37eeeb8d185a833d8e866f8b Reviewed-on: https://code.wireshark.org/review/5203 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-13Lua: luaL_checkstring does not return NULLStig Bjørlykke1-2/+2
Removed all checks for NULL strings to cleanup the code. Change-Id: Ia890cd9b206296f586e85214f07765f14984580b Reviewed-on: https://code.wireshark.org/review/4632 Tested-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-04-04Remove $Id$ in wsluaAlexis La Goutte1-1/+0
Change-Id: I01052bb4c41a17e8289cc7ed1b465042c23b6d82 Reviewed-on: https://code.wireshark.org/review/957 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-26Add various functions for Lua directory handling and path infoHadriel Kaplan1-4/+4
This adds new functions to get plugins path info, find out if a directory exists, make a new one, remove one, etc. It also creates a file environment for user-supplied Lua scripts, to prevent global variable contamination as well as supply the script-specific file name. Some other minor cleanup was done as I found them. A new testsuite was added to test the existing and new directory functions. Change-Id: I19bd587b5e8a73d89b8521af73670e023314fb33 Reviewed-on: https://code.wireshark.org/review/832 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-25Enhance Lua API doc generator and add more API infoHadriel Kaplan1-158/+336
This enhances the Lua API doc generator Perl script to handle meta-information in description comments, such as bold, italics, raw code, version info, etc. The supported markup and codes are documented in make-wsluarm.pl. It's not beautiful Perl code (I don't know Perl), and I'd rather do it using Lua, but I think keeping it Perl makes more sense in the long run. Change-Id: I477b3ebe770075dcea9ec52708e2d6fb5758d2f4 Reviewed-on: https://code.wireshark.org/review/802 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-21Fix API comments and don't use sprintf in wslua_int64.cHadriel Kaplan1-8/+8
Change-Id: I4997317e010f685d47e1e2ab512b086e54b286a7 Reviewed-on: https://code.wireshark.org/review/777 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-27Fix coverity warnings for all wslua files. (redux)Hadriel Kaplan1-25/+18
This fixes/addresses all the coverity warnings shown by the buildbots. (I hope) Change-Id: Ic2722df97c577d274e3cf3f0cbdca1902edde047 Reviewed-on: https://code.wireshark.org/review/423 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-02-21Cleanup on aisle 5: normalizes the Lua code to follow common schema/modelHadriel Kaplan1-78/+84
Over time the various wslua classes/functions have gotten moldy, with different ways of doing similar things. Some of it can't be changed without breaking backwards compatibility for Lua scripts, so I didn't do that. But I did what I could. The biggest change is a refactoring of how accessors/attributes are handled in the code, so that most of them work the same way using the same code. Specific changes made: * Added null/expired checking macro to class declarations for many classes * Removed extraneous pointer/expired checking, since checkFoo() does that already * Fixed "errors" reported by clang static analyzer; they were false positives, but it was easier to get it to stop complaining by changing the code * Moved internal wslua functions from wslua_utils.c into a new 'wslua_internals.c' file * Changed Listener/NSTime/Pinfo/Proto to use a common setter/getter accessor/attribute code model, instead of each of them doing their own * Fixed some API doc mistakes, mostly around attributes that were documented as read-only but were actually read-write Change-Id: Idddafc5fbd3545ebff29e063acc767e1c743a1a9 Reviewed-on: https://code.wireshark.org/review/271 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-14Adds support for Lua struct library so one can pack/unpack binary structuresHadriel Kaplan1-9/+12
This is based on Roberto Ierusalimschy's struct library, along with additional options based on Flemming Madsen's patch to the lua-users mailing list, and some changes I made to support 64-bit integer packing/unpacking. Details are in the top comments for wslua_struct.c. This also includes a test script. Change-Id: Ifcd0116ba013d5c760927721c8d6e9f28965534b Reviewed-on: https://code.wireshark.org/review/98 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-09Fix bug 9736 'Lua: new Int64/UInt64 functions don't prevent division by zero'Hadriel Kaplan1-19/+55
OK, in all fairness this does a bit more than just fix that bug. It also adds a 'Int64()' and 'UInt64()' __call metamethods. I generally dislike using __call metamethods, because they're often unintuitive (for example the wireshark Field and FielInfo use this in a bizarre fashion). But this happens to be a perfect use for it, and very natural, imho. Another change is to make the metatables of classes visible to scripts. There was never really a good reason not to make them visible, and they have to be visible to do things like use __call on a plain table... not to mention I need them to be visible to run test scripts verifying evrything is kosher. I also updated the test suite to test for the div/mod by zero. Change-Id: Ia4c594c8f59d4e799090716bd032ba2815df032f Reviewed-on: https://code.wireshark.org/review/149 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-05Two fixes for license headersEvan Huus1-39/+35
- packet-bencode.c had the wrong FSF address - wslua_int64.c had the license as a footer instead of a header Change-Id: I71204b36a1034af72874d6fe87929c31c9ff03df Reviewed-on: https://code.wireshark.org/review/123 Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-04Various fixes to the Lua int64 codeEvan Huus1-11/+11
- add casts to pacify certain buildbots - skip test if lua isn't available Change-Id: I614c05dca40cb848c87b361e4b3d3c4e94aafb9e Reviewed-on: https://code.wireshark.org/review/97 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-04Adds support for Lua Int64 and UInt64 operators, functions, and generalHadriel Kaplan1-0/+911
usefulness, working around bug #9162 until Lua 5.3 is released. The existing Int64 and UInt64 classes provide virtually no usefullness, other than for creating a string of their value. While one could then write Lua code to convert the string to Lua numbers and such, ultimately Lua has no native 64-bit integer support, making such a task difficult to handle in Lua. This change adds a host of functions and operators to the existing Int64 (gint64) and UInt64 (guint64) classes, to enable true 64-bit integer support on par with native Lua numbers. A test script is also provided, which tests the functions/operators. Change-Id: I4c5f8f5219b9a88198902283bd32ddf24c346bbe Reviewed-on: https://code.wireshark.org/review/83 Tested-by: Evan Huus <eapache@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com>