From: Gisle Vanem
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
This commit is contained in:
parent
bc2ca61083
commit
92fd73681d
|
@ -38,6 +38,7 @@
|
|||
#include <epan/emem.h>
|
||||
#include <epan/uat.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/strutil.h>
|
||||
#include "packet-sscop.h"
|
||||
|
||||
typedef struct _k12_hdls_t {
|
||||
|
@ -135,7 +136,7 @@ static void dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) {
|
|||
|
||||
if (! handles ) {
|
||||
for (i=0 ; i < nk12_handles; i++) {
|
||||
if ( strcasestr(pinfo->pseudo_header->k12.stack_file, k12_handles[i].match) ) {
|
||||
if ( epan_strcasestr(pinfo->pseudo_header->k12.stack_file, k12_handles[i].match) ) {
|
||||
handles = k12_handles[i].handles;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -243,6 +243,7 @@ epan_dissect_run
|
|||
epan_get_version
|
||||
epan_init
|
||||
epan_base64_decode
|
||||
epan_strcasestr
|
||||
ether_to_str
|
||||
ex_opt_add
|
||||
ex_opt_count
|
||||
|
|
|
@ -966,3 +966,17 @@ g_strlcat(gchar *dst, gchar *src, gsize size)
|
|||
return strl+strs;
|
||||
}
|
||||
#endif
|
||||
|
||||
char *
|
||||
epan_strcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
gsize hlen = strlen(haystack);
|
||||
gsize nlen = strlen(needle);
|
||||
|
||||
while (hlen-- >= nlen) {
|
||||
if (!g_strncasecmp(haystack, needle, nlen))
|
||||
return (char*) haystack;
|
||||
haystack++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -205,6 +205,16 @@ guint8 * convert_string_to_hex(const char *string, size_t *nbytes);
|
|||
*/
|
||||
char * convert_string_case(const char *string, gboolean case_insensitive);
|
||||
|
||||
/** Finds the first occurence of string 'needle' in string 'haystack'.
|
||||
* The matching is done in a case insensitive manner.
|
||||
*
|
||||
* @param haystack The string possibly containing the substring
|
||||
* @param needle The substring to be searched
|
||||
* @return A pointer into 'haystack' where 'needle' is first found.
|
||||
* Otherwise it returns NULL.
|
||||
*/
|
||||
char * epan_strcasestr(const char *haystack, const char *needle);
|
||||
|
||||
/* g_strlcat() does not exist in GLib 1.2[.x] */
|
||||
#if GLIB_MAJOR_VERSION < 2
|
||||
gsize g_strlcat(gchar *dst, gchar *src, gsize size);
|
||||
|
|
Loading…
Reference in New Issue