* Make UPnPSearch using the "contains" keyword work properly with substring searches.
This commit is contained in:
parent
1549254753
commit
808fc6f459
@ -1122,7 +1122,7 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
SearchCriteria = modifyString(SearchCriteria, "'", "'", 0);
|
SearchCriteria = modifyString(SearchCriteria, "'", "'", 0);
|
||||||
SearchCriteria = modifyString(SearchCriteria, "object.", "", 0);
|
SearchCriteria = modifyString(SearchCriteria, "object.", "", 0);
|
||||||
SearchCriteria = modifyString(SearchCriteria, "derivedfrom", "glob", 1);
|
SearchCriteria = modifyString(SearchCriteria, "derivedfrom", "glob", 1);
|
||||||
SearchCriteria = modifyString(SearchCriteria, "contains", "glob", 1);
|
SearchCriteria = modifyString(SearchCriteria, "contains", "glob", 2);
|
||||||
SearchCriteria = modifyString(SearchCriteria, "dc:title", "d.TITLE", 0);
|
SearchCriteria = modifyString(SearchCriteria, "dc:title", "d.TITLE", 0);
|
||||||
SearchCriteria = modifyString(SearchCriteria, "dc:creator", "d.CREATOR", 0);
|
SearchCriteria = modifyString(SearchCriteria, "dc:creator", "d.CREATOR", 0);
|
||||||
SearchCriteria = modifyString(SearchCriteria, "upnp:class", "o.CLASS", 0);
|
SearchCriteria = modifyString(SearchCriteria, "upnp:class", "o.CLASS", 0);
|
||||||
|
9
utils.c
9
utils.c
@ -89,7 +89,7 @@ modifyString(char * string, const char * before, const char * after, short like)
|
|||||||
|
|
||||||
oldlen = strlen(before);
|
oldlen = strlen(before);
|
||||||
newlen = strlen(after);
|
newlen = strlen(after);
|
||||||
if( newlen > oldlen )
|
if( newlen+like > oldlen )
|
||||||
{
|
{
|
||||||
s = string;
|
s = string;
|
||||||
while( (p = strstr(s, before)) )
|
while( (p = strstr(s, before)) )
|
||||||
@ -114,11 +114,18 @@ modifyString(char * string, const char * before, const char * after, short like)
|
|||||||
while( isspace(*t) )
|
while( isspace(*t) )
|
||||||
t++;
|
t++;
|
||||||
if( *t == '"' )
|
if( *t == '"' )
|
||||||
|
{
|
||||||
|
if( like == 2 )
|
||||||
|
{
|
||||||
|
memmove(t+2, t+1, strlen(t+1)+1);
|
||||||
|
*++t = '*';
|
||||||
|
}
|
||||||
while( *++t != '"' )
|
while( *++t != '"' )
|
||||||
continue;
|
continue;
|
||||||
memmove(t+1, t, strlen(t)+1);
|
memmove(t+1, t, strlen(t)+1);
|
||||||
*t = '*';
|
*t = '*';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
s = p + newlen;
|
s = p + newlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user