aboutsummaryrefslogtreecommitdiffstats
path: root/epan/strutil.c
AgeCommit message (Collapse)AuthorFilesLines
2016-01-20Fix constnessJoão Valverde1-2/+2
Change-Id: I29723dae83373768edd254c60e48a717abf20694 Reviewed-on: https://code.wireshark.org/review/13436 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2015-01-18Remove some apparently-unnecessary includes of emem.h.Guy Harris1-1/+0
Change-Id: Ib7d1b587b439ff21ec6b7f1756ce6ccf25b66f80 Reviewed-on: https://code.wireshark.org/review/6635 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17Don't use ctype.h routines.Guy Harris1-24/+23
That avoids locale dependency and handles possibly-signed chars (which we weren't always doing before). Change-Id: Ieceb93029252f646397b6488f2df8a57c6d2a23d Reviewed-on: https://code.wireshark.org/review/4794 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-16Oops, I missed one "cast a char to int and use it as a subscript" case.Guy Harris1-1/+1
Casting a signed char with a negative value to int will preserve the value, so it'll still be a negative subscript. Cast to guchar instead, to make sure 0x80 through 0xFF are treated as 128 to 255, not -128 to -1. Change-Id: I1f0b33ba3686e963d45317b45465ff335431d17f Reviewed-on: https://code.wireshark.org/review/4742 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-16Fix some more "char is unsigned" issues, and a possible "char is signed" one.Guy Harris1-4/+4
C neither guarantees that char is signed nor that it's unsigned. Make the str_to_nibble tables arrays of gint8, to make sure they can hold numbers between 0 and 15 as well as -1. Cast gchar to guchar, not int, when using it as a subscript into that array, so that the subscripts are in the range 0 to 255, not -128 to 127. Change-Id: Ib85de5aa4e83ae9efd808c78ce3f86f45b4a3f2a Reviewed-on: https://code.wireshark.org/review/4734 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-06Revert "Qt: Try to fix a Visual C++ encoding warning."Gerald Combs1-1/+1
Revert gafa8c02 since it didn't work on Windows. Use a pragma to squelch Visual C++ instead. Qt's rich text renderer doesn't handle "&apos;". Replace it with "&#x27;". Remove a QDebug include. Change-Id: I0e6308efda74a4bc0e67ce841a50a0a9b68f4a8b Reviewed-on: https://code.wireshark.org/review/4511 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-09-04Fix up some formatting.Jeff Morriss1-7/+15
Change-Id: Ib38561ad5cf0f532e43ae3e10bbb857bb24ab9b6 Reviewed-on: https://code.wireshark.org/review/3980 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-04-17Add tvb_get and proto_tree_add for string-encoded byte arraysHadriel Kaplan1-1/+128
This commit adds tvb_get_string_bytes and proto_tree_add_bytes_item routines for getting GByteArrays fields from the tvb when they are encoded in ASCII hex string form. The proto_tree_add_bytes_item routine is also usable for normal binary encoded byte arrays, and has the advantage of retrieving the array values even if there's no proto tree. It also exposes the routines to Lua, both so that a Lua script can take advantage of this, but also so I can write a testsuite to test the functions. Change-Id: I112a038653df6482a5d0ebe7c95708f207319e20 Reviewed-on: https://code.wireshark.org/review/1158 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> 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-02-25Remove trailing whitespaceBill Meier1-8/+8
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0 Reviewed-on: https://code.wireshark.org/review/385 Reviewed-by: Bill Meier <wmeier@newsguy.com> Tested-by: Bill Meier <wmeier@newsguy.com>
2014-01-08Move UAT xton() to wsutil libraryJakub Zawadzki1-12/+3
Use ws_xton() in few more places. svn path=/trunk/; revision=54642
2013-12-21isascii(x) && isprint(x) -> g_ascii_isprint(x)Jakub Zawadzki1-2/+2
svn path=/trunk/; revision=54328
2013-12-21Drop isprint.h use g_ascii_isprint() when this include hack was enabled.Jakub Zawadzki1-8/+7
svn path=/trunk/; revision=54327
2013-11-16Fix epan_memmem() copyrights.Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=53366
2013-10-12From RobiOneKenobi via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9229Evan Huus1-0/+65
Add a new strutil function format_text_chr that replaces unprintable characters with a single passed-in char (eg a '.' or a '-') instead of a C-style escape. This is useful for displaying binary data that frequently but not always contains text; otherwise the number of C escape codes makes it unreadable. svn path=/trunk/; revision=52563
2013-10-06Add support for RELATIVE-OID ASN.1 type. Bug 9192 ↵Michael Mann1-2/+7
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9192) From Ed Beroset. svn path=/trunk/; revision=52393
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-05-20Make the minimum supported GLib version 2.16.Gerald Combs1-29/+0
svn path=/trunk/; revision=49444
2013-03-18From beroset:Anders Broman1-10/+10
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48400
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-12-22trivial: clean up epan/strutil.cMartin Kaiser1-767/+772
replace TABs with spaces add editor modelines svn path=/trunk/; revision=46706
2012-10-22g_strcmp0 first occures in GLIB 2.16 define it localy if it does not existAnders Broman1-0/+29
to make builds on Fedora 8 with GTK 2.12 work. svn path=/trunk/; revision=45707
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=45016
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-05-28While iterating over string characters don't use strlen(), but check for NUL.Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=42883
2012-05-20Revert r35131 fix bug #5738Jakub Zawadzki1-2/+2
g_unichar_isprint() is for *wide characters*. For UTF-8 multibyte characters we could use g_utf8_validate() and g_utf8_next_char(), but IMHO format_text_* should be ASCII-only. We rather need to store encoding of FT_STRING[Z] and in proto_item_fill_label() call appropiate function. For ENC_ASCII use format_text(), for unicode (ENC_UTF*, ENC_UCS*) use format_text_utf(), etc.. svn path=/trunk/; revision=42727
2012-04-16From Evan Huus:Anders Broman1-2/+0
Duplicate and misplaced 'break' statements. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7106 svn path=/trunk/; revision=42091
2012-04-09Add missing const attribute to some char *Jakub Zawadzki1-1/+1
Fix some "assignment discards qualifiers from pointer target type", etc svn path=/trunk/; revision=41996
2011-06-16Squelch some compiler warnings.Guy Harris1-4/+6
svn path=/trunk/; revision=37685
2011-04-13Change ws_strdup_escape_underscore() function to be more general, byStephen Fisher1-10/+10
accepting any character as the escaped character. Change existing uses to use '_' for the underscore escaping. svn path=/trunk/; revision=36627
2011-02-18Fix some dead code and zero division issues found by Clang scan-build.Gerald Combs1-13/+6
In convert_string_case() use g_utf8_strup() instead of converting each character by hand. Hopefully this won't cause any unexpected changes in behavior. svn path=/trunk/; revision=36006
2010-12-06Change format_text() and format_text_wsp() to use g_unichar_isprint() forStephen Fisher1-2/+2
UTF-8 support instead of isprint(). This allows the middle packet details pane to display UTF-8 strings instead of escaping them with \xxx notation. svn path=/trunk/; revision=35131
2010-11-04Corrected some pointer types to avoid warnings from clang.Stig Bjørlykke1-2/+2
svn path=/trunk/; revision=34774
2010-08-30Use the top-level isprint.h instead of redefining isprint ourselves.Jeff Morriss1-20/+7
svn path=/trunk/; revision=34016
2010-05-27From Edgar Gladkich:Gerald Combs1-0/+16
This is an extension to the Wireshark context sensitive protocol help. Rows in TreeView window are analyzed and suitable help file (as HTML) is opened in a browser. The help part (large file, 23 MB) of the Protocol Help can be downloaded under www.inacon.com/dowload/stuff/protocol_help.tar.gz This protocol help "light" provides descriptive content for the most frequently used standard protocols, including IP, TCP or SMTP. From me: Changes: Rename "ph_" in some function names to "proto_help_". Move the protocol help code to its own module. Make a bunch of functions static. Remove unused code. Use browser_open_url() instead of a custom function. Increase the logging levels. Don't clobber the normal log handler. Update some Doxygen comments to match the format in the rest of the code base. Removed GTK version checks. We've been 2.x only for a while. Move ph_replace_string to string_replace() in epan/strutil.[ch]. Fix a bunch of memory leaks. Add a NULL pointer check. Reformat the overview menu label. Document the file format and locations. Add Edgar to AUTHORS. svn path=/trunk/; revision=32995
2010-02-23From Jakub Zawadzki:Anders Broman1-43/+0
Optimizations. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4303 svn path=/trunk/; revision=31967
2010-01-28Fix various gcc -Wshadow warnings.Bill Meier1-4/+4
svn path=/trunk/; revision=31720
2010-01-26Move underscore escaping/unscaping function to strutil.c;Gerasimos Dimitriadis1-0/+56
Update decoding of IS-801 Request GPS Acquisition Assistance svn path=/trunk/; revision=31685
2009-10-23Move IA5_7BIT_decode to strutil.cAnders Broman1-0/+54
svn path=/trunk/; revision=30669
2009-10-01Remove comment asking if this function should be in strutil.c since it isStephen Fisher1-1/+0
already there. svn path=/trunk/; revision=30225
2009-08-19From Didier Gautheron:Anders Broman1-0/+65
Part 2 Extracted from optimizations patch http://wiki.wireshark.org/Development/Optimization Optimize expert info. Slightly changed by me. svn path=/trunk/; revision=29478
2009-04-08More size_t fixes. Use a string buffer in range.c.Gerald Combs1-1/+1
svn path=/trunk/; revision=27999
2009-03-30Add a couple of size_t casts to packet-dnp.c.Gerald Combs1-2/+2
Make the length arguments of format_text() and format_text_wsp() size_t's, since it's natural to use strlen() for that. svn path=/trunk/; revision=27891
2009-02-17Add a string utility function "string_or_null" which can be used toGerald Combs1-0/+8
guarantee a non-null string value. Use it in the LDAP dissector. Fixes the crash on Windows (and other platforms) reported in bug 3262. svn path=/trunk/; revision=27478
2008-07-12Small whitespace fix.Stig Bjørlykke1-1/+1
svn path=/trunk/; revision=25726
2008-05-05Fix a tpyoJörg Mayer1-1/+1
svn path=/trunk/; revision=25227
2008-04-09Remove:Anders Broman1-4/+0
#ifdef NEED_G_ASCII_STRCASECMP_H #include "g_ascii_strcasecmp.h" #endif svn path=/trunk/; revision=24859
2008-04-07- Remove GLIB1 codeStephen Fisher1-94/+0
- Change ugly GLIB version checking statements to GLIB_CHECK_VERSION - Remove ws_strsplit files because we no longer need to borrow GLIB2's g_strsplit code for the no longer supported GLIB1 builds svn path=/trunk/; revision=24829
2007-11-27strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delendaGuy Harris1-1/+5
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our own versions if they're missing from GLib (as is the case with GLib 1.x). In the code to build the list of named fields for Diameter, don't use g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping in the hash function and use g_ascii_strcasecmp() in the compare function. We do this because there is no guarantee that toupper(), tolower(), and functions that use them will, for example, map between "I" and "i" in all locales; in Turkish locales, for example, there are, in both upper case and lower case, versions of "i" with and without a dot, and the upper-case version of "i" is "I"-with-a-dot and the lower-case version of "I" is "i"-without-a-dot. This causes strings that should match not to match. This finishes fixing bug 2010 - an earlier checkin prevented the crash (as there are other ways to produce the same crash, e.g. a bogus dictionary.xml file), but didn't fix the case-insensitive string matching. svn path=/trunk/; revision=23623
2007-11-06add a g_byte_array_sized_new() helper if we compile for glib < 2Ronnie Sahlberg1-0/+14
svn path=/trunk/; revision=23373