aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/wslua_int64.c
AgeCommit message (Collapse)AuthorFilesLines
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>