summaryrefslogtreecommitdiff
path: root/epan/emem.c
AgeCommit message (Collapse)AuthorFilesLines
2009-04-14ep_strbuf: fix some bugs and additional changesBill Meier1-124/+175
-Bugs * str->len not set correctly in some cases; * trailing '\0' not always accounted for; * (issues relating to determining when & how much to expand string buffer). -Other * Change append, append_c, truncate to return pointer to ep_strbuf (similar to the corresponding GString functions); * Rename certain variables to clarify usage (as I understand the intended usage); * ep_strbuf_grow: use current allocated length and not current string length as the starting point; * Optimizations; * Add some additional comments to emem.h ep_strbuf section * Use consistent indentation throughout emem.c; svn path=/trunk/; revision=28044
2009-04-07Another patch to sqelch warnings about asserts in g_strlcpy with NULL source ↵Jörg Mayer1-2/+4
pointer svn path=/trunk/; revision=27985
2009-04-07size_t fixes.Gerald Combs1-17/+17
svn path=/trunk/; revision=27984
2009-04-03Don't crash on linux:Jörg Mayer1-1/+1
strlen(NULL) isn't an acceptable call. svn path=/trunk/; revision=27948
2009-03-30Call ep_strbuf_append_printf() from ep_strbuf_append().Gerald Combs1-41/+29
svn path=/trunk/; revision=27899
2009-03-28Add a missing check.Gerald Combs1-1/+5
svn path=/trunk/; revision=27875
2009-03-28Replace a lot of pointer tracking and some GStrings with emem_strbufs. AddGerald Combs1-0/+29
ep_strbuf_printf and ep_strbuf_append_c. svn path=/trunk/; revision=27873
2009-03-27Add initial support for string buffers - ep_allocated, growable stringsGerald Combs1-0/+153
similar to GLib's GStrings. Use them to create the list of TCP flags. svn path=/trunk/; revision=27872
2008-08-05Add a debug helper for EP memory corruptionLuis Ontanon1-1/+53
if compiled in and the env var WIRESHARK_DEBUG_EP_CANARY is set: will check for canary integrity at every call to EP_CHECK_CANARY() if corruption is found it exits pronting the prior location and the location in which corruption was found. Hopefully it stops running while the corruptor is still in the stack. see EP_CHECK_CANARY() calls in packet.c as an example. svn path=/trunk/; revision=25927
2008-06-25Fix some warnings - declare some arguments, variables, and structureGuy Harris1-2/+2
members to be const pointers when that's possible, and throw in some casts when the GLib API fails to have properly consted arguments. Use ep_strdup_printf() in some cases. svn path=/trunk/; revision=25596
2008-05-23Fix some of the Errors/warnings detected by checkapi.Anders Broman1-1/+1
svn path=/trunk/; revision=25368
2008-05-22Move the file utility functions from wiretap to libwsutil so thatJeff Morriss1-6/+5
libwireshark (and the plugins using those functions) do not depend on wiretap on Windows. While doing that, rename the eth_* functions to ws_*. svn path=/trunk/; revision=25354
2008-04-21From Marton Nemeth (bug 2484):Stig Bjørlykke1-3/+3
The variables ep_canary[], se_canary[], ep_packet_mem and se_packet_mem are only used in emem.c, so the visibility can be file local (static). svn path=/trunk/; revision=25132
2008-04-07- Remove GLIB1 codeStephen Fisher1-25/+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
2008-03-10From Sami Farin:Jaap Keuter1-2/+3
Reads EMEM_CANARY_DATA_SIZE (15) bytes, compares return value to EMEM_CANARY_SIZE (8). Also, I also added setbuf call in patch so it reads 15 bytes instead of 4096 or 8192. svn path=/trunk/; revision=24596
2008-02-11A few more pedantic fixes ...Bill Meier1-2/+4
svn path=/trunk/; revision=24302
2008-01-07From Jim Young (bug 2162):Stig Bjørlykke1-2/+2
Patch for epan/emem.c functions ep_strndup() and se_strndup() to stop valgrind message "invalid read of size 1". svn path=/trunk/; revision=24023
2007-12-04rework how emem trees indexed by strings so that traversing the tree Ronnie Sahlberg1-73/+92
will traverse the entries in the lexical order of the key. add a flag to lookup/insert for strings to specify whether a case insensitive key should be used instead of a (default) case sensitive key. svn path=/trunk/; revision=23736
2007-12-04for nested trees, teach emem about which nodes contain a pointer to a Ronnie Sahlberg1-9/+22
subtree and which nodes that contain a pointer to user data teach emem to be able to traverse nested trees svn path=/trunk/; revision=23733
2007-12-03add tree traversal functionsRonnie Sahlberg1-0/+40
svn path=/trunk/; revision=23725
2007-11-28(Somewhat academic): Fix fread related bug (when using GTK1).Bill Meier1-1/+1
svn path=/trunk/; revision=23650
2007-08-28SNMP:Luis Ontanon1-3/+2
- As noted by Thomas Anders values are not added to the tree anymore. Move the calling of subdissectors to the end of the function, so that the value is added to the tree. - add port 8161 to be decoded as SNMP (hey, it's on IANA's services file!) UAT: - do not have the uat reloaded. OIDS: - do not complain if renaming an OID to an identical name svn path=/trunk/; revision=22704
2007-05-29Check for G_GINT64_MODIFIER in Wireshark as we do in Wiretap.Guy Harris1-2/+2
In all the places where a cast to "long long" or "unsigned long long" was done, use G_GINT64_MODIFIER and get rid of the cast, as 1) there's no guarantee that "%ll" works and 2) there's no guarantee that "long long" works (the latter definitely does *NOT* work with MSVC++; the former doesn't work with regular printf in MSVC++, but it might work with the GLib printf-based functions). svn path=/trunk/; revision=21978
2007-05-29From David Howells :Sebastien Tandel1-2/+2
Fix compilation failures when building wireshark-0.99.6-SVN-21916 on an x86_64-unknown-linux-gnu target with gcc version 4.1.2 20070403 (Red Hat 4.1.2-8). The failures fall into two categories: (1) Casts between pointers and 32-bit integers without an intermediary cast via 'long' or 'unsigned long'. This results in a compiler warning complaining about casts between a pointer and an integer of a different size. (2) Passing values to "%lld" or similar printf-style format options that the compiler thinks are a different size. Such values need to be cast to 'long long' or 'unsigned long long'. svn path=/trunk/; revision=21975
2007-04-28In emem_tree_lookup_string(), return NULL if the allocation fails.Guy Harris1-1/+1
svn path=/trunk/; revision=21612
2007-04-28In calls to the emem_tree routines, forcibly align items not known to beGuy Harris1-25/+39
aligned on 32-bit boundaries. svn path=/trunk/; revision=21611
2007-04-23Add some GCC warnings to the standard set, and add some others to theGuy Harris1-2/+2
--enable-extra-gcc-checks set. If we turn on -pedantic, try turning on -Wno-long-long as well, so that it's not *so* pedantic that it rejects the 64-bit integral data types that we explicitly require. Constify a bunch of stuff, and make some other changes, to get rid of warnings. Clean up some indentation. svn path=/trunk/; revision=21526
2007-04-04Fix build failures due to windows.h being included before winsock2.h via ↵Graham Bloice1-5/+5
other includes svn path=/trunk/; revision=21335
2007-01-25Squelch Coverity CIDs 225, 226, and 227.Gerald Combs1-1/+9
svn path=/trunk/; revision=20552
2007-01-15instead of simply doing an assert when running out of memory in emem, throw ↵Ulf Lamping1-3/+11
a new OutOfMemoryError Exception, so file.c can show at least a better explanation to the user before Wireshark terminates XXX - to prevent a busy wait, I need a portable way to wait for a short time period, like Sleep() for Windows svn path=/trunk/; revision=20437
2006-11-15fix a warningUlf Lamping1-1/+1
svn path=/trunk/; revision=19907
2006-11-11fix so that tcp.pdu.time works again.Ronnie Sahlberg1-1/+22
it broken in one of the previous bugfixes to tcp add a function to print an emem tree to the console for easier emem tree debugging svn path=/trunk/; revision=19877
2006-08-17add trees with PErmanent allocation scope which will be useful for constructingRonnie Sahlberg1-0/+17
associative arrays for globally unique and persistent mappings such as oid to name sid to name guid to name svn path=/trunk/; revision=18937
2006-08-14make creation of subtrees used for the _array tree type use the same ↵Ronnie Sahlberg1-15/+35
allocation scope as its parent and thus become allocation scope agnostic change all accessor functions to be defines to the emem_tree_ functions. now to create a tree with a different scope we only need to create a new ..._tree_create() function and set up the appropriate defines (it was a mistake to call the functions se_tree_create and se_tree_create_non_persistent, they should be the other way around i.e. se_tree_create_persistent and se_tree_create ) svn path=/trunk/; revision=18895
2006-08-14rename some structures and defines from the se_tree to the emem_tree prefixRonnie Sahlberg1-80/+80
svn path=/trunk/; revision=18894
2006-08-12put a memory allocator function pointer inside the tree structure so that ↵Ronnie Sahlberg1-6/+8
all accessor functions become storage scope agnostic svn path=/trunk/; revision=18888
2006-08-12rename some inline functions from se_ to emem_ prefix as a first step to ↵Ronnie Sahlberg1-15/+15
generalize teh tree management and to use trees with different storage scope without too much code duplication. it would be useful with a tree that had indefinite storage instead of the emem functions which commonly have ep or se storage scope. indefinite storage scope would be useful for example for managing a global and static set of well known guid to name mappings(not yet implemented) and also for oid to name mappings. svn path=/trunk/; revision=18886
2006-06-20From Albert Chin:Anders Broman1-6/+16
Fix some C++ comments in C source files and fixes some non-constant initializations. svn path=/trunk/; revision=18521
2006-06-17Not all UN*Xes have MAP_ANONYMOUS; some have MAP_ANON instead, and someGuy Harris1-1/+20
have neither. For those with MAP_ANON but not MAP_ANONYMOUS, use MAP_ANON; for those with neither, add some code to use "/dev/zero". svn path=/trunk/; revision=18488
2006-06-16From Albert Chin Jaap Keuter1-1/+1
HP-UX doesn't have MAP_ANON but it does have MAP_ANONYMOUS. Moreoever, according to mmap(2) on RHEL: MAP_ANONYMOUS The mapping is not backed by any file; the fd and offset argu- ments are ignored. This flag in conjunction with MAP_SHARED is implemented since Linux 2.4. MAP_ANON Alias for MAP_ANONYMOUS. Deprecated. svn path=/trunk/; revision=18486
2006-05-31Tethereal/tethereal -> TShark/tshark.Gerald Combs1-2/+2
svn path=/trunk/; revision=18268
2006-05-28Ethereal->WiresharkAnders Broman1-3/+3
svn path=/trunk/; revision=18234
2006-05-21name changeRonnie Sahlberg1-2/+2
svn path=/trunk/; revision=18197
2006-05-18Improve fix for Bug 915 by using GetVersionEx() as it is recommended by ↵Lars Roland1-7/+12
Microsoft. Tested on Win98 SE. svn path=/trunk/; revision=18183
2006-05-17attempt to fix #915:Ulf Lamping1-2/+6
if the GetVersionEx() call fails, force the dwPlatformId to VER_PLATFORM_WIN32_WINDOWS so the return value from VirtualProtect() won't trigger an assert. svn path=/trunk/; revision=18178
2006-05-15Change return value checking to the true meaning of the spec:Jaap Keuter1-2/+2
"If the function succeeds, the return value is nonzero." This may or may not solve bug 915. svn path=/trunk/; revision=18168
2006-05-02Not all compilers support unnamed struct/union fields withinGuy Harris1-13/+13
structs/unions (GCC supports it "for compatibility with other compilers"; presumably that's not for compatibility with the version of Sun C that rejected it - was that a PCCism?). svn path=/trunk/; revision=18072
2006-04-28Fix logic used to test protection under Windows OT. Only initializeGerald Combs1-14/+27
our page size and OS version information once. svn path=/trunk/; revision=18025
2006-04-26If we're running under Windows 95/98/Me, don't abort if we can't protectGerald Combs1-15/+21
our guard pages. svn path=/trunk/; revision=18011
2006-03-18rename se_tree_lookup32_less_than_or_equal()Ronnie Sahlberg1-1/+1
to se_tree_lookup32_le() svn path=/trunk/; revision=17664