зеркало из https://github.com/mozilla/gecko-dev.git
making string conversions explicit
This commit is contained in:
Родитель
5c6edc01f1
Коммит
e7b40c399d
|
@ -612,7 +612,7 @@ BookmarkParser::DecodeBuffer(nsString &line, char *buf, PRUint32 aLength)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
line.Append(buf, aLength);
|
line.AppendWithConversion(buf, aLength);
|
||||||
}
|
}
|
||||||
return(NS_OK);
|
return(NS_OK);
|
||||||
}
|
}
|
||||||
|
@ -636,7 +636,7 @@ BookmarkParser::ProcessLine(nsIRDFContainer *container, nsIRDFResource *nodeType
|
||||||
{
|
{
|
||||||
if (description.Length() > 0)
|
if (description.Length() > 0)
|
||||||
{
|
{
|
||||||
description += "\n";
|
description.AppendWithConversion("\n");
|
||||||
}
|
}
|
||||||
description += line;
|
description += line;
|
||||||
return(NS_OK);
|
return(NS_OK);
|
||||||
|
@ -820,22 +820,22 @@ BookmarkParser::Unescape(nsString &text)
|
||||||
nsAutoString temp;
|
nsAutoString temp;
|
||||||
text.Mid(temp, offset, 6);
|
text.Mid(temp, offset, 6);
|
||||||
|
|
||||||
if (temp.Compare("<", PR_TRUE, 4) == 0)
|
if (temp.CompareWithConversion("<", PR_TRUE, 4) == 0)
|
||||||
{
|
{
|
||||||
text.Cut(offset, 4);
|
text.Cut(offset, 4);
|
||||||
text.Insert(PRUnichar('<'), offset);
|
text.Insert(PRUnichar('<'), offset);
|
||||||
}
|
}
|
||||||
else if (temp.Compare(">", PR_TRUE, 4) == 0)
|
else if (temp.CompareWithConversion(">", PR_TRUE, 4) == 0)
|
||||||
{
|
{
|
||||||
text.Cut(offset, 4);
|
text.Cut(offset, 4);
|
||||||
text.Insert(PRUnichar('>'), offset);
|
text.Insert(PRUnichar('>'), offset);
|
||||||
}
|
}
|
||||||
else if (temp.Compare("&", PR_TRUE, 5) == 0)
|
else if (temp.CompareWithConversion("&", PR_TRUE, 5) == 0)
|
||||||
{
|
{
|
||||||
text.Cut(offset, 5);
|
text.Cut(offset, 5);
|
||||||
text.Insert(PRUnichar('&'), offset);
|
text.Insert(PRUnichar('&'), offset);
|
||||||
}
|
}
|
||||||
else if (temp.Compare(""", PR_TRUE, 6) == 0)
|
else if (temp.CompareWithConversion(""", PR_TRUE, 6) == 0)
|
||||||
{
|
{
|
||||||
text.Cut(offset, 6);
|
text.Cut(offset, 6);
|
||||||
text.Insert(PRUnichar('\"'), offset);
|
text.Insert(PRUnichar('\"'), offset);
|
||||||
|
@ -855,9 +855,9 @@ BookmarkParser::CreateAnonymousResource(nsCOMPtr<nsIRDFResource>* aResult)
|
||||||
if (! gNext) {
|
if (! gNext) {
|
||||||
LL_L2I(gNext, PR_Now());
|
LL_L2I(gNext, PR_Now());
|
||||||
}
|
}
|
||||||
nsAutoString uri(kURINC_BookmarksRoot);
|
nsAutoString uri; uri.AssignWithConversion(kURINC_BookmarksRoot);
|
||||||
uri.Append("#$");
|
uri.AppendWithConversion("#$");
|
||||||
uri.Append(++gNext, 16);
|
uri.AppendInt(++gNext, 16);
|
||||||
|
|
||||||
return gRDF->GetUnicodeResource(uri.GetUnicode(), getter_AddRefs(*aResult));
|
return gRDF->GetUnicodeResource(uri.GetUnicode(), getter_AddRefs(*aResult));
|
||||||
}
|
}
|
||||||
|
@ -1226,13 +1226,13 @@ BookmarkParser::AddBookmark(nsCOMPtr<nsIRDFContainer> aContainer,
|
||||||
nsIRDFResource** bookmarkNode)
|
nsIRDFResource** bookmarkNode)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsAutoString fullURL(aURL);
|
nsAutoString fullURL; fullURL.AssignWithConversion(aURL);
|
||||||
|
|
||||||
// hack fix for bug # 21175:
|
// hack fix for bug # 21175:
|
||||||
// if we don't have a protocol scheme, add "http://" as a default scheme
|
// if we don't have a protocol scheme, add "http://" as a default scheme
|
||||||
if (fullURL.FindChar(PRUnichar(':')) < 0)
|
if (fullURL.FindChar(PRUnichar(':')) < 0)
|
||||||
{
|
{
|
||||||
fullURL.Insert("http://", 0);
|
fullURL.InsertWithConversion("http://", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFResource> bookmark;
|
nsCOMPtr<nsIRDFResource> bookmark;
|
||||||
|
@ -1298,7 +1298,7 @@ BookmarkParser::AddBookmark(nsCOMPtr<nsIRDFContainer> aContainer,
|
||||||
if ((nsnull != aShortcutURL) && (*aShortcutURL != '\0'))
|
if ((nsnull != aShortcutURL) && (*aShortcutURL != '\0'))
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIRDFLiteral> shortcutLiteral;
|
nsCOMPtr<nsIRDFLiteral> shortcutLiteral;
|
||||||
if (NS_FAILED(rv = gRDF->GetLiteral(nsAutoString(aShortcutURL).GetUnicode(),
|
if (NS_FAILED(rv = gRDF->GetLiteral(NS_ConvertASCIItoUCS2(aShortcutURL).GetUnicode(),
|
||||||
getter_AddRefs(shortcutLiteral))))
|
getter_AddRefs(shortcutLiteral))))
|
||||||
{
|
{
|
||||||
NS_ERROR("unable to get literal for bookmark shortcut URL");
|
NS_ERROR("unable to get literal for bookmark shortcut URL");
|
||||||
|
@ -1399,7 +1399,7 @@ BookmarkParser::ParseBookmarkHeader(const nsString &aLine,
|
||||||
if (id.EqualsIgnoreCase(kURINC_PersonalToolbarFolder))
|
if (id.EqualsIgnoreCase(kURINC_PersonalToolbarFolder))
|
||||||
{
|
{
|
||||||
mFoundPersonalToolbarFolder = PR_TRUE;
|
mFoundPersonalToolbarFolder = PR_TRUE;
|
||||||
personalToolbarFolderHint = "true";
|
personalToolbarFolderHint.AssignWithConversion("true");
|
||||||
folder = dont_QueryInterface( kNC_PersonalToolbarFolder );
|
folder = dont_QueryInterface( kNC_PersonalToolbarFolder );
|
||||||
}
|
}
|
||||||
else if (id.Length() > 0)
|
else if (id.Length() > 0)
|
||||||
|
@ -1451,7 +1451,7 @@ BookmarkParser::ParseBookmarkHeader(const nsString &aLine,
|
||||||
PRBool isIEFavoriteRoot = PR_FALSE;
|
PRBool isIEFavoriteRoot = PR_FALSE;
|
||||||
if (nsnull != mIEFavoritesRoot)
|
if (nsnull != mIEFavoritesRoot)
|
||||||
{
|
{
|
||||||
if (id.Equals(mIEFavoritesRoot))
|
if (id.EqualsWithConversion(mIEFavoritesRoot))
|
||||||
{
|
{
|
||||||
isIEFavoriteRoot = PR_TRUE;
|
isIEFavoriteRoot = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1508,7 +1508,7 @@ BookmarkParser::ParseBookmarkSeparator(const nsString &aLine, const nsCOMPtr<nsI
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv = CreateAnonymousResource(&separator)))
|
if (NS_SUCCEEDED(rv = CreateAnonymousResource(&separator)))
|
||||||
{
|
{
|
||||||
nsAutoString defaultSeparatorName("-----");
|
nsAutoString defaultSeparatorName; defaultSeparatorName.AssignWithConversion("-----");
|
||||||
nsCOMPtr<nsIRDFLiteral> nameLiteral;
|
nsCOMPtr<nsIRDFLiteral> nameLiteral;
|
||||||
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(defaultSeparatorName.GetUnicode(), getter_AddRefs(nameLiteral))))
|
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(defaultSeparatorName.GetUnicode(), getter_AddRefs(nameLiteral))))
|
||||||
{
|
{
|
||||||
|
@ -1909,7 +1909,7 @@ nsBookmarksService::Init()
|
||||||
{
|
{
|
||||||
if (*prefVal)
|
if (*prefVal)
|
||||||
{
|
{
|
||||||
mPersonalToolbarName = prefVal;
|
mPersonalToolbarName.AssignWithConversion(prefVal);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Obtained name of Personal Toolbar from user preferences.\n");
|
printf("Obtained name of Personal Toolbar from user preferences.\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1930,7 +1930,7 @@ nsBookmarksService::Init()
|
||||||
if (mPersonalToolbarName.Length() == 0)
|
if (mPersonalToolbarName.Length() == 0)
|
||||||
{
|
{
|
||||||
// no preference, so fallback to a well-known name
|
// no preference, so fallback to a well-known name
|
||||||
mPersonalToolbarName = kDefaultPersonalToolbarFolder;
|
mPersonalToolbarName.AssignWithConversion(kDefaultPersonalToolbarFolder);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Obtained name of Personal Toolbar from fallback hard-coded string.\n");
|
printf("Obtained name of Personal Toolbar from fallback hard-coded string.\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1963,7 +1963,7 @@ nsresult
|
||||||
nsBookmarksService::getLocaleString(const char *key, nsString &str)
|
nsBookmarksService::getLocaleString(const char *key, nsString &str)
|
||||||
{
|
{
|
||||||
PRUnichar *keyUni = nsnull;
|
PRUnichar *keyUni = nsnull;
|
||||||
nsAutoString keyStr(key);
|
nsAutoString keyStr; keyStr.AssignWithConversion(key);
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
if (mBundle && (NS_SUCCEEDED(rv = mBundle->GetStringFromName(keyStr.GetUnicode(), &keyUni)))
|
if (mBundle && (NS_SUCCEEDED(rv = mBundle->GetStringFromName(keyStr.GetUnicode(), &keyUni)))
|
||||||
&& (keyUni))
|
&& (keyUni))
|
||||||
|
@ -2018,7 +2018,7 @@ nsBookmarksService::ExamineBookmarkSchedule(nsIRDFResource *theBookmark, PRBool
|
||||||
PR_NormalizeTime(&nowInfo, PR_LocalTimeParameters);
|
PR_NormalizeTime(&nowInfo, PR_LocalTimeParameters);
|
||||||
|
|
||||||
nsAutoString dayNum;
|
nsAutoString dayNum;
|
||||||
dayNum.Append(nowInfo.tm_wday, 10);
|
dayNum.AppendInt(nowInfo.tm_wday, 10);
|
||||||
|
|
||||||
// a schedule string has the following format:
|
// a schedule string has the following format:
|
||||||
// Check Monday, Tuesday, and Friday | 9 AM thru 5 PM | every five minutes | change bookmark icon
|
// Check Monday, Tuesday, and Friday | 9 AM thru 5 PM | every five minutes | change bookmark icon
|
||||||
|
@ -2338,7 +2338,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||||
header->GetValue(&val);
|
header->GetValue(&val);
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
eTagValue = val;
|
eTagValue.AssignWithConversion(val);
|
||||||
nsCRT::free(val);
|
nsCRT::free(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2347,7 +2347,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||||
header->GetValue(&val);
|
header->GetValue(&val);
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
lastModValue = val;
|
lastModValue.AssignWithConversion(val);
|
||||||
nsCRT::free(val);
|
nsCRT::free(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2356,7 +2356,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||||
header->GetValue(&val);
|
header->GetValue(&val);
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
contentLengthValue = val;
|
contentLengthValue.AssignWithConversion(val);
|
||||||
nsCRT::free(val);
|
nsCRT::free(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2542,10 +2542,10 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||||
}
|
}
|
||||||
|
|
||||||
// update icon?
|
// update icon?
|
||||||
if (schedule.Find(nsAutoString("icon"), PR_TRUE, 0) >= 0)
|
if (schedule.Find(NS_ConvertASCIItoUCS2("icon"), PR_TRUE, 0) >= 0)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIRDFLiteral> statusLiteral;
|
nsCOMPtr<nsIRDFLiteral> statusLiteral;
|
||||||
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(nsAutoString("new").GetUnicode(), getter_AddRefs(statusLiteral))))
|
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(NS_ConvertASCIItoUCS2("new").GetUnicode(), getter_AddRefs(statusLiteral))))
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIRDFNode> currentStatusNode;
|
nsCOMPtr<nsIRDFNode> currentStatusNode;
|
||||||
if (NS_SUCCEEDED(rv = mInner->GetTarget(busyResource, kWEB_Status, PR_TRUE,
|
if (NS_SUCCEEDED(rv = mInner->GetTarget(busyResource, kWEB_Status, PR_TRUE,
|
||||||
|
@ -2562,7 +2562,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||||
}
|
}
|
||||||
|
|
||||||
// play a sound?
|
// play a sound?
|
||||||
if (schedule.Find(nsAutoString("sound"), PR_TRUE, 0) >= 0)
|
if (schedule.Find(NS_ConvertASCIItoUCS2("sound"), PR_TRUE, 0) >= 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
nsCOMPtr<nsISound> soundInterface;
|
nsCOMPtr<nsISound> soundInterface;
|
||||||
|
@ -2580,14 +2580,14 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||||
PRBool openURLFlag = PR_FALSE;
|
PRBool openURLFlag = PR_FALSE;
|
||||||
|
|
||||||
// show an alert?
|
// show an alert?
|
||||||
if (schedule.Find(nsAutoString("alert"), PR_TRUE, 0) >= 0)
|
if (schedule.Find(NS_ConvertASCIItoUCS2("alert"), PR_TRUE, 0) >= 0)
|
||||||
{
|
{
|
||||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
|
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsAutoString promptStr;
|
nsAutoString promptStr;
|
||||||
getLocaleString("WebPageUpdated", promptStr);
|
getLocaleString("WebPageUpdated", promptStr);
|
||||||
if (promptStr.Length() > 0) promptStr += "\n\n";
|
if (promptStr.Length() > 0) promptStr.AppendWithConversion("\n\n");
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFNode> nameNode;
|
nsCOMPtr<nsIRDFNode> nameNode;
|
||||||
if (NS_SUCCEEDED(mInner->GetTarget(busyResource, kNC_Name,
|
if (NS_SUCCEEDED(mInner->GetTarget(busyResource, kNC_Name,
|
||||||
|
@ -2603,22 +2603,22 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||||
nsAutoString info;
|
nsAutoString info;
|
||||||
getLocaleString("WebPageTitle", info);
|
getLocaleString("WebPageTitle", info);
|
||||||
promptStr += info;
|
promptStr += info;
|
||||||
promptStr += " ";
|
promptStr.AppendWithConversion(" ");
|
||||||
promptStr += nameUni;
|
promptStr += nameUni;
|
||||||
promptStr += "\n";
|
promptStr.AppendWithConversion("\n");
|
||||||
getLocaleString("WebPageURL", info);
|
getLocaleString("WebPageURL", info);
|
||||||
promptStr += info;
|
promptStr += info;
|
||||||
promptStr += " ";
|
promptStr.AppendWithConversion(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
promptStr += uri;
|
promptStr.AppendWithConversion(uri);
|
||||||
|
|
||||||
nsAutoString temp;
|
nsAutoString temp;
|
||||||
getLocaleString("WebPageAskDisplay", temp);
|
getLocaleString("WebPageAskDisplay", temp);
|
||||||
if (temp.Length() > 0)
|
if (temp.Length() > 0)
|
||||||
{
|
{
|
||||||
promptStr += "\n\n";
|
promptStr.AppendWithConversion("\n\n");
|
||||||
promptStr += temp;
|
promptStr += temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2645,7 +2645,7 @@ nsBookmarksService::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
|
||||||
|
|
||||||
// open the URL in a new window?
|
// open the URL in a new window?
|
||||||
if ((openURLFlag == PR_TRUE) ||
|
if ((openURLFlag == PR_TRUE) ||
|
||||||
(schedule.Find(nsAutoString("open"), PR_TRUE, 0) >= 0))
|
(schedule.Find(NS_ConvertASCIItoUCS2("open"), PR_TRUE, 0) >= 0))
|
||||||
{
|
{
|
||||||
NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv);
|
NS_WITH_SERVICE(nsIAppShellService, appShell, kAppShellServiceCID, &rv);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
|
@ -3028,14 +3028,14 @@ nsBookmarksService::GetTarget(nsIRDFResource* aSource,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString ncURI(uri);
|
nsAutoString ncURI; ncURI.AssignWithConversion(uri);
|
||||||
if (ncURI.Find("NC:", PR_TRUE, 0) == 0)
|
if (ncURI.Find("NC:", PR_TRUE, 0) == 0)
|
||||||
{
|
{
|
||||||
return(NS_RDF_NO_VALUE);
|
return(NS_RDF_NO_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIRDFLiteral* literal;
|
nsIRDFLiteral* literal;
|
||||||
if (NS_FAILED(rv = gRDF->GetLiteral(nsAutoString(uri).GetUnicode(), &literal)))
|
if (NS_FAILED(rv = gRDF->GetLiteral(NS_ConvertASCIItoUCS2(uri).GetUnicode(), &literal)))
|
||||||
{
|
{
|
||||||
NS_ERROR("unable to construct literal for URL");
|
NS_ERROR("unable to construct literal for URL");
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -3294,7 +3294,7 @@ nsBookmarksService::ChangeURL(nsIRDFResource* aOldURL,
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFLiteral> literal;
|
nsCOMPtr<nsIRDFLiteral> literal;
|
||||||
rv = gRDF->GetLiteral(nsAutoString(uri).GetUnicode(), getter_AddRefs(literal));
|
rv = gRDF->GetLiteral(NS_ConvertASCIItoUCS2(uri).GetUnicode(), getter_AddRefs(literal));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// XXX rjc: was just aNewURL. Don't both aOldURL as well as aNewURL need to be pinged?
|
// XXX rjc: was just aNewURL. Don't both aOldURL as well as aNewURL need to be pinged?
|
||||||
|
@ -3713,7 +3713,7 @@ nsBookmarksService::setFolderHint(nsIRDFResource *newSource, nsIRDFResource *obj
|
||||||
const char *newSourceURI = nsnull;
|
const char *newSourceURI = nsnull;
|
||||||
if (NS_FAILED(rv = newSource->GetValueConst( &newSourceURI ))) return(rv);
|
if (NS_FAILED(rv = newSource->GetValueConst( &newSourceURI ))) return(rv);
|
||||||
nsCOMPtr<nsIRDFLiteral> newSourceLiteral;
|
nsCOMPtr<nsIRDFLiteral> newSourceLiteral;
|
||||||
if (NS_FAILED(rv = gRDF->GetLiteral(nsAutoString(newSourceURI).GetUnicode(),
|
if (NS_FAILED(rv = gRDF->GetLiteral(NS_ConvertASCIItoUCS2(newSourceURI).GetUnicode(),
|
||||||
getter_AddRefs(newSourceLiteral)))) return(rv);
|
getter_AddRefs(newSourceLiteral)))) return(rv);
|
||||||
|
|
||||||
// Note: use our Change() method, not mInner->Change(), due to Bookmarks magical #URL handling
|
// Note: use our Change() method, not mInner->Change(), due to Bookmarks magical #URL handling
|
||||||
|
@ -3813,7 +3813,7 @@ nsBookmarksService::importBookmarks(nsISupportsArray *aArguments)
|
||||||
|
|
||||||
// read 'em in
|
// read 'em in
|
||||||
BookmarkParser parser;
|
BookmarkParser parser;
|
||||||
parser.Init(&fileSpec, mInner, nsAutoString(""));
|
parser.Init(&fileSpec, mInner, nsAutoString());
|
||||||
parser.Parse(newBookmarkFolder, kNC_Bookmark);
|
parser.Parse(newBookmarkFolder, kNC_Bookmark);
|
||||||
|
|
||||||
return(NS_OK);
|
return(NS_OK);
|
||||||
|
@ -4061,7 +4061,7 @@ nsBookmarksService::ReadFavorites()
|
||||||
if (NS_SUCCEEDED(rv = gRDFC->MakeSeq(mInner, kNC_IEFavoritesRoot, nsnull)))
|
if (NS_SUCCEEDED(rv = gRDFC->MakeSeq(mInner, kNC_IEFavoritesRoot, nsnull)))
|
||||||
{
|
{
|
||||||
BookmarkParser parser;
|
BookmarkParser parser;
|
||||||
parser.Init(&ieFavoritesFile, mInner, nsAutoString(""));
|
parser.Init(&ieFavoritesFile, mInner, nsAutoString());
|
||||||
parser.Parse(kNC_IEFavoritesRoot, kNC_IEFavorite);
|
parser.Parse(kNC_IEFavoritesRoot, kNC_IEFavorite);
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFLiteral> ieTitleLiteral;
|
nsCOMPtr<nsIRDFLiteral> ieTitleLiteral;
|
||||||
|
@ -4368,8 +4368,9 @@ nsBookmarksService::WriteBookmarksContainer(nsIRDFDataSource *ds, nsOutputFileSt
|
||||||
NS_GET_IID(nsIRDFContainer), getter_AddRefs(container));
|
NS_GET_IID(nsIRDFContainer), getter_AddRefs(container));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsAutoString indentationString("");
|
nsAutoString indentationString;
|
||||||
for (PRInt32 loop=0; loop<level; loop++) indentationString += " ";
|
// STRING USE WARNING: converting in a loop. Probably not a good idea
|
||||||
|
for (PRInt32 loop=0; loop<level; loop++) indentationString.AppendWithConversion(" ");
|
||||||
char *indentation = indentationString.ToNewCString();
|
char *indentation = indentationString.ToNewCString();
|
||||||
if (nsnull == indentation) return(NS_ERROR_OUT_OF_MEMORY);
|
if (nsnull == indentation) return(NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
|
@ -4406,7 +4407,7 @@ nsBookmarksService::WriteBookmarksContainer(nsIRDFDataSource *ds, nsOutputFileSt
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFNode> nameNode;
|
nsCOMPtr<nsIRDFNode> nameNode;
|
||||||
nsAutoString nameString("");
|
nsAutoString nameString;
|
||||||
char *name = nsnull;
|
char *name = nsnull;
|
||||||
rv = ds->GetTarget(child, kNC_Name, PR_TRUE, getter_AddRefs(nameNode));
|
rv = ds->GetTarget(child, kNC_Name, PR_TRUE, getter_AddRefs(nameNode));
|
||||||
if (NS_SUCCEEDED(rv) && nameNode)
|
if (NS_SUCCEEDED(rv) && nameNode)
|
||||||
|
@ -4476,7 +4477,7 @@ nsBookmarksService::WriteBookmarksContainer(nsIRDFDataSource *ds, nsOutputFileSt
|
||||||
const char *url = nsnull;
|
const char *url = nsnull;
|
||||||
if (NS_SUCCEEDED(rv = child->GetValueConst(&url)) && (url))
|
if (NS_SUCCEEDED(rv = child->GetValueConst(&url)) && (url))
|
||||||
{
|
{
|
||||||
nsAutoString uri(url);
|
nsAutoString uri; uri.AssignWithConversion(url);
|
||||||
|
|
||||||
PRBool isBookmarkSeparator = PR_FALSE;
|
PRBool isBookmarkSeparator = PR_FALSE;
|
||||||
if (NS_SUCCEEDED(mInner->HasAssertion(child, kRDF_type,
|
if (NS_SUCCEEDED(mInner->HasAssertion(child, kRDF_type,
|
||||||
|
@ -4497,7 +4498,7 @@ nsBookmarksService::WriteBookmarksContainer(nsIRDFDataSource *ds, nsOutputFileSt
|
||||||
while ((offset = uri.FindChar(PRUnichar('\"'))) >= 0)
|
while ((offset = uri.FindChar(PRUnichar('\"'))) >= 0)
|
||||||
{
|
{
|
||||||
uri.Cut(offset, 1);
|
uri.Cut(offset, 1);
|
||||||
uri.Insert(kEscape22, offset);
|
uri.InsertWithConversion(kEscape22, offset);
|
||||||
}
|
}
|
||||||
char *escapedID = uri.ToNewUTF8String();
|
char *escapedID = uri.ToNewUTF8String();
|
||||||
if (escapedID)
|
if (escapedID)
|
||||||
|
@ -4604,7 +4605,7 @@ nsBookmarksService::GetTextForNode(nsIRDFNode* aNode, nsString& aResult)
|
||||||
else if (NS_SUCCEEDED(rv = aNode->QueryInterface(NS_GET_IID(nsIRDFResource), (void**) &resource))) {
|
else if (NS_SUCCEEDED(rv = aNode->QueryInterface(NS_GET_IID(nsIRDFResource), (void**) &resource))) {
|
||||||
const char *p = nsnull;
|
const char *p = nsnull;
|
||||||
if (NS_SUCCEEDED(rv = resource->GetValueConst( &p )) && (p)) {
|
if (NS_SUCCEEDED(rv = resource->GetValueConst( &p )) && (p)) {
|
||||||
aResult = p;
|
aResult.AssignWithConversion(p);
|
||||||
}
|
}
|
||||||
NS_RELEASE(resource);
|
NS_RELEASE(resource);
|
||||||
}
|
}
|
||||||
|
@ -4616,7 +4617,7 @@ nsBookmarksService::GetTextForNode(nsIRDFNode* aNode, nsString& aResult)
|
||||||
PRInt32 now32;
|
PRInt32 now32;
|
||||||
LL_L2I(now32, theDate);
|
LL_L2I(now32, theDate);
|
||||||
aResult.Truncate();
|
aResult.Truncate();
|
||||||
aResult.Append(now32, 10);
|
aResult.AppendInt(now32, 10);
|
||||||
}
|
}
|
||||||
NS_RELEASE(dateLiteral);
|
NS_RELEASE(dateLiteral);
|
||||||
}
|
}
|
||||||
|
@ -4624,7 +4625,7 @@ nsBookmarksService::GetTextForNode(nsIRDFNode* aNode, nsString& aResult)
|
||||||
PRInt32 theInt;
|
PRInt32 theInt;
|
||||||
aResult.Truncate();
|
aResult.Truncate();
|
||||||
if (NS_SUCCEEDED(rv = intLiteral->GetValue( &theInt ))) {
|
if (NS_SUCCEEDED(rv = intLiteral->GetValue( &theInt ))) {
|
||||||
aResult.Append(theInt, 10);
|
aResult.AppendInt(theInt, 10);
|
||||||
}
|
}
|
||||||
NS_RELEASE(intLiteral);
|
NS_RELEASE(intLiteral);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче