aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil/str_util.c
AgeCommit message (Collapse)AuthorFilesLines
2015-02-18Not all compilers support turning of "format=".Guy Harris1-2/+2
The clang on my machine doesn't; just do "format" instead. (The best way to handle this may be to do the formatting ourselves, so that we can get thousands separators on *all* platforms, regardless of whether its printf formatter supports it.) Change-Id: I1948d1799688cb3cf1d7b0de0696c09f6bf23f1c Reviewed-on: https://code.wireshark.org/review/7241 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-18Suppress a printf grouping warning.Gerald Combs1-0/+3
Suppress warning: ISO C does not support the ''' printf flag [-Wformat=] We verify that we *do* support it via HAVE_GLIB_PRINTF_GROUPING. Change-Id: Iedcf1d1856238e05babde5fe8ec23f64fbf2cdcf Reviewed-on: https://code.wireshark.org/review/7238 Reviewed-by: Gerald Combs <gerald@wireshark.org>
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>
2014-12-28Deleting unnecessary #includes from wsutil.Martin Mathieson1-1/+0
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-10-17Don't use ctype.h routines.Guy Harris1-3/+1
That avoids locale dependency and handles possibly-signed chars (which we weren't doing before). Change-Id: I189222eff624ad2d2e960bc0b69f3f22d35f351f Reviewed-on: https://code.wireshark.org/review/4787 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-14Add editor-modelines; adjust whitespace.Bill Meier1-7/+20
Change-Id: I8cad872cee972a6d22a72852dac57fd188daca84 Reviewed-on: https://code.wireshark.org/review/4683 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-04Don't print non-printable characters in AX.25 addresses.Jeff Morriss1-1/+9
Add a new routine to wsutil to make this easy: printable_char_or_period(). Bug: 10439 Change-Id: I0eb2bb6bc0676a1035c3d845b5e20276fa04de60 Reviewed-on: https://code.wireshark.org/review/3981 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-24Clean up capinfos output.Guy Harris1-4/+10
Make sure there's always a space between a number and "[TGMK]bytes", "[TGMK]bits", and "[TGMK]packets". Change-Id: I710385303e451e9aea6fc9bbea562f59ca0d22c9 Reviewed-on: https://code.wireshark.org/review/3810 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-21[WIP] Add a conversation dialog.Gerald Combs1-2/+2
Items are sorted by value. Move common conversation code to ui/conversation_hash.[ch]. Add a conversation_type_e enum along with convenience functions for fetching titles, tap names, etc. We have a single main dialog instead of a main dialog + individual protocol dialogs. It de-clutters the statistics menu and results in simpler code. Conversation type tabs can be added and removed within the dialog itself. The tab list is sticky and saved with the current profile when the dialog closes. Data can be copied as CSV or YAML. Add a FilterAction class and a corresponding filterAction slot to MainWindow. Use it for the Conversations context menu. Add an addressResolutionChanged signal and related plumbing. Get rid of the iterator members in the conversation item struct. Update the GTK+ code accordingly. Excercise for the reader: - Update TShark to use the common hash code. Ping-Bug: 9231 Ping-Bug: 8703 Ping-Bug: 6727 Change-Id: I8728d771fc5b1a85937bed9d898e53c3ecc3a544 Reviewed-on: https://code.wireshark.org/review/2987 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-13isprint() -> g_ascii_isprint()AndersBroman1-1/+1
Change-Id: Ia586ef8ce500d5fc7578c52014206fa7a7eaea41 Reviewed-on: https://code.wireshark.org/review/1624 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-13In ascii_xx_inplace use g_ascii_isupper/g_ascii_islower directly, itAndersBroman1-2/+4
*should* be slightly more efficient. Change-Id: I3081e2e25f241cdb07fa46011f50709fd560fb1c Reviewed-on: https://code.wireshark.org/review/1626 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-01-08Move UAT xton() to wsutil libraryJakub Zawadzki1-0/+24
Use ws_xton() in few more places. svn path=/trunk/; revision=54642
2013-07-01Define certain 'const char *...' arrays as static.Bill Meier1-1/+1
(That is: Don't create the array on the stack each time the function is called). Reduces code memory usage and execution time. (See SVN #50271) svn path=/trunk/; revision=50300
2013-03-03Check to see if GLib's printf routines support the X/Open / POSIXGerald Combs1-5/+11
thousands grouping (') flag and use it in format_size if it's available. As far as I can tell this translates to "everywhere except Windows and OpenBSD". According to the various build logs at https://build.opensuse.org/package/show?package=mingw32-glib2&project=windows%3Amingw%3Awin32 the OBS GLib packages enable GLib's internal printf implementation from Gnulib which means we *should* be able to enable this on Windows. Unfortunately this doesn't appear to be the case. svn path=/trunk/; revision=48042
2013-02-28From Anders: revert r47934: it doesn't work everywhere.Jeff Morriss1-5/+5
See email discussion on -dev. svn path=/trunk/; revision=47940
2013-02-28str_util.c: Although the glib documentation doesn't explicitly say so,Gerald Combs1-5/+5
it looks like the thousands grouping (') modifier is supported so use it in format_size. capinfos.c: Set our locale. svn path=/trunk/; revision=47934
2013-02-26Print human-readable statistics by default. Raw values can be printedGerald Combs1-0/+3
using "-M". Based on a suggestion by Hansang Bae. svn path=/trunk/; revision=47900
2012-12-26Squash some sign-conversion warnings that g++ picks up but gcc doesEvan Huus1-1/+1
not. QtShark now builds warning-free (for me at least). svn path=/trunk/; revision=46786
2012-12-26Fix a bunch of warnings.Guy Harris1-1/+1
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of sizeof. Cast away some implicit 64-bit-to-32-bit conversion errors due to use of strtol() and strtoul(). Change some data types to avoid those implicit conversion warnings. When assigning a constant to a float, make sure the constant isn't a double, by appending "f" to the constant. Constify a bunch of variables, parameters, and return values to eliminate warnings due to strings being given const qualifiers. Cast away those warnings in some cases where an API we don't control forces us to do so. Enable a bunch of additional warnings by default. Note why at least some of the other warnings aren't enabled. randpkt.c and text2pcap.c are used to build programs, so they don't need to be in EXTRA_DIST. If the user specifies --enable-warnings-as-errors, add -Werror *even if the user specified --enable-extra-gcc-flags; assume they know what they're doing and are willing to have the compile fail due to the extra GCC warnings being treated as errors. svn path=/trunk/; revision=46748
2012-10-10Fix a copy+paste error and a missing include. Adjust the format_sizeGerald Combs1-4/+4
digit threshold. svn path=/trunk/; revision=45456
2012-10-10Add a format_size function similar to g_format_size that renders a sizeGerald Combs1-0/+51
value in a human-readable format. Use it in the welcome screen, status bar, and Win32 interface details. Note that in the welcome screen and status bar we've switched from customary binary prefixes to strict SI. svn path=/trunk/; revision=45453
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45015
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-06-25Revert 43481: linking dftest against libui was not the problem.Jeff Morriss1-42/+0
svn path=/trunk/; revision=43488
2012-06-25Move get_args_as_string from ui/util.c into wsutil (maybe not to the bestJeff Morriss1-0/+42
module, but...). This makes dftest no longer dependent on libui, so stop linking against it. svn path=/trunk/; revision=43481
2012-02-17Move exec_isdigit_string() and exec_isprint_string() functions out ofStephen Fisher1-0/+38
the exec dissector and into wsutil/str_util.c. Rename them to isdigit_string() and isprint_string(). Also rename the variables they use for consistency: string -> str and position -> pos. svn path=/trunk/; revision=41053
2009-01-17Revise ascii...inplace to return a ptr to the string Bill Meier1-2/+6
svn path=/trunk/; revision=27253
2008-09-03g_ascii_strdown() and g_ascii_strup(), unlike g_strdown() and g_strup(),Guy Harris1-0/+50
do *not* modify the string handed to them - they g_mallocate a new string and return it. Create routines that *do* ASCII-only case mapping in place, and use them instead. Clean up indentation. svn path=/trunk/; revision=26131