summaryrefslogtreecommitdiff
path: root/epan/tvbuff.c
AgeCommit message (Collapse)AuthorFilesLines
2014-04-12Add Mac Roman and DOS CP437.Guy Harris1-0/+16
Change-Id: Ib96f2cf4ea71cd0cc2c703d58b9d254bf4c1248a Reviewed-on: https://code.wireshark.org/review/1077 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-03Fix a typoAndersBroman1-1/+1
Change-Id: Ie32a140e49140a92c69cb6fa84cdc55402516830 Reviewed-on: https://code.wireshark.org/review/935 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-03Don't use external function internaly to avoid multiple checks.AndersBroman1-11/+48
tvb_captured_length() -> tvb->length tvb_captured_length_remaining(tvb, offset) -> (Inline) _tvb_captured_length_remaining() tvb_get_ptr() -> ensure_contiguous() Change-Id: I3540854c9b51ca9c3319b030c7d91b4aff976a26 Reviewed-on: https://code.wireshark.org/review/922 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-03In the string handling routines don't call tvb_get_...() inside the loops ↵AndersBroman1-28/+70
insted get the ptr and read directly avoiding the overhead of calling fast_ensure_contiguous() repeatibly. Change-Id: Ib5eee87ef9d49cb4e46b3b9c3d3db0134d3c4a32 Reviewed-on: https://code.wireshark.org/review/889 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-01Inlining some tvb function gives a 6% performance gain according toAndersBroman1-9/+9
valgrind. Change-Id: I7881f8c1407d422a3f1ad5bc17e975b45703db74 Reviewed-on: https://code.wireshark.org/review/909 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-29Rename "size" variable to "length", to match other string routines.Guy Harris1-4/+4
Change-Id: I385345cfafc7e7b4d3e66713fb0fe570b39f438d Reviewed-on: https://code.wireshark.org/review/865 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-03-29Use sized strbufs when extracting tvb stringsEvan Huus1-33/+19
We rarely know exactly how long a string will be, but we frequently have a good lower bound (that's better than the default strbuf size of 16). Starting at that size probably reduces the amount of allocation/copying needed. Also make use of the new _finalize() method to save memory and avoid constness problems. Change-Id: I3f043bd12c1ccfce5990168fb6531ecd287bec5b Reviewed-on: https://code.wireshark.org/review/856 Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-10Fix a typo in a comment; use consistent indentation matching that specified ↵Bill Meier1-43/+43
by the editor modelines. Change-Id: I6d4ad3675ec9099913c8a32ad1f2758316158f68 Reviewed-on: https://code.wireshark.org/review/587 Reviewed-by: Bill Meier <wmeier@newsguy.com> Tested-by: Bill Meier <wmeier@newsguy.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-26More tvbuff API deprecation, comment expansion, and documentation updates.Guy Harris1-10/+0
Do with tvb_get_stringz() what was done with tvb_get_string(). Redo the comments for the string get routines to try to give more detail in a fashion that's a bit less hard to read. Warn, in comments, of the problems with using tvb_get_string()/tvb_get_stringz() (i.e., if your strings are non-ASCII, all bytes with the 8th bit set are going be replaced by the Unicode REPLACEMENT CHARACTER, and displayed as such). Warn, in a comment, of the problems with tvb_get_const_stringz() (i.e., it gives you raw bytes, rather than guaranteed-to-be-valid UTF-8). Update documentation and release notes appropriately. Change-Id: Ibd3efb92a203861f507ce71bc8d04d19d9d38a93 Reviewed-on: https://code.wireshark.org/review/327 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-02-25Remove trailing whitespaceBill Meier1-2/+2
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-02-22TVB API deprecations and cleanupEvan Huus1-20/+10
- rename tvb_length and similar to tvb_captured_length and similar; leave #defines in place for backwards-compat, but mark them clearly as deprecated in code comments and in checkAPI - remove tvb_get_string as C code and just leave a #define in place for backwards-compat; mark it clearly as deprecated in code comment and checkAPI - update READMEs and sample dissector for all of the above - while in the neighbourhood, make checkAPI skip (and warn) for missing files instead of bailing on the whole check, so subsequent files still get checked Change-Id: I32fc437896ca86ca73e9b49d5f50400adf8ec5ad Reviewed-on: https://code.wireshark.org/review/311 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-01-21Get rid of tvb_get_faked_unicode() - tvb_get_string_enc() does the jobGuy Harris1-37/+0
better. We don't need eventlog_get_unicode_string_length() in the eventlog dissector, either - tvb_unicode_strsize() does the job just as well. svn path=/trunk/; revision=54874
2014-01-21Don't do the byte-with-8th-bit-set-to-REPLACEMENT-CHARACTER mapping forGuy Harris1-96/+126
UTF-8 strings. Add that mapping for null-terminated ASCII strings. Factor out some common parts of comments about string routines, and clean up some other comments. svn path=/trunk/; revision=54868
2014-01-20remove todo commentsMartin Kaiser1-5/+0
svn path=/trunk/; revision=54865
2014-01-20tvb_get_string(): replace 8bit characters with the unicode replacement charMartin Kaiser1-9/+29
svn path=/trunk/; revision=54864
2014-01-15Explain casting away const.Guy Harris1-0/+7
svn path=/trunk/; revision=54816
2014-01-07Move defines for helping with UTF-16 surrogate pairs to wsutil/unicode-utils.hJakub Zawadzki1-7/+1
tvbuff version was moved, but with 'or' optimization from packet-json. svn path=/trunk/; revision=54632
2014-01-04(Trivial) explicitely --> explicitlyBill Meier1-6/+6
svn path=/trunk/; revision=54594
2014-01-01Add proto_tree_add_ts_23_038_7bits_item() / tvb_get_ts_23_038_7bits_string() ↵Pascal Quantin1-13/+24
functions and update dissectors to use it. Remove gsm_sms_char_7bit_unpack() / gsm_sms_chars_to_utf8() functions. Update documentation a bit. svn path=/trunk/; revision=54534
2013-12-30Add new function: tvb_skip_guint8()Jakub Zawadzki1-0/+21
svn path=/trunk/; revision=54505
2013-12-27Use Unicode REPLACEMENT CHARACTER for TS 23.038 errors, as we do forGuy Harris1-4/+8
unassigned code points in some other character sets. svn path=/trunk/; revision=54477
2013-12-24Oops, escape characters shouldn't cause anything to be added to theGuy Harris1-2/+1
string, they should just cause TRUE to be returned - it's the *next* code point that gets treated specially and, after mapping, added to the string. svn path=/trunk/; revision=54431
2013-12-24Make sure uchar is always initialized. Just use '?' since the comment indicatesEvan Huus1-1/+3
that it's a weird (undefined?) case. svn path=/trunk/; revision=54430
2013-12-24Update some comments.Guy Harris1-5/+1
svn path=/trunk/; revision=54429
2013-12-24Add a ENC_3GPP_TS_23_038 encoding, for the standard SMS alphabet in aGuy Harris1-0/+175
bit-packed string, and use it in some places. svn path=/trunk/; revision=54428
2013-12-23Fix warning.Guy Harris1-2/+1
svn path=/trunk/; revision=54375
2013-12-23Fix the offset constant in SURROGATE_VALUE(), and add rather than OR it.Guy Harris1-55/+63
Expand a bunch of comments, discussing what various routines do and should perhaps do. Pull the core of tvb_get_ucs_2_string()/tvb_get_ucs_2_stringz() and tvb_get_ucs_4_string()/tvb_get_ucs_4_stringz() into common routines, as we did for tvb_get_utf_16_string()/tvb_get_utf_16_stringz(). svn path=/trunk/; revision=54374
2013-12-22(Trivial)Bill Meier1-4/+4
- Minor whitespace changes; - Fix a typo; - Add editor modelines to tnbuff_subset.c svn path=/trunk/; revision=54364
2013-12-22Use G_GINT64_CONSTANT(n) rather than 'nLL' when defining constants;Bill Meier1-5/+5
Fix a typo in a comment. svn path=/trunk/; revision=54357
2013-12-22tvb_get_ucs_4_string: increase offset by 4Jakub Zawadzki1-1/+1
copy&paste of tvb_get_ucs_2_string? svn path=/trunk/; revision=54353
2013-12-22Add UCS-4 support, and use it.Guy Harris1-38/+138
Shuffle the character ENC_ values around a bit, keeping the Unicode encodings together, moving the Windows code pages (only one for now) after the ISO 8859 encodings, and putting "I can't believe it's not ASCII!" at the end. Fix some comment typoes, and update another comment, while we're at it. svn path=/trunk/; revision=54351
2013-12-21Add the rest of ISO-8859-n, thanks to Jakub's "generate a mapping table"Guy Harris1-49/+137
program. Put the character-encoding cases in order. svn path=/trunk/; revision=54344
2013-12-21Get rid of tvb_get_unicode_string() and tvb_get_unicode_stringz();Guy Harris1-91/+210
instead, have static routines to get UCS-2 (no surrogate pairs) and UTF-16 (with surrogate pairs) strings, with the routines to handle UTF-16 actually handling surrogate pairs. Update some out-of-date comments while we're at it. svn path=/trunk/; revision=54318
2013-12-19Rename a couple of to_str functions to have ep_ in the name. This makes itEvan Huus1-4/+4
obvious that the returned string is ephemeral, and opens up the original names in the API for versions that take a wmem pool (and thus can work in any scope). svn path=/trunk/; revision=54249
2013-12-18Add charset table for ISO/IEC 8859-9 (ENC_ISO_8859_9)Jakub Zawadzki1-0/+8
svn path=/trunk/; revision=54239
2013-12-18Add a sixteenth element to all BCD digit sets to avoid garbage values whenEvan Huus1-2/+2
decoding corrupt bytes. Some of these digit sets could probably be deduplicated... svn path=/trunk/; revision=54224
2013-12-17Create sign extension routines in <wsutil/sign_ext.h>, use it in few places.Jakub Zawadzki1-19/+8
svn path=/trunk/; revision=54197
2013-12-17Handle signed integers > 32 bits. Bug 8454 ↵Michael Mann1-0/+72
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8454) svn path=/trunk/; revision=54183
2013-12-15add support for ISO 8859-5Martin Kaiser1-0/+8
svn path=/trunk/; revision=54132
2013-12-13In tvb_get_unicode_string(), if the byte count is odd, ignore the lastGuy Harris1-1/+5
byte. (We should perhaps add an expert info indication in those cases.) svn path=/trunk/; revision=54074
2013-12-08Add ENC_ISO_8859_1.Guy Harris1-0/+58
Move the Wikipedia links for the code page layouts in front of the tables whose contents reflect the code page layouts. svn path=/trunk/; revision=53837
2013-12-07Add string encoding for ISO/IEC 8859-2 (ENC_ISO_8859_2)Jakub Zawadzki1-0/+8
svn path=/trunk/; revision=53826
2013-12-07Add new string proto encoding for windows-1250 (ENC_WINDOWS_1250)Jakub Zawadzki1-0/+41
- Move windows-1250 to unicode encoding table to charset.c - Add tvb_get_string_unichar2, tvb_get_stringz_unichar2 functions which recode tvb-string to UTF-8. svn path=/trunk/; revision=53819
2013-12-07Remove #if 0 inverse_bit_mask8 array.Jakub Zawadzki1-13/+0
It was only used by tvb_get_bits_buf (removed in r53183). svn path=/trunk/; revision=53818
2013-12-06Move tvb_uncompress() to tvbuff_zlib.cJakub Zawadzki1-291/+0
svn path=/trunk/; revision=53815
2013-11-29Rename some of pint.h macros to match common style (bits number on the end).Jakub Zawadzki1-10/+10
pntohs -> pntoh16 pntohl -> pntoh32 pletohs -> pletoh16 pletohl -> pletoh32 phtons -> phton16 phtonl -> phton32 svn path=/trunk/; revision=53652
2013-11-22Fix unused-const-variable error when build with clang 3.4Alexis La Goutte1-0/+2
svn path=/trunk/; revision=53512
2013-11-10Add missing includes in order to remove exceptions.h from proto.h (next commit).Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53230
2013-11-10Move prototype of bytes_to_str, bytes_to_str_punct to correct header.Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53214