aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
AgeCommit message (Collapse)AuthorFilesLines
2015-01-13Consistently use the "g_string_free returns a C string pointer" idiom.Guy Harris1-2/+1
g_string_free(str, FALSE) frees the GString container but not the underlying g_malloc()ed string; instead, it returns a pointer to the g_malloc()ed string. Fix those places that didn't already get the string pointer from g_string_free() to do so rather than manually extracting the string themselves. And fix one place that didn't even need to use a string - it was just scanning a C string without even modifying it. Change-Id: Ibbf4872bf5b9935b9907f539b6edb1013f3053a5 Reviewed-on: https://code.wireshark.org/review/6532 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-11Fix CMake generation and use of Windows .rc filesGraham Bloice1-1/+1
CMake now generates local copies of .rc files for all the Windows components and uses the files in the build of the components. The .rc.in files that include an icon were modified to allow the icon path to be set by CMake. The path is removed for nmake builds. Updated build architecture detection, required for wireshark.manifest.in Change-Id: I7b1ff43050e9b0efb861d1041636fb4aef49a4f8 Reviewed-on: https://code.wireshark.org/review/6482 Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2015-01-05Minor CMake updates to better group build artefactsGraham Bloice1-1/+1
Move capchild, caputils, codecs and wsutil into a Libs group Move gtkui into UI group Move update-sminmpec into tools group Change-Id: Iaf2bfe4697265af2c3ed9c9d7de2d5d1ef3cafee Reviewed-on: https://code.wireshark.org/review/6332 Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Graham Bloice <graham.bloice@trihedral.com>
2015-01-02Add back "version.h" inclusionPascal Quantin1-0/+2
It got removed by the automatic include cleaning scripts Also add it to text2pcap.c as it is used to get the version when writing a pcapng file Change-Id: I3d56985fa1d04bcb066fe015a588c24cf3cb7267 Reviewed-on: https://code.wireshark.org/review/6248 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-01-02Add '*.nativecodeanalysis.xml' to 'clean' targetsBill Meier1-1/+1
Change-Id: I90dbf0b31fc737150a01533763a7869b34c68cb6 Reviewed-on: https://code.wireshark.org/review/6220 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-01Welcome in 2015Pascal Quantin1-1/+1
Change-Id: Ib581b9383b211ea8dbcea1cadf98a2b8c3548ab5 Reviewed-on: https://code.wireshark.org/review/6204 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-31Use setlocale() to get the current locale.Guy Harris1-6/+18
This: 1) should work on Windows; 2) reflects what the C environment is actually set up to use, rather than what the environment variables for locale are set up to use - C programs default to the C locale and only pick up the setting from the environment variables etc. if you explicitly request the system locale with a setlocale() call. Change-Id: Iee064237e70501a5450d4daa9ab849391f200efd Reviewed-on: https://code.wireshark.org/review/6195 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31Swallow get_glib_version_info() into get_compiled_version_info().Guy Harris1-18/+9
It's not that complicated, so we might as well just do it in line. Change-Id: I10809db554e668a853d28e7dca48b2de0ed51ad3 Reviewed-on: https://code.wireshark.org/review/6190 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31"#else", not "#elif", for the last part of a chain of conditionals.Guy Harris1-2/+24
Also give more details, for future reference, on how to determine whether the processor supports CPUID. Change-Id: I01e7173e45b0079f02338e51248238c05302dbd2 Reviewed-on: https://code.wireshark.org/review/6189 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31ws_cpuid() returns a success/failure indication; make it gboolean.Guy Harris1-10/+10
Change-Id: I03403ce29c4ac343d56fc2cf33aa8da90a082cbb Reviewed-on: https://code.wireshark.org/review/6185 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31Distinguish between IA-32 and non-x86.Guy Harris1-3/+9
In case we make ws_cpuid() work on IA-32 processors, add a separate "always returns no" version of ws_cpuid() for non-x86 processors. Change-Id: Id6fbd3e5c7d4f04063bc9bcd8f1644cd617b297e Reviewed-on: https://code.wireshark.org/review/6184 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31Move some routines into ws_version_info.c.Guy Harris11-492/+153
The routines to get compiler, GLib version, CPU, and memory info are used only in routines in ws_version_info.c; move them into ws_version_info.c and make them static. Change-Id: I58edd18da3301095012d2c7a3c5198e5a7073964 Reviewed-on: https://code.wireshark.org/review/6183 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31Do the full string in get_{compiled,runtime}_version_info().Guy Harris2-24/+46
Have them start the string with "Compiled" or "Running on", and return the string when done. Change-Id: Ic4d290c963621fa0385dc5aab766fd4ad31d3810 Reviewed-on: https://code.wireshark.org/review/6155 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31Move the version_info.c stuff to wsutil/ws_version_info.c.Guy Harris2-1/+135
Change-Id: I3a5c7e219974bfb924819b43b4d445eaf00e5bde Reviewed-on: https://code.wireshark.org/review/6153 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-29Restore string.h to os_version.cMartin Mathieson1-0/+1
Change-Id: I810a38c56829d5d3beaccc0171fc76f26ad79b52 Reviewed-on: https://code.wireshark.org/review/6108 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-29Add back string.h to sha1.c and sober128.cMartin Mathieson2-0/+2
Change-Id: Idd8963717eab804f7d76652d1baf029be8b5997f Reviewed-on: https://code.wireshark.org/review/6105 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-29Restore string.h to md4.cMartin Mathieson1-0/+1
Change-Id: I1a2c57ea20bcb1fd22c0379f3f43d3589e497c1b Reviewed-on: https://code.wireshark.org/review/6104 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-29Add string.h back to rc4.cMartin Mathieson1-0/+1
Change-Id: Idea9369742373e4a50edb3f391bdabfeeb3a2ca7 Reviewed-on: https://code.wireshark.org/review/6103 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-29Add back string.hMartin Mathieson1-0/+1
Change-Id: Ia61c72c7e8d1ef92ec5a38d534620fc225eef365 Reviewed-on: https://code.wireshark.org/review/6102 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-28Add a couple of more needed includesMartin Mathieson2-1/+2
Change-Id: Ie160f81544c6c9b381078b555e91602617cb2700 Reviewed-on: https://code.wireshark.org/review/6101 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-28Restore string.h as OS X misses it for strlen()Martin Mathieson1-0/+1
Change-Id: If1a968d54eed97fae915b8546d8d7a65a56b82db Reviewed-on: https://code.wireshark.org/review/6100 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-28Deleting unnecessary #includes from wsutil.Martin Mathieson23-34/+1
Will look at cleaning up and committing script afterwards. Change-Id: Id785e581740ab62fe9258ecfcb0926761ad9c527 Reviewed-on: https://code.wireshark.org/review/6086 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-28Removed duplicated #include linesDario Lombardo2-2/+0
Change-Id: I9cafa3cd5c74121168777d8c656e7e94e89efd3c Reviewed-on: https://code.wireshark.org/review/6065 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-25Check for getopt_long(), not getopt().Guy Harris1-1/+1
We support three types of platforms: 1) UN*Xes that have both getopt() and getopt_long(); 2) UN*Xes that have getopt() but not getopt_long(); 3) Windows, which has neither. Checking for getopt_long() lets us distinguish between 1) and 2) and build getopt_long() for them. Change-Id: Iaf0f142f9bebaa2eed2128d544ec9786711def45 Reviewed-on: https://code.wireshark.org/review/6045 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-25Include some files based on whether the functions they define are present.Guy Harris1-3/+12
Rather than including wsgetopt.c, inet_aton.c, and strptime.c iff we're building for Windows: include wsgetopt.c iff we don't have getopt(); include inet_aton.c iff we don't have inet_aton(); include strptime.c iff we don't have strptime(). Change-Id: Ibd68306ac372a4ae102c3220a94cdf6ecb04e58c Reviewed-on: https://code.wireshark.org/review/6044 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-24Don't use extra variables for ws_mempbrk_sse42.c and popcount.cGuy Harris1-14/+8
Instead, just add to WSUTIL_FILES as necessary. Change-Id: Iecadbd9a66ec54ee5d90aecfbfe5e636ae56e27e Reviewed-on: https://code.wireshark.org/review/6043 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-24Move twelve show_version() functions from the varoius programs andStephen Fisher2-0/+20
Wireshark UI files into a single one in wsutil. Change-Id: I0a64f0cc8106bd681bd185289c36272c4c43baad Reviewed-on: https://code.wireshark.org/review/6026 Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-23Cmake: check for popcount, and build it from wsutil/popcount.c if missing.Guy Harris1-0/+7
Change-Id: Id646a9f0b1fc6acafa99a78725e3f0ec8a48c170 Reviewed-on: https://code.wireshark.org/review/6006 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-23Try to fix Windows build for popcount() unresolved external symbolStephen Fisher1-0/+1
Change-Id: Ie154caa1967ce4016dd52eefcf757e2e58d7ac68 Reviewed-on: https://code.wireshark.org/review/6005 Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-23Move popcount() to an optionally built part of wsutil for systems thatStephen Fisher3-0/+77
provide their own popcount(). Change-Id: Ic26f3b50cf0bd2b4af0d42e9c27488ebbac1ab33 Reviewed-on: https://code.wireshark.org/review/5998 Petri-Dish: Stephen Fisher <sfisher@sdf.org> Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-22Fix unknown command tag name [-Wdocumentation-unknown-command]Alexis La Goutte1-1/+2
Change-Id: I6c2564a86e13d9321001856ba1f51681a9f20976 Reviewed-on: https://code.wireshark.org/review/5979 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-12-20Don't bother with __builtin_floorl().Guy Harris1-11/+0
At least as I read the GCC documentation, if GCC supports a builtin floorl() at all, it will always treat floorl() and __builtin_floorl() the same (it's reserved in C90 and defined in C99, so nobody should ever write C code assuming floorl() won't be treated in that afshion). In addition, the GCC 3.3.6 manual says nothing about __builtin_floorl(), so it probably won't help to use it. If it appears to help, there's probably something else going on. Also, GCC appears not to like "#ifdef (__GNUC__)", as the parentheses mean it's testing an expression, not a macro name. Change-Id: Ib88b52c366d7f3b1637bb408fb18d04b67c27e4b Reviewed-on: https://code.wireshark.org/review/5909 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-20Include <math.h> to declare floor().Guy Harris1-0/+2
Change-Id: I39de31c3e38b83aaec76396048e6960f609bc63e Reviewed-on: https://code.wireshark.org/review/5907 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-20Remove trailing white space.Guy Harris2-2/+2
Change-Id: I0777945a5234cf380e2f3bc2461cc638c316f499 Reviewed-on: https://code.wireshark.org/review/5906 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-20Rename wsutil/floor.[ch] to wsutil/floorl.[ch].Guy Harris3-7/+7
That better indicates what they do - they don't supply floor(), as that's a standard math.h feature dating back before C89, they supply floorl(). Change-Id: Ib1278c51cdfc57680c28c51de87eafb2cb50c8eb Reviewed-on: https://code.wireshark.org/review/5905 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-20If we don't have GCC, fall back on using floor().Guy Harris1-2/+10
Add the closing brace for the function body while we're at it. Change-Id: I73170fdc0885972dce531b553ff8601cceea182e Reviewed-on: https://code.wireshark.org/review/5902 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-20Handle floorl() the same way we handle other not-on-all-platforms functions.Guy Harris2-4/+11
Use AC_CHECK_FUNC() for it, define FLOORL_LO to floorl.lo if we *don't* have it, add FLOORL_LO to the list of items conditionally built in libwsutil, and include "wsutil/floor.h" only if HAVE_FLOORL is *not* defined, as that means it's *not* supplied by the platform and thus *not* declared in <math.h>. Also, use the standard export stuff in wsutil/floor.h. Change-Id: Ic24aa69f65f2d15450d8b84b0c2b0c58f38edebe Reviewed-on: https://code.wireshark.org/review/5901 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-20Include floor.c and floor.h in the source tarball.Guy Harris1-0/+2
Change-Id: Iabc0403643a05eaa7dbd525a94bc720d100d54d5 Reviewed-on: https://code.wireshark.org/review/5899 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-20Another missing changeStephen Fisher1-2/+1
Change-Id: Icaaaeda75f411ecc7cf3027440c8af2b85021be3 Reviewed-on: https://code.wireshark.org/review/5897 Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-19Add missing files from last commitStephen Fisher2-0/+70
Change-Id: I4a6dd1b60893d19b91f5bc0f85be9ee99cd3eb5e Reviewed-on: https://code.wireshark.org/review/5892 Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-19Revert "Provide a floorl() function (which is currently only able to call ↵Stephen Fisher1-2/+0
GCC's __builtin_floorl() function) for systems which don't provide one." because I left off the new wsutil/floor.[ch] files This reverts commit e2586ec36d0d924b933d2127e809918b980cb413. Change-Id: Ie38b7f32b2d21e3beba5173eec22ca12b7f5da91 Reviewed-on: https://code.wireshark.org/review/5891 Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-12-19Provide a floorl() function (which is currently only able to call GCC'sStephen Fisher1-0/+2
__builtin_floorl() function) for systems which don't provide one. Change-Id: Ie0140ff195f0eae525c7bd70c7c3e23039fde569 Reviewed-on: https://code.wireshark.org/review/5889 Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-11-26Update the URL for the CPUID instruction documentation.Stephen Fisher1-1/+2
Change-Id: I9729b3aa11027783a3557468743e91e180a6de8d Reviewed-on: https://code.wireshark.org/review/5509 Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-11-19[pedantic] Replace usage of 'long' and 'long long'Bill Meier2-3/+3
Change-Id: I78fc82c1a83eb04d78a11fc76710c92dfc916208 Reviewed-on: https://code.wireshark.org/review/5395 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-11-05ws_mempbrk_sse42.c: remove inclusion of stdint.h as it's no more required ↵Pascal Quantin1-1/+0
after g79e4da4 Change-Id: I48776a286ba1d412ecda55857938d9daa77fd3f7 Reviewed-on: https://code.wireshark.org/review/5136 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-11-04Fix compilation error on FreeBSD 10.0-RELEASE (with clang): change int8_t toStephen Fisher1-1/+1
gint. Change-Id: I7974497a8f50e5d18ec74aa7554f058056a6022c Reviewed-on: https://code.wireshark.org/review/5115 Petri-Dish: Stephen Fisher <stephenfisher@centurylink.net> Reviewed-by: Stephen Fisher <stephenfisher@centurylink.net>
2014-11-03Don't use -msse4.2 with MSVC.Guy Harris1-5/+17
Change-Id: I457d45d9ad05e0eb851e78a7342e666ef9df8ffd Reviewed-on: https://code.wireshark.org/review/5086 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-02Add identification of Windows (Server) 10Pascal Quantin1-0/+3
Change-Id: I5ab7a4dc67ceac644faead0d9e460e3babaf6355 Reviewed-on: https://code.wireshark.org/review/5067 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-11-01Validate no_of_bits in ws_sign_ext32 and ws_sign_ext64Stig Bjørlykke1-0/+10
The result of the '<<' expression is undefined if no_of_bits - 1 is negative. Change-Id: I3fff09afe414bdd9d6736ee351f1c542c503b93d Reviewed-on: https://code.wireshark.org/review/4698 Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-10-30Remove the optional strncasecmp.{h,c} target (for systems that don't have ↵Jeff Morriss5-115/+6
that API). strncasecmp() has been prohibited for years (in favor of the g_ascii_ version). Change-Id: I64b7c29099b1c5240757e2026fe3490096a84755 Reviewed-on: https://code.wireshark.org/review/4980 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>