зеркало из https://github.com/mozilla/pjs.git
Bug 104158: Use NS_LITERAL_STRING instead of XXXWithConversion("..."). r=bryner, rs=alecf
This commit is contained in:
Родитель
6219c60c09
Коммит
5d241ab9e8
|
@ -2469,8 +2469,7 @@ InternetSearchDataSource::GetInternetSearchURL(const char *searchEngineURI,
|
||||||
// we can only handle HTTP GET
|
// we can only handle HTTP GET
|
||||||
if (!method.EqualsIgnoreCase("get")) return(NS_ERROR_UNEXPECTED);
|
if (!method.EqualsIgnoreCase("get")) return(NS_ERROR_UNEXPECTED);
|
||||||
// HTTP Get method support
|
// HTTP Get method support
|
||||||
action.AppendWithConversion("?");
|
action += NS_LITERAL_STRING("?") + input;
|
||||||
action += input;
|
|
||||||
|
|
||||||
// return a copy of the resulting search URL
|
// return a copy of the resulting search URL
|
||||||
*resultURL = ToNewCString(action);
|
*resultURL = ToNewCString(action);
|
||||||
|
@ -2599,16 +2598,16 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea
|
||||||
if (userVar.Length() < 1) return(NS_RDF_NO_VALUE);
|
if (userVar.Length() < 1) return(NS_RDF_NO_VALUE);
|
||||||
|
|
||||||
nsAutoString queryStr;
|
nsAutoString queryStr;
|
||||||
queryStr.AssignWithConversion("?");
|
queryStr = NS_LITERAL_STRING("?") +
|
||||||
queryStr += userVar;
|
userVar +
|
||||||
queryStr.AppendWithConversion("=");
|
NS_LITERAL_STRING("=");
|
||||||
|
|
||||||
PRInt32 queryOffset;
|
PRInt32 queryOffset;
|
||||||
if ((queryOffset = searchURL.Find(queryStr, PR_TRUE )) < 0)
|
if ((queryOffset = searchURL.Find(queryStr, PR_TRUE )) < 0)
|
||||||
{
|
{
|
||||||
queryStr.AssignWithConversion("&");
|
queryStr = NS_LITERAL_STRING("&") +
|
||||||
queryStr += userVar;
|
userVar +
|
||||||
queryStr.AppendWithConversion("=");
|
NS_LITERAL_STRING("=");
|
||||||
queryOffset = searchURL.Find(queryStr, PR_TRUE);
|
queryOffset = searchURL.Find(queryStr, PR_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2664,9 +2663,8 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea
|
||||||
RememberLastSearchText(searchText.get());
|
RememberLastSearchText(searchText.get());
|
||||||
|
|
||||||
// construct the search query uri
|
// construct the search query uri
|
||||||
engineURI.InsertWithConversion("internetsearch:engine=", 0);
|
engineURI.Assign(NS_LITERAL_STRING("internetsearch:engine=") + engineURI +
|
||||||
engineURI.AppendWithConversion("&text=");
|
NS_LITERAL_STRING("&text=") + searchText);
|
||||||
engineURI += searchText;
|
|
||||||
|
|
||||||
#ifdef DEBUG_SEARCH_OUTPUT
|
#ifdef DEBUG_SEARCH_OUTPUT
|
||||||
char *engineMatch = ToNewCString(searchText);
|
char *engineMatch = ToNewCString(searchText);
|
||||||
|
@ -3499,7 +3497,7 @@ InternetSearchDataSource::DoSearch(nsIRDFResource *source, nsIRDFResource *engin
|
||||||
if (fullURL.Length() > 0)
|
if (fullURL.Length() > 0)
|
||||||
{
|
{
|
||||||
action.Assign(fullURL);
|
action.Assign(fullURL);
|
||||||
methodStr.AssignWithConversion("get");
|
methodStr.Assign(NS_LITERAL_STRING("get"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3579,8 +3577,7 @@ InternetSearchDataSource::DoSearch(nsIRDFResource *source, nsIRDFResource *engin
|
||||||
if (input.Length() < 1) return(NS_ERROR_UNEXPECTED);
|
if (input.Length() < 1) return(NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
// HTTP Get method support
|
// HTTP Get method support
|
||||||
action.AppendWithConversion("?");
|
action += NS_LITERAL_STRING("?") + input;
|
||||||
action += input;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIInternetSearchContext> context;
|
nsCOMPtr<nsIInternetSearchContext> context;
|
||||||
|
@ -3725,7 +3722,7 @@ InternetSearchDataSource::SaveEngineInfoIntoGraph(nsIFile *file, nsIFile *icon,
|
||||||
if ((extensionOffset = basename.RFindChar(PRUnichar('.'))) > 0)
|
if ((extensionOffset = basename.RFindChar(PRUnichar('.'))) > 0)
|
||||||
{
|
{
|
||||||
basename.Truncate(extensionOffset);
|
basename.Truncate(extensionOffset);
|
||||||
basename.AppendWithConversion(".src");
|
basename.Append(NS_LITERAL_STRING(".src"));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsXPIDLCString filePath;
|
nsXPIDLCString filePath;
|
||||||
|
@ -3743,7 +3740,7 @@ InternetSearchDataSource::SaveEngineInfoIntoGraph(nsIFile *file, nsIFile *icon,
|
||||||
if ((extensionOffset = searchURL.RFindChar(PRUnichar('.'))) > 0)
|
if ((extensionOffset = searchURL.RFindChar(PRUnichar('.'))) > 0)
|
||||||
{
|
{
|
||||||
searchURL.Truncate(extensionOffset);
|
searchURL.Truncate(extensionOffset);
|
||||||
searchURL.AppendWithConversion(".src");
|
searchURL.Append(NS_LITERAL_STRING(".src"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(searchURL.get(),
|
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(searchURL.get(),
|
||||||
|
@ -3970,7 +3967,7 @@ InternetSearchDataSource::GetSearchEngineList(nsIFile *searchDir, PRBool checkMa
|
||||||
nsCOMPtr<nsILocalFile> iconFile;
|
nsCOMPtr<nsILocalFile> iconFile;
|
||||||
|
|
||||||
uri.Left(temp, uri.Length()-4);
|
uri.Left(temp, uri.Length()-4);
|
||||||
temp.AppendWithConversion(".gif");
|
temp.Append(NS_LITERAL_STRING(".gif"));
|
||||||
const nsFileSpec gifIconFile(temp);
|
const nsFileSpec gifIconFile(temp);
|
||||||
if (gifIconFile.IsFile())
|
if (gifIconFile.IsFile())
|
||||||
{
|
{
|
||||||
|
@ -3980,7 +3977,7 @@ InternetSearchDataSource::GetSearchEngineList(nsIFile *searchDir, PRBool checkMa
|
||||||
if (foundIconFlag == PR_FALSE)
|
if (foundIconFlag == PR_FALSE)
|
||||||
{
|
{
|
||||||
uri.Left(temp, uri.Length()-4);
|
uri.Left(temp, uri.Length()-4);
|
||||||
temp.AppendWithConversion(".jpg");
|
temp.Append(NS_LITERAL_STRING(".jpg"));
|
||||||
const nsFileSpec jpgIconFile(temp);
|
const nsFileSpec jpgIconFile(temp);
|
||||||
if (jpgIconFile.IsFile())
|
if (jpgIconFile.IsFile())
|
||||||
{
|
{
|
||||||
|
@ -3991,7 +3988,7 @@ InternetSearchDataSource::GetSearchEngineList(nsIFile *searchDir, PRBool checkMa
|
||||||
if (foundIconFlag == PR_FALSE)
|
if (foundIconFlag == PR_FALSE)
|
||||||
{
|
{
|
||||||
uri.Left(temp, uri.Length()-4);
|
uri.Left(temp, uri.Length()-4);
|
||||||
temp.AppendWithConversion(".jpeg");
|
temp.Append(NS_LITERAL_STRING(".jpeg"));
|
||||||
const nsFileSpec jpegIconFile(temp);
|
const nsFileSpec jpegIconFile(temp);
|
||||||
if (jpegIconFile.IsFile())
|
if (jpegIconFile.IsFile())
|
||||||
{
|
{
|
||||||
|
@ -4002,7 +3999,7 @@ InternetSearchDataSource::GetSearchEngineList(nsIFile *searchDir, PRBool checkMa
|
||||||
if (foundIconFlag == PR_FALSE)
|
if (foundIconFlag == PR_FALSE)
|
||||||
{
|
{
|
||||||
uri.Left(temp, uri.Length()-4);
|
uri.Left(temp, uri.Length()-4);
|
||||||
temp.AppendWithConversion(".png");
|
temp.Append(NS_LITERAL_STRING(".png"));
|
||||||
const nsFileSpec pngIconFile(temp);
|
const nsFileSpec pngIconFile(temp);
|
||||||
if (pngIconFile.IsFile())
|
if (pngIconFile.IsFile())
|
||||||
{
|
{
|
||||||
|
@ -4064,7 +4061,7 @@ InternetSearchDataSource::GetNumInterpretSections(const PRUnichar *dataUni, PRUi
|
||||||
nsString buffer(dataUni);
|
nsString buffer(dataUni);
|
||||||
|
|
||||||
nsAutoString section;
|
nsAutoString section;
|
||||||
section.AssignWithConversion("<interpret");
|
section.Assign(NS_LITERAL_STRING("<interpret"));
|
||||||
PRBool inSection = PR_FALSE;
|
PRBool inSection = PR_FALSE;
|
||||||
|
|
||||||
while(buffer.Length() > 0)
|
while(buffer.Length() > 0)
|
||||||
|
@ -4113,7 +4110,7 @@ InternetSearchDataSource::GetData(const PRUnichar *dataUni, const char *sectionT
|
||||||
PRBool inSection = PR_FALSE;
|
PRBool inSection = PR_FALSE;
|
||||||
|
|
||||||
nsAutoString section;
|
nsAutoString section;
|
||||||
section.AssignWithConversion("<");
|
section.Assign(NS_LITERAL_STRING("<"));
|
||||||
section.AppendWithConversion(sectionToFind);
|
section.AppendWithConversion(sectionToFind);
|
||||||
|
|
||||||
while(buffer.Length() > 0)
|
while(buffer.Length() > 0)
|
||||||
|
@ -4334,10 +4331,10 @@ InternetSearchDataSource::GetInputs(const PRUnichar *dataUni, nsString &userVar,
|
||||||
{
|
{
|
||||||
if (input.Length() > 0)
|
if (input.Length() > 0)
|
||||||
{
|
{
|
||||||
input.AppendWithConversion("&");
|
input.Append(NS_LITERAL_STRING("&"));
|
||||||
}
|
}
|
||||||
input += nameAttrib;
|
input += nameAttrib;
|
||||||
input.AppendWithConversion("=");
|
input.Append(NS_LITERAL_STRING("="));
|
||||||
input += valueAttrib;
|
input += valueAttrib;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4839,7 +4836,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD
|
||||||
nsAutoString nameStartStr, nameEndStr;
|
nsAutoString nameStartStr, nameEndStr;
|
||||||
nsAutoString emailStartStr, emailEndStr;
|
nsAutoString emailStartStr, emailEndStr;
|
||||||
nsAutoString browserResultTypeStr;
|
nsAutoString browserResultTypeStr;
|
||||||
browserResultTypeStr.AssignWithConversion("result"); // default to "result"
|
browserResultTypeStr.Assign(NS_LITERAL_STRING("result")); // default to "result"
|
||||||
|
|
||||||
// need an original copy of the HTML every time through the loop
|
// need an original copy of the HTML every time through the loop
|
||||||
nsAutoString htmlResults(htmlPage);
|
nsAutoString htmlResults(htmlPage);
|
||||||
|
@ -4877,7 +4874,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD
|
||||||
GetData(dataUni, "interpret", interpretSectionNum, "browserResultType", browserResultTypeStr);
|
GetData(dataUni, "interpret", interpretSectionNum, "browserResultType", browserResultTypeStr);
|
||||||
if (browserResultTypeStr.Length() < 1)
|
if (browserResultTypeStr.Length() < 1)
|
||||||
{
|
{
|
||||||
browserResultTypeStr.AssignWithConversion("result"); // default to "result"
|
browserResultTypeStr.Assign(NS_LITERAL_STRING("result")); // default to "result"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4935,7 +4932,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD
|
||||||
// if resultItemStartStr is not specified, try making it just be "HREF="
|
// if resultItemStartStr is not specified, try making it just be "HREF="
|
||||||
if (resultItemStartStr.Length() < 1)
|
if (resultItemStartStr.Length() < 1)
|
||||||
{
|
{
|
||||||
resultItemStartStr.AssignWithConversion("HREF=");
|
resultItemStartStr.Assign(NS_LITERAL_STRING("HREF="));
|
||||||
trimItemStart = PR_FALSE;
|
trimItemStart = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5418,7 +5415,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD
|
||||||
}
|
}
|
||||||
if (relItem.Length() < 1)
|
if (relItem.Length() < 1)
|
||||||
{
|
{
|
||||||
relItem.AssignWithConversion("-");
|
relItem.Assign(NS_LITERAL_STRING("-"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const PRUnichar *relItemUni = relItem.get();
|
const PRUnichar *relItemUni = relItem.get();
|
||||||
|
@ -5431,7 +5428,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((relItem.Length() > 0) && (!relItem.EqualsWithConversion("-")))
|
if ((!relItem.IsEmpty()) && (!relItem.Equals(NS_LITERAL_STRING("-"))))
|
||||||
{
|
{
|
||||||
// If its a percentage, remove "%"
|
// If its a percentage, remove "%"
|
||||||
if (relItem[relItem.Length()-1] == PRUnichar('%'))
|
if (relItem[relItem.Length()-1] == PRUnichar('%'))
|
||||||
|
@ -5441,7 +5438,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD
|
||||||
|
|
||||||
// left-pad with "0"s and set special sorting value
|
// left-pad with "0"s and set special sorting value
|
||||||
nsAutoString zero;
|
nsAutoString zero;
|
||||||
zero.AssignWithConversion("000");
|
zero.Assign(NS_LITERAL_STRING("000"));
|
||||||
if (relItem.Length() < 3)
|
if (relItem.Length() < 3)
|
||||||
{
|
{
|
||||||
relItem.Insert(zero.get(), 0, zero.Length() - relItem.Length());
|
relItem.Insert(zero.get(), 0, zero.Length() - relItem.Length());
|
||||||
|
@ -5449,7 +5446,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
relItem.AssignWithConversion("000");
|
relItem.Assign(NS_LITERAL_STRING("000"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const PRUnichar *relSortUni = relItem.get();
|
const PRUnichar *relSortUni = relItem.get();
|
||||||
|
@ -5495,9 +5492,9 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent, nsIRD
|
||||||
nsAutoString iconChromeDefault;
|
nsAutoString iconChromeDefault;
|
||||||
|
|
||||||
if (browserResultTypeStr.EqualsIgnoreCase("category"))
|
if (browserResultTypeStr.EqualsIgnoreCase("category"))
|
||||||
iconChromeDefault.AssignWithConversion("chrome://communicator/skin/search/category.gif");
|
iconChromeDefault.Assign(NS_LITERAL_STRING("chrome://communicator/skin/search/category.gif"));
|
||||||
else if ((browserResultTypeStr.EqualsIgnoreCase("result")) && (!engineIconNode))
|
else if ((browserResultTypeStr.EqualsIgnoreCase("result")) && (!engineIconNode))
|
||||||
iconChromeDefault.AssignWithConversion("chrome://communicator/skin/search/result.gif");
|
iconChromeDefault.Assign(NS_LITERAL_STRING("chrome://communicator/skin/search/result.gif"));
|
||||||
|
|
||||||
if (iconChromeDefault.Length() > 0)
|
if (iconChromeDefault.Length() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,7 +260,7 @@ LocalSearchDataSource::GetTarget(nsIRDFResource *source,
|
||||||
}
|
}
|
||||||
else if (property == kNC_pulse)
|
else if (property == kNC_pulse)
|
||||||
{
|
{
|
||||||
nsAutoString pulse; pulse.AssignWithConversion("15");
|
nsAutoString pulse(NS_LITERAL_STRING("15"));
|
||||||
nsIRDFLiteral *pulseLiteral;
|
nsIRDFLiteral *pulseLiteral;
|
||||||
rv = gRDFService->GetLiteral(pulse.get(), &pulseLiteral);
|
rv = gRDFService->GetLiteral(pulse.get(), &pulseLiteral);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
@ -708,7 +708,7 @@ LocalSearchDataSource::GetTargets(nsIRDFResource *source,
|
||||||
}
|
}
|
||||||
else if (property == kNC_pulse)
|
else if (property == kNC_pulse)
|
||||||
{
|
{
|
||||||
nsAutoString pulse; pulse.AssignWithConversion("15");
|
nsAutoString pulse(NS_LITERAL_STRING("15"));
|
||||||
nsIRDFLiteral *pulseLiteral;
|
nsIRDFLiteral *pulseLiteral;
|
||||||
rv = gRDFService->GetLiteral(pulse.get(), &pulseLiteral);
|
rv = gRDFService->GetLiteral(pulse.get(), &pulseLiteral);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче