tokens[loop].value = PL_strdup(value);
if (!strcmp(token, "text")) { nsCOMPtr<nsITextToSubURI> textToSubURI = do_GetService(kTextToSubURICID, &rv); if (NS_SUCCEEDED(rv) && (textToSubURI)) { PRUnichar	*uni = nsnull; if (NS_SUCCEEDED(rv = textToSubURI->UnEscapeAndConvert("UTF-8", value, &uni)) && (uni)) { tokens[loop].value = uni; Recycle(uni); } } } else { nsAutoString    valueStr; valueStr.AssignWithConversion(value); tokens[loop].value = valueStr; }
LocalSearchDataSource::parseResourceIntoFindTokens(nsIRDFResource *u, findTokenPtr tokens){	const char		*uri = nsnull;	char			*id, *token, *value;	int			loop;	nsresult		rv;	if (NS_FAILED(rv = u->GetValueConst(&uri)))	return(rv);#ifdef	DEBUG	printf("Find: %s\n", (const char*) uri);#endif	if (!(id = PL_strdup(uri + sizeof(kFindProtocol) - 1)))		return(NS_ERROR_OUT_OF_MEMORY);	/* parse ID, build up token list */	if ((token = strtok(id, "&")) != NULL)	{		while (token != NULL)		{			if ((value = strstr(token, "=")) != NULL)			{				*value++ = '\0';			}			for (loop=0; tokens[loop].token != NULL; loop++)			{				if (!strcmp(token, tokens[loop].token))				{					tokens[loop].value = PL_strdup(value);					break;				}			}			token = strtok(NULL, "&");		}	}	PL_strfree(id);	return(NS_OK);}