Bug 261593 get rid of AssignWithConversion in filesystemdatasource

r=axel@pike.org sr=darin
This commit is contained in:
cbiesinger%web.de 2004-09-30 21:44:02 +00:00
Родитель 803b606704
Коммит bfee8f8426
1 изменённых файлов: 19 добавлений и 23 удалений

Просмотреть файл

@ -576,38 +576,36 @@ FileSystemDataSource::GetTarget(nsIRDFResource *source,
} }
else if (property == kRDF_type) else if (property == kRDF_type)
{ {
const char *type; nsCString type;
rv = kNC_FileSystemObject->GetValueConst(&type); rv = kNC_FileSystemObject->GetValueUTF8(type);
if (NS_FAILED(rv)) return(rv); if (NS_FAILED(rv)) return(rv);
#ifdef XP_WIN #ifdef XP_WIN
// under Windows, if its an IE favorite, return that type // under Windows, if its an IE favorite, return that type
if (ieFavoritesDir) if (ieFavoritesDir)
{ {
const char *uri; nsCString uri;
rv = source->GetValueConst(&uri); rv = source->GetValueUTF8(uri);
if (NS_FAILED(rv)) return(rv); if (NS_FAILED(rv)) return(rv);
nsAutoString theURI; NS_ConvertUTF8toUTF16 theURI(uri);
theURI.AssignWithConversion(uri);
if (theURI.Find(ieFavoritesDir) == 0) if (theURI.Find(ieFavoritesDir) == 0)
{ {
if (theURI[theURI.Length() - 1] == '/') if (theURI[theURI.Length() - 1] == '/')
{ {
rv = kNC_IEFavoriteFolder->GetValueConst(&type); rv = kNC_IEFavoriteFolder->GetValueUTF8(type);
} }
else else
{ {
rv = kNC_IEFavoriteObject->GetValueConst(&type); rv = kNC_IEFavoriteObject->GetValueUTF8(type);
} }
if (NS_FAILED(rv)) return(rv); if (NS_FAILED(rv)) return(rv);
} }
} }
#endif #endif
nsAutoString url; NS_ConvertUTF8toUTF16 url(type);
url.AssignWithConversion(type);
nsCOMPtr<nsIRDFLiteral> literal; nsCOMPtr<nsIRDFLiteral> literal;
gRDFService->GetLiteral(url.get(), getter_AddRefs(literal)); gRDFService->GetLiteral(url.get(), getter_AddRefs(literal));
rv = literal->QueryInterface(NS_GET_IID(nsIRDFNode), (void**) target); rv = literal->QueryInterface(NS_GET_IID(nsIRDFNode), (void**) target);
@ -740,12 +738,11 @@ FileSystemDataSource::GetTargets(nsIRDFResource *source,
} }
else if (property == kRDF_type) else if (property == kRDF_type)
{ {
const char *uri = nsnull; nsCString uri;
rv = kNC_FileSystemObject->GetValueConst( &uri ); rv = kNC_FileSystemObject->GetValueUTF8(uri);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
nsAutoString url; NS_ConvertUTF8toUTF16 url(uri);
url.AssignWithConversion(uri);
nsCOMPtr<nsIRDFLiteral> literal; nsCOMPtr<nsIRDFLiteral> literal;
rv = gRDFService->GetLiteral(url.get(), getter_AddRefs(literal)); rv = gRDFService->GetLiteral(url.get(), getter_AddRefs(literal));
@ -1251,11 +1248,11 @@ FileSystemDataSource::isValidFolder(nsIRDFResource *source)
if (!ieFavoritesDir) return(isValid); if (!ieFavoritesDir) return(isValid);
nsresult rv; nsresult rv;
const char *uri; nsCString uri;
rv = source->GetValueConst(&uri); rv = source->GetValueUTF8(uri);
if (NS_FAILED(rv)) return(isValid); if (NS_FAILED(rv)) return(isValid);
nsAutoString theURI; theURI.AssignWithConversion(uri); NS_ConvertUTF8toUTF16 theURI(uri);
if (theURI.Find(ieFavoritesDir) == 0) if (theURI.Find(ieFavoritesDir) == 0)
{ {
isValid = PR_FALSE; isValid = PR_FALSE;
@ -1763,14 +1760,13 @@ FileSystemDataSource::GetURL(nsIRDFResource *source, PRBool *isFavorite, nsIRDFL
if (isFavorite) *isFavorite = PR_FALSE; if (isFavorite) *isFavorite = PR_FALSE;
nsresult rv; nsresult rv;
const char *uri; nsCString uri;
rv = source->GetValueConst(&uri); rv = source->GetValueUTF8(uri);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return(rv); return(rv);
nsAutoString url; NS_ConvertUTF8toUTF16 url(uri);
url.AssignWithConversion(uri);
#ifdef XP_WIN #ifdef XP_WIN
// under Windows, if its an IE favorite, munge the URL // under Windows, if its an IE favorite, munge the URL
@ -1789,7 +1785,7 @@ FileSystemDataSource::GetURL(nsIRDFResource *source, PRBool *isFavorite, nsIRDFL
// under BEOS, try and get the "META:url" attribute // under BEOS, try and get the "META:url" attribute
if (netPositiveDir) if (netPositiveDir)
{ {
if (strstr(uri, netPositiveDir) != 0) if (strstr(uri.get(), netPositiveDir) != 0)
{ {
if (isFavorite) *isFavorite = PR_TRUE; if (isFavorite) *isFavorite = PR_TRUE;
rv = getNetPositiveURL(source, url, aResult); rv = getNetPositiveURL(source, url, aResult);
@ -1842,7 +1838,7 @@ FileSystemDataSource::getNetPositiveURL(nsIRDFResource *source, nsString aFileUR
{ {
beURLattr[len] = '\0'; beURLattr[len] = '\0';
nsAutoString bookmarkURL; nsAutoString bookmarkURL;
bookmarkURL.AssignWithConversion(beURLattr); CopyUTF8toUTF16(beURLattr, bookmarkURL);
rv = gRDFService->GetLiteral(bookmarkURL.get(), rv = gRDFService->GetLiteral(bookmarkURL.get(),
urlLiteral); urlLiteral);
} }