diff options
author | Henri Herscher <henri@oreka.org> | 2009-07-21 19:03:50 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2009-07-21 19:03:50 +0000 |
commit | 1ed6f23ad180e37cb3b6564f6a613197f05508e5 (patch) | |
tree | 3feb7f23d4bad3ad9f485b91f735882698b633bd | |
parent | 9edfbd0d3ac066d03e631627cd7c137b060de6b9 (diff) |
SIP header parsing fix so that fields are searched in a case insensitive way, including the first character.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@630 09dcff7a-b715-0410-9601-b79a96267cd0
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIp.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp index 909b3d1..285b620 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp @@ -126,6 +126,22 @@ void memToHex(unsigned char* input, size_t len, CStdString&output) } } +// Same as standard memchr but case insensitive +inline char* memnchr(void *s, int c, size_t len) +{ + char lowerCase = tolower(c); + char upperCase = toupper(c); + char* stop = (char*)s + len; + for(char* ptr = (char*)s ; ptr < stop; ptr++) + { + if(*ptr == lowerCase || *ptr == upperCase) + { + return ptr; + } + } + return NULL; +} + static char* memFindStr(char* toFind, char* start, char* stop) { for(char * ptr = start; (ptr<stop) && (ptr != NULL); ptr = (char *)memchr(ptr+1, toFind[0],(stop-ptr))) @@ -141,7 +157,7 @@ static char* memFindStr(char* toFind, char* start, char* stop) // find the address that follows the given search string between start and stop pointers - case insensitive char* memFindAfter(char* toFind, char* start, char* stop) { - for(char * ptr = start; (ptr<stop) && (ptr != NULL); ptr = (char *)memchr(ptr+1, toFind[0],(stop - ptr))) + for(char * ptr = start; (ptr<stop) && (ptr != NULL); ptr = (char *)memnchr(ptr+1, toFind[0],(stop - ptr))) { if(ACE_OS::strncasecmp(toFind, ptr, strlen(toFind)) == 0) { |