diff options
author | Justin Maggard <jmaggard@users.sourceforge.net> | 2009-11-19 05:34:35 +0300 |
---|---|---|
committer | Justin Maggard <jmaggard@users.sourceforge.net> | 2009-11-19 05:34:35 +0300 |
commit | 2d389db63b6c8878d174e1a2bf0960bedaa47f80 (patch) | |
tree | 072d7fcef6e3f0e2ac356e5a8991b6bbf9d5985c /utils.c | |
parent | e2c7226ee782be807ff77990b5ca9f55651baee2 (diff) |
* Make UPnPSearch using the "contains" keyword work properly with substring searches.
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -89,7 +89,7 @@ modifyString(char * string, const char * before, const char * after, short like) oldlen = strlen(before); newlen = strlen(after); - if( newlen > oldlen ) + if( newlen+like > oldlen ) { s = string; while( (p = strstr(s, before)) ) @@ -114,10 +114,17 @@ modifyString(char * string, const char * before, const char * after, short like) while( isspace(*t) ) t++; if( *t == '"' ) + { + if( like == 2 ) + { + memmove(t+2, t+1, strlen(t+1)+1); + *++t = '*'; + } while( *++t != '"' ) continue; - memmove(t+1, t, strlen(t)+1); - *t = '*'; + memmove(t+1, t, strlen(t)+1); + *t = '*'; + } } s = p + newlen; } |