aboutsummaryrefslogtreecommitdiffstats
path: root/epan/strutil.c
AgeCommit message (Collapse)AuthorFilesLines
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
2006-09-22Add support for reading from stdin under Windows. Based on a patch sentGerald Combs1-88/+1
in last year by Gianluca Varenni. Add partial support for reading from named pipes (currently disabled). Move utf_8to16() and utf_16to8() to a separate module (unicode-utils.[ch]) so that we don't have to cut and paste code in dumpcap.c. Fix up whitespace. svn path=/trunk/; revision=19291
2006-06-19New rutine tvb_format_text_wsp() which will change "whiite space" characters ↵Anders Broman1-5/+114
to space before output. svn path=/trunk/; revision=18519
2006-05-28Ethereal->WiresharkAnders Broman1-1/+1
svn path=/trunk/; revision=18234
2006-05-21name changeRonnie Sahlberg1-2/+2
svn path=/trunk/; revision=18197
2006-05-18Put a newline at the end of the file.Guy Harris1-1/+1
svn path=/trunk/; revision=18184
2006-04-27Properly grow our buffers for utf_8to16().Gerald Combs1-1/+1
svn path=/trunk/; revision=18017
2006-03-08Use Unicode for all native Win32 calls. Unicode Windows applicationsGerald Combs1-0/+91
use UTF-16 internally and GTK+ 2.x uses UTF-8, which means we have to do a lots of conversions. Add utf_8to16() and utf_16to8 convenience functions to strutil.c. svn path=/trunk/; revision=17534
2006-03-07Remove a case statement which can never be reached, because theGilbert Ramirez1-5/+0
previous isprint() test covers that case. This fixes Coverity bug ID #2. svn path=/trunk/; revision=17507
2006-02-23create a real function to emulate g_strlcat() for GTK<2Ronnie Sahlberg1-0/+14
so that the linker will find it. This eliminates the need to include strutil.h (where this was previously a macro) in all callers of this function. svn path=/trunk/; revision=17392
2005-12-04Squelch a GCC complaint.Guy Harris1-0/+1
svn path=/trunk/; revision=16670
2005-12-02new field type FT_OID for OBJECT IDENTIFIERsTomas Kukosa1-0/+57
svn path=/trunk/; revision=16652
2005-08-17replace some more silly rotating buffers with ep_alloc() callsRonnie Sahlberg1-6/+2
svn path=/trunk/; revision=15386
2004-11-28Change number of bytes displayed in bytes_to_string to 48 to facilitate ↵Anders Broman1-1/+1
display of sha1 digest of 20 bytes. svn path=/trunk/; revision=12612
2004-10-29Have the usual three separate buffers for "format_text()", so that itGuy Harris1-23/+26
can be used multiple times in a single formatting call. svn path=/trunk/; revision=12428
2004-08-13Move convert_string_to_hex() and convert_string_case() from gtk/find_dlg.cGerald Combs1-0/+110
to epan/strutil.c svn path=/trunk/; revision=11733
2004-07-18Set the svn:eol-style property on all text files to "native", so thatGuy Harris1-1/+1
they have LF at the end of the line on UN*X and CR/LF on Windows; hopefully this means that if a CR/LF version is checked in on Windows, the CRs will be stripped so that they show up only when checked out on Windows, not on UN*X. svn path=/trunk/; revision=11400
2004-06-06Add a "force_separators" parameter to hex_str_to_bytes so that it'sGerald Combs1-7/+5
possible to paste in WEP keys without any separators. Add doxygen comments to strutil.h. svn path=/trunk/; revision=11123
2004-05-01GLib 1.2[.x]'s "g_string_free()" doesn't return a value.Guy Harris1-1/+13
svn path=/trunk/; revision=10765
2004-05-01Add an XML escaping routine: xml_escape()Olivier Biot1-1/+40
svn path=/trunk/; revision=10759
2004-02-05We can't test the GTK+ version in dissectors or libethereal code, asGuy Harris1-2/+6
they don't include any GTK+ headers (and shouldn't do so, as they can't use GTK+); we use the GLib version as a proxy. svn path=/trunk/; revision=9982
2004-02-01Add consts to fix 'cast discards qualifiers from pointer target type'Jörg Mayer1-3/+3
svn path=/trunk/; revision=9937
2004-01-25Change the first arg to hex_str_to_bytes from guchar* -> char*Jörg Mayer1-2/+2
svn path=/trunk/; revision=9842
2003-12-29"hex_str_to_bytes()" modifies the GByteArray supplied to it, so don'tGuy Harris1-2/+2
mark it as "const". svn path=/trunk/; revision=9474
2003-12-29Pull most of bytes_from_unparsed() into a new routine,Gerald Combs1-1/+92
hex_str_to_bytes(). Use the new routine to initialize any WEP keys we have defined. This has the side effect of fixing an overflow if the user entered a long WEP key. svn path=/trunk/; revision=9471
2003-12-24Do the "isprint()" hack for GTK+ 2.x or 1.3[.x], whether on UNIX orGuy Harris1-7/+7
Windows - the problem is that GTK+ 1.3[.x] and later assume strings handed to them are UTF-8 strings, not, for example, ISO 8859/x strings. In packet-radius.c, re-define "isprint()" rather than #ifdeffing its use (the old code was also incorrectly treating 0x7f as a printable). svn path=/trunk/; revision=9435
2003-08-27Add a "contains" operator for byte-strings, strings, and tvbuffs (protocols).Gilbert Ramirez1-1/+32
The search uses a naive approach; more work is required to add a Boyer-Moore Search algorithm. svn path=/trunk/; revision=8280
2003-08-01From Chris Heath: fix up the check for printable ASCII done on WindowsGuy Harris1-13/+14
not to include DEL as printable ASCII. Also change the check in strutil.c to do it by redefining "isprint()", as is done in "gtk/gtkglobals.h", rather than by #ifdeffing the point at which the test is done. svn path=/trunk/; revision=8118
2002-12-31From Ronald Henderson: make "format_text()", on Windows, escape allGuy Harris1-3/+15
characters that aren't printable ASCII, as GTK+ for Windows thinks strings are UTF-8 but the strings we give it wouldn't be UTF-8. svn path=/trunk/; revision=6832
2002-08-28Removed trailing whitespaces from .h and .c files using theJörg Mayer1-6/+6
winapi_cleanup tool written by Patrik Stridvall for the wine project. svn path=/trunk/; revision=6116
2002-08-02Replace the types from sys/types.h and netinet/in.h by their glib.hJörg Mayer1-10/+10
equivalents for the epan/ directory but leave winsock2.h in inet_pton.c and inet_ntop.c for now (can't estimate the consequences). svn path=/trunk/; revision=5928
2000-12-22Enable FT_BYTES dfiltering, from Ed Warnicke.Gilbert Ramirez1-1/+13
svn path=/trunk/; revision=2768
2000-11-13Move "bytes_to_str()" to "strutil.c" from "packet.c" - it's just aGuy Harris1-1/+39
string formatter, like "format_text()", and, as "tvbuff.c" now calls it (*vide infra*), we don't want to have to make "tvbuff.c" drag "packet.h" in just to declare "bytes_to_str()". It's now declared in "strutil.h", so include it in modules that use "bytes_to_str()" and weren't already including it. Add a "tvb_bytes_to_str()" wrapper that calls "tvb_get_ptr()" to get a pointer to a chunk of N bytes at a given offset in a tvbuff and then hands that chunk to "bytes_to_str()". Convert the code that was doing that to use "tvb_bytes_to_str()" instead (which caught what I suspect is a bug in the Q.2931 dissector, where it was handing an offset of 0 to "tvb_get_ptr()" - a cut-and-pasteo, I think). Tvbuffify the ARP dissector. svn path=/trunk/; revision=2634
2000-11-10Tvbuffify the SAP and SDP dissectors.Guy Harris1-31/+1
Add "tvb_find_line_end_unquoted()" for the benefit of the SDP dissector; get rid of "find_line_end_unquoted()" as nobody uses it any more. Add "tvb_pbrk_guint8()" for the benefit of "tvb_find_line_end_unquoted()"; it searches for any of a number of characters, unlike "tvb_find_guint8()" which searches for only one. svn path=/trunk/; revision=2595
2000-11-09Support for embedded newlines in SDP fields, from Robert Tsai.Guy Harris1-1/+31
svn path=/trunk/; revision=2584
2000-09-30If a line consists *solely* of an LF, set "*eol" to point to the LF.Guy Harris1-1/+6
svn path=/trunk/; revision=2469
2000-09-29Dynamically grow the buffer used by "format_text()", rather than cuttingGuy Harris1-24/+37
the text off at 62 characters. svn path=/trunk/; revision=2466
2000-09-27First step in moving core Ethereal routines to libepan.Gilbert Ramirez1-0/+222
svn path=/trunk/; revision=2458