aboutsummaryrefslogtreecommitdiffstats
path: root/epan/strutil.c
AgeCommit message (Collapse)AuthorFilesLines
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
2007-10-27Apply yet another set of the optimization patches:Anders Broman1-1/+1
- Use a fast path for the most common use of tvb_get_xxx functions: offset is >= 0 and tvb->real_data is set (this one is always true). - match_strval() is a linear search, put the most common protocols TCP/UDP/RDP first. - fix gtk1 g_strlcat declaration Use g_strlcat svn path=/trunk/; revision=23285
2007-10-26Apply yet another set of the optimization patches:Anders Broman1-10/+60
Replace strncpy with g_strlcpy. Add g_strlcat for GTK1 and don't use g_snprintf in GTK1 g_strlcpy printf family is very slow. svn path=/trunk/; revision=23273
2007-07-14Fix yet more casts of ctype.h macro arguments - and fix some cases whereGuy Harris1-7/+7
we were passing an uncasted "char" to those macros. svn path=/trunk/; revision=22306
2007-06-21Be less restrictive about WEP key preferences. Use hex_str_to_bytes toGerald Combs1-4/+4
process WEP keys. Allow the "wep:" prefix for WEP keys even when HAVE_AIRPDCAP isn't defined. Add a NULL pointer check to hex_str_to_bytes(). Fixes bug 1584. Fixup indentation. svn path=/trunk/; revision=22151
2007-05-21make gtk1 compile againRonnie Sahlberg1-1/+2
svn path=/trunk/; revision=21854
2007-04-13Fix some Solaris buildbot warningsStephen Fisher1-3/+3
svn path=/trunk/; revision=21423
2007-02-07From: Gisle VanemLuis Ontanon1-0/+14
The file epan/dissectors/packet-k12.c uses the function strcasestr() which is not available on e.g. Windows. So I cooked up a patch to epan/strutil.c to add epan_strcasestr() (is there a more suited place for such a function?) svn path=/trunk/; revision=20734
2007-02-04From Sebastien Tandel:Stephen Fisher1-1/+2
Steve has modified a while ago hex_str_to_bytes to handle Cisco MAC format (xxxx.xxxx.xxxx). It did not test the nullity of the third and fourth byte (*r, *s) which is however done for the second byte. The test on the second byte is done as well in the following conditional tests. If this test is not mandatory thanks to the return value of isxdigit (at least on GNU/Linux and guess it should be the same on any platform), it would be better to follow the same logic in all tests cases for the comprehension of everyone (... which /could/ even, with luck, be turned in a faster code). Here is a light patch to follow the logic of the conditional tests done in the function. svn path=/trunk/; revision=20714
2007-02-01Allow byte strings (FT_BYTES) to have four digits seperated by - : and .Stephen Fisher1-11/+49
in addition to the currently supported two or one digit at a time. This applies in particular to the FT_ETHER MAC addresses, so that a MAC address can now be entered as xxxx.xxxx.xxxx in addition to the traditional formats. svn path=/trunk/; revision=20660
2007-01-25Fix a key preference crash bug. Improve WPA passphrase and SSID lengthGerald Combs1-1/+0
handling. Free a byte array. Squelch a compiler warning. Fix a URI string parsing bug. svn path=/trunk/; revision=20549
2007-01-15GLib 1.2 doesn't have g_strlcpy(), so don't use it.Gerald Combs1-3/+6
svn path=/trunk/; revision=20438
2007-01-11Fix compilation problems under Windows. In the GTK code, convert SSIDsGerald Combs1-3/+74
to GByteArrays. Add format_uri() to strutil, which formats a byte string with percent-escapes. Fixup whitespace and indentation. svn path=/trunk/; revision=20397
2007-01-11Add uri_str_to_bytes(), byte_array_dup(), and byte_array_equal()Gerald Combs1-0/+86
functions to strutil. Use GByteArrays to store SSIDs for decryption, and let the user specify arbitrary byte strings using percent-encoded strings. We should probably add percent encoding for pass phrases as well, so you can escape the ":" character. Move the key struct key conversion utilities to airpdcap.c, and remove duplicate code from packet-ieee80211.c. Fix a lot of indentation. svn path=/trunk/; revision=20388
2006-10-18In the 802.11 dissector, mark the "wep_keys" preference as obsolete,Gerald Combs1-0/+3
and replace it with an "enable_decryption" preference. Instead of forcing the user to specify how many WEP keys we have, figure it out for ourselves by parsing the key list. When decrypting, don't worry about the key index specified in the header (which resulted in trying to decrypt using the same key twice); simply try each key in order (which we were doing anyway). In hex_str_to_bytes(), handle a null hex string. Update the release notes. svn path=/trunk/; revision=19592