* Make UPnPSearch using the "contains" keyword work properly with substring searches.
This commit is contained in:
		@@ -1122,7 +1122,7 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
 | 
			
		||||
		SearchCriteria = modifyString(SearchCriteria, "'", "'", 0);
 | 
			
		||||
		SearchCriteria = modifyString(SearchCriteria, "object.", "", 0);
 | 
			
		||||
		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:creator", "d.CREATOR", 0);
 | 
			
		||||
		SearchCriteria = modifyString(SearchCriteria, "upnp:class", "o.CLASS", 0);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								utils.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								utils.c
									
									
									
									
									
								
							@@ -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;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user