diff --git a/b2g/app/nsBrowserApp.cpp b/b2g/app/nsBrowserApp.cpp index ba58880a3e0..7727e9cd161 100644 --- a/b2g/app/nsBrowserApp.cpp +++ b/b2g/app/nsBrowserApp.cpp @@ -18,7 +18,7 @@ #include #include "nsCOMPtr.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsStringGlue.h" #ifdef XP_WIN @@ -102,7 +102,7 @@ static const nsDynamicFunctionLoad kXULFuncs[] = { static int do_main(int argc, char* argv[]) { - nsCOMPtr appini; + nsCOMPtr appini; nsresult rv; // Allow firefox.exe to launch XULRunner apps via -app diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp index c090c969809..601bf3582c1 100644 --- a/browser/app/nsBrowserApp.cpp +++ b/browser/app/nsBrowserApp.cpp @@ -22,7 +22,7 @@ #include #include "nsCOMPtr.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsStringGlue.h" #ifdef XP_WIN @@ -106,7 +106,7 @@ static const nsDynamicFunctionLoad kXULFuncs[] = { static int do_main(int argc, char* argv[]) { - nsCOMPtr appini; + nsCOMPtr appini; nsresult rv; // Allow firefox.exe to launch XULRunner apps via -app diff --git a/browser/components/dirprovider/DirectoryProvider.cpp b/browser/components/dirprovider/DirectoryProvider.cpp index 1f62753819b..d4b7374df39 100644 --- a/browser/components/dirprovider/DirectoryProvider.cpp +++ b/browser/components/dirprovider/DirectoryProvider.cpp @@ -54,7 +54,7 @@ DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult) nsCString path; rv = prefs->GetCharPref("browser.bookmarks.file", getter_Copies(path)); if (NS_SUCCEEDED(rv)) { - NS_NewNativeLocalFile(path, true, (nsILocalFile**)(nsIFile**) getter_AddRefs(file)); + NS_NewNativeLocalFile(path, true, getter_AddRefs(file)); } } } diff --git a/browser/components/shell/public/nsIShellService.idl b/browser/components/shell/public/nsIShellService.idl index 0666bde6ce3..cf697080b9d 100644 --- a/browser/components/shell/public/nsIShellService.idl +++ b/browser/components/shell/public/nsIShellService.idl @@ -6,7 +6,7 @@ #include "nsISupports.idl" interface nsIDOMElement; -interface nsILocalFile; +interface nsIFile; [scriptable, uuid(bb477da4-dddf-4106-a562-f06c85c7f9a8)] interface nsIShellService : nsISupports @@ -99,10 +99,10 @@ interface nsIShellService : nsISupports * @param uri * The uri to be loaded by the application */ - void openApplicationWithURI(in nsILocalFile aApplication, in ACString aURI); + void openApplicationWithURI(in nsIFile aApplication, in ACString aURI); /** * The default system handler for web feeds */ - readonly attribute nsILocalFile defaultFeedReader; + readonly attribute nsIFile defaultFeedReader; }; diff --git a/browser/components/shell/src/nsGNOMEShellService.cpp b/browser/components/shell/src/nsGNOMEShellService.cpp index 47d252c9697..c1f442524aa 100644 --- a/browser/components/shell/src/nsGNOMEShellService.cpp +++ b/browser/components/shell/src/nsGNOMEShellService.cpp @@ -9,7 +9,7 @@ #include "nsGNOMEShellService.h" #include "nsShellService.h" #include "nsIServiceManager.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIProperties.h" #include "nsDirectoryServiceDefs.h" #include "nsIPrefService.h" @@ -107,8 +107,8 @@ nsGNOMEShellService::Init() (do_GetService("@mozilla.org/file/directory_service;1")); NS_ENSURE_TRUE(dirSvc, NS_ERROR_NOT_AVAILABLE); - nsCOMPtr appPath; - rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsILocalFile), + nsCOMPtr appPath; + rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(appPath)); NS_ENSURE_SUCCESS(rv, rv); @@ -641,7 +641,7 @@ nsGNOMEShellService::OpenApplication(PRInt32 aApplication) } NS_IMETHODIMP -nsGNOMEShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const nsACString& aURI) +nsGNOMEShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACString& aURI) { nsresult rv; nsCOMPtr process = @@ -659,7 +659,7 @@ nsGNOMEShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const ns } NS_IMETHODIMP -nsGNOMEShellService::GetDefaultFeedReader(nsILocalFile** _retval) +nsGNOMEShellService::GetDefaultFeedReader(nsIFile** _retval) { return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/browser/components/shell/src/nsMacShellService.cpp b/browser/components/shell/src/nsMacShellService.cpp index df2fca9a53f..3de6b0a5f3f 100644 --- a/browser/components/shell/src/nsMacShellService.cpp +++ b/browser/components/shell/src/nsMacShellService.cpp @@ -167,7 +167,7 @@ nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement, NS_ENSURE_SUCCESS(rv, rv); // Get the current user's "Pictures" folder (That's ~/Pictures): - fileLocator->Get(NS_OSX_PICTURE_DOCUMENTS_DIR, NS_GET_IID(nsILocalFile), + fileLocator->Get(NS_OSX_PICTURE_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mBackgroundFile)); if (!mBackgroundFile) return NS_ERROR_OUT_OF_MEMORY; @@ -329,7 +329,7 @@ nsMacShellService::OpenApplication(PRInt32 aApplication) break; case nsIMacShellService::APPLICATION_NETWORK: { - nsCOMPtr lf; + nsCOMPtr lf; rv = NS_NewNativeLocalFile(NETWORK_PREFPANE, true, getter_AddRefs(lf)); NS_ENSURE_SUCCESS(rv, rv); bool exists; @@ -341,7 +341,7 @@ nsMacShellService::OpenApplication(PRInt32 aApplication) break; case nsIMacShellService::APPLICATION_DESKTOP: { - nsCOMPtr lf; + nsCOMPtr lf; rv = NS_NewNativeLocalFile(DESKTOP_PREFPANE, true, getter_AddRefs(lf)); NS_ENSURE_SUCCESS(rv, rv); bool exists; @@ -382,7 +382,7 @@ nsMacShellService::SetDesktopBackgroundColor(PRUint32 aColor) } NS_IMETHODIMP -nsMacShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const nsACString& aURI) +nsMacShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACString& aURI) { nsCOMPtr lfm(do_QueryInterface(aApplication)); CFURLRef appURL; @@ -419,7 +419,7 @@ nsMacShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const nsAC } NS_IMETHODIMP -nsMacShellService::GetDefaultFeedReader(nsILocalFile** _retval) +nsMacShellService::GetDefaultFeedReader(nsIFile** _retval) { nsresult rv = NS_ERROR_FAILURE; *_retval = nsnull; diff --git a/browser/components/shell/src/nsMacShellService.h b/browser/components/shell/src/nsMacShellService.h index 07337b98be1..285ae1e9325 100644 --- a/browser/components/shell/src/nsMacShellService.h +++ b/browser/components/shell/src/nsMacShellService.h @@ -8,7 +8,7 @@ #include "nsIMacShellService.h" #include "nsIWebProgressListener.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsCOMPtr.h" class nsMacShellService : public nsIMacShellService, @@ -26,7 +26,7 @@ public: protected: private: - nsCOMPtr mBackgroundFile; + nsCOMPtr mBackgroundFile; bool mCheckedThisSession; }; diff --git a/browser/components/shell/src/nsWindowsShellService.cpp b/browser/components/shell/src/nsWindowsShellService.cpp index d7c85fae52e..881b5379307 100644 --- a/browser/components/shell/src/nsWindowsShellService.cpp +++ b/browser/components/shell/src/nsWindowsShellService.cpp @@ -213,9 +213,9 @@ GetHelperPath(nsAutoString& aPath) do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr appHelper; + nsCOMPtr appHelper; rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(appHelper)); NS_ENSURE_SUCCESS(rv, rv); @@ -1042,7 +1042,7 @@ nsWindowsShellService::LaunchPrefetchClearCommand(nsITimer *aTimer, void*) #endif NS_IMETHODIMP -nsWindowsShellService::OpenApplicationWithURI(nsILocalFile* aApplication, +nsWindowsShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACString& aURI) { nsresult rv; @@ -1061,7 +1061,7 @@ nsWindowsShellService::OpenApplicationWithURI(nsILocalFile* aApplication, } NS_IMETHODIMP -nsWindowsShellService::GetDefaultFeedReader(nsILocalFile** _retval) +nsWindowsShellService::GetDefaultFeedReader(nsIFile** _retval) { *_retval = nsnull; @@ -1090,7 +1090,7 @@ nsWindowsShellService::GetDefaultFeedReader(nsILocalFile** _retval) path = Substring(path, 0, path.FindChar(' ')); } - nsCOMPtr defaultReader = + nsCOMPtr defaultReader = do_CreateInstance("@mozilla.org/file/local;1", &rv); NS_ENSURE_SUCCESS(rv, rv); diff --git a/chrome/src/nsChromeRegistryChrome.cpp b/chrome/src/nsChromeRegistryChrome.cpp index 991be31c2a8..be7a9489002 100644 --- a/chrome/src/nsChromeRegistryChrome.cpp +++ b/chrome/src/nsChromeRegistryChrome.cpp @@ -32,7 +32,7 @@ #include "nsICommandLine.h" #include "nsILocaleService.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIObserverService.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" diff --git a/content/base/src/nsContentAreaDragDrop.cpp b/content/base/src/nsContentAreaDragDrop.cpp index 219f6838964..cfadb27e851 100644 --- a/content/base/src/nsContentAreaDragDrop.cpp +++ b/content/base/src/nsContentAreaDragDrop.cpp @@ -167,7 +167,7 @@ nsContentAreaDragDropDataProvider::SaveURIToFile(nsAString& inSourceURIString, // that in AddStringsToDataTransfer. // // 2. Someone put a kFilePromiseDirectoryMime flavor into the -// transferable with an nsILocalFile for the directory we are to +// transferable with an nsIFile for the directory we are to // save in. That has to be done by platform-specific code (in // widget), which gets the destination directory from // OS-specific drag information. @@ -218,7 +218,7 @@ nsContentAreaDragDropDataProvider::GetFlavorData(nsITransferable *aTransferable, dataSize = 0; aTransferable->GetTransferData(kFilePromiseDirectoryMime, getter_AddRefs(dirPrimitive), &dataSize); - nsCOMPtr destDirectory = do_QueryInterface(dirPrimitive); + nsCOMPtr destDirectory = do_QueryInterface(dirPrimitive); if (!destDirectory) return NS_ERROR_FAILURE; @@ -229,7 +229,7 @@ nsContentAreaDragDropDataProvider::GetFlavorData(nsITransferable *aTransferable, file->Append(targetFilename); rv = SaveURIToFile(sourceURLString, file); - // send back an nsILocalFile + // send back an nsIFile if (NS_SUCCEEDED(rv)) { CallQueryInterface(file, aData); *aDataLen = sizeof(nsIFile*); diff --git a/content/base/src/nsDOMFile.cpp b/content/base/src/nsDOMFile.cpp index 7a8eeac48e4..e9d42967925 100644 --- a/content/base/src/nsDOMFile.cpp +++ b/content/base/src/nsDOMFile.cpp @@ -599,12 +599,8 @@ nsDOMFileFile::Initialize(nsISupports* aOwner, return NS_ERROR_XPC_BAD_CONVERT_JS; } - nsCOMPtr localFile; - rv = NS_NewLocalFile(xpcomStr, false, getter_AddRefs(localFile)); + rv = NS_NewLocalFile(xpcomStr, false, getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv, rv); - - file = do_QueryInterface(localFile); - NS_ASSERTION(file, "This should never happen"); } bool exists; diff --git a/content/events/src/nsDOMDataTransfer.h b/content/events/src/nsDOMDataTransfer.h index 3b3b473d3a9..dbe22c2a887 100644 --- a/content/events/src/nsDOMDataTransfer.h +++ b/content/events/src/nsDOMDataTransfer.h @@ -17,7 +17,6 @@ #include "nsAutoPtr.h" #include "nsIFile.h" -#include "nsILocalFile.h" #include "nsDOMFile.h" class nsITransferable; diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index b52dbc0a306..3419fe102f8 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -66,7 +66,7 @@ #include "nsIRadioGroupContainer.h" // input type=file -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "nsDOMFile.h" #include "nsIFilePicker.h" @@ -297,17 +297,14 @@ AsyncClickHandler::Run() oldFiles[0]->GetMozFullPathInternal(path); - nsCOMPtr localFile; + nsCOMPtr localFile; rv = NS_NewLocalFile(path, false, getter_AddRefs(localFile)); if (NS_SUCCEEDED(rv)) { nsCOMPtr parentFile; rv = localFile->GetParent(getter_AddRefs(parentFile)); if (NS_SUCCEEDED(rv)) { - nsCOMPtr parentLocalFile = do_QueryInterface(parentFile, &rv); - if (parentLocalFile) { - filePicker->SetDisplayDirectory(parentLocalFile); - } + filePicker->SetDisplayDirectory(parentFile); } } @@ -323,7 +320,7 @@ AsyncClickHandler::Run() } } else { // Attempt to retrieve the last used directory from the content pref service - nsCOMPtr localFile; + nsCOMPtr localFile; nsHTMLInputElement::gUploadLastDir->FetchLastUsedDirectory(doc->GetDocumentURI(), getter_AddRefs(localFile)); if (!localFile) { @@ -358,7 +355,7 @@ AsyncClickHandler::Run() bool loop = true; while (NS_SUCCEEDED(iter->HasMoreElements(&loop)) && loop) { iter->GetNext(getter_AddRefs(tmp)); - nsCOMPtr localFile = do_QueryInterface(tmp); + nsCOMPtr localFile = do_QueryInterface(tmp); if (localFile) { nsString unicodePath; rv = localFile->GetPath(unicodePath); @@ -377,7 +374,7 @@ AsyncClickHandler::Run() } } else { - nsCOMPtr localFile; + nsCOMPtr localFile; rv = filePicker->GetFile(getter_AddRefs(localFile)); if (localFile) { nsString unicodePath; @@ -430,7 +427,7 @@ nsHTMLInputElement::DestroyUploadLastDir() { } nsresult -UploadLastDir::FetchLastUsedDirectory(nsIURI* aURI, nsILocalFile** aFile) +UploadLastDir::FetchLastUsedDirectory(nsIURI* aURI, nsIFile** aFile) { NS_PRECONDITION(aURI, "aURI is null"); NS_PRECONDITION(aFile, "aFile is null"); @@ -452,7 +449,7 @@ UploadLastDir::FetchLastUsedDirectory(nsIURI* aURI, nsILocalFile** aFile) nsString prefStr; pref->GetAsAString(prefStr); - nsCOMPtr localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); + nsCOMPtr localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); if (!localFile) return NS_ERROR_OUT_OF_MEMORY; localFile->InitWithPath(prefStr); @@ -462,7 +459,7 @@ UploadLastDir::FetchLastUsedDirectory(nsIURI* aURI, nsILocalFile** aFile) } nsresult -UploadLastDir::StoreLastUsedDirectory(nsIURI* aURI, nsILocalFile* aFile) +UploadLastDir::StoreLastUsedDirectory(nsIURI* aURI, nsIFile* aFile) { NS_PRECONDITION(aURI, "aURI is null"); NS_PRECONDITION(aFile, "aFile is null"); @@ -471,7 +468,6 @@ UploadLastDir::StoreLastUsedDirectory(nsIURI* aURI, nsILocalFile* aFile) if (!parentFile) { return NS_OK; } - nsCOMPtr localFile = do_QueryInterface(parentFile); // Attempt to get the CPS, if it's not present we'll just return nsCOMPtr contentPrefService = @@ -1065,10 +1061,8 @@ nsHTMLInputElement::MozSetFileNameArray(const PRUnichar **aFileNames, PRUint32 a if (!file) { // this is no "file://", try as local file - nsCOMPtr localFile; NS_NewLocalFile(nsDependentString(aFileNames[i]), - false, getter_AddRefs(localFile)); - file = do_QueryInterface(localFile); + false, getter_AddRefs(file)); } if (file) { diff --git a/content/html/content/src/nsHTMLInputElement.h b/content/html/content/src/nsHTMLInputElement.h index 1557b3f3fa4..7eabd81a7fa 100644 --- a/content/html/content/src/nsHTMLInputElement.h +++ b/content/html/content/src/nsHTMLInputElement.h @@ -36,7 +36,7 @@ public: * @param aURI URI of the current page * @param aFile path to the last used directory */ - nsresult FetchLastUsedDirectory(nsIURI* aURI, nsILocalFile** aFile); + nsresult FetchLastUsedDirectory(nsIURI* aURI, nsIFile** aFile); /** * Store the last used directory for this location using the @@ -45,7 +45,7 @@ public: * @param aFile file chosen by the user - the path to the parent of this * file will be stored */ - nsresult StoreLastUsedDirectory(nsIURI* aURI, nsILocalFile* aFile); + nsresult StoreLastUsedDirectory(nsIURI* aURI, nsIFile* aFile); }; class nsHTMLInputElement : public nsGenericHTMLFormElement, diff --git a/content/media/nsMediaCache.cpp b/content/media/nsMediaCache.cpp index 107ac4a6187..2fc84b1d88c 100644 --- a/content/media/nsMediaCache.cpp +++ b/content/media/nsMediaCache.cpp @@ -523,15 +523,12 @@ nsMediaCache::Init() // In multi-process Gecko, there is no profile dir, so just store it in the // system temp directory instead. nsresult rv; - nsCOMPtr tmp; + nsCOMPtr tmpFile; const char* dir = (XRE_GetProcessType() == GeckoProcessType_Content) ? NS_OS_TEMP_DIR : NS_APP_USER_PROFILE_LOCAL_50_DIR; - rv = NS_GetSpecialDirectory(dir, getter_AddRefs(tmp)); + rv = NS_GetSpecialDirectory(dir, getter_AddRefs(tmpFile)); NS_ENSURE_SUCCESS(rv,rv); - nsCOMPtr tmpFile = do_QueryInterface(tmp); - NS_ENSURE_TRUE(tmpFile != nsnull, NS_ERROR_FAILURE); - // We put the media cache file in // ${TempDir}/mozilla-media-cache/media_cache rv = tmpFile->AppendNative(nsDependentCString("mozilla-media-cache")); @@ -560,7 +557,7 @@ nsMediaCache::Init() NS_ENSURE_SUCCESS(rv,rv); PRFileDesc* fileDesc = nsnull; - rv = tmpFile->OpenNSPRFileDesc(PR_RDWR | nsILocalFile::DELETE_ON_CLOSE, + rv = tmpFile->OpenNSPRFileDesc(PR_RDWR | nsIFile::DELETE_ON_CLOSE, PR_IRWXU, &fileDesc); NS_ENSURE_SUCCESS(rv,rv); diff --git a/docshell/base/nsDefaultURIFixup.cpp b/docshell/base/nsDefaultURIFixup.cpp index 2ebda7491ca..ecbb90a2f3f 100644 --- a/docshell/base/nsDefaultURIFixup.cpp +++ b/docshell/base/nsDefaultURIFixup.cpp @@ -11,7 +11,7 @@ #include "nsCRT.h" #include "nsIPlatformCharset.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #ifdef MOZ_TOOLKIT_SEARCH #include "nsIBrowserSearchService.h" @@ -574,7 +574,7 @@ nsresult nsDefaultURIFixup::ConvertFileToStringURI(const nsACString& aIn, // rejects bad file paths when using this code on a new // platform. - nsCOMPtr filePath; + nsCOMPtr filePath; nsresult rv; // this is not the real fix but a temporary fix diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 039ea1eaac4..fe02bda462d 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -5,7 +5,7 @@ #include "nsDeviceStorage.h" #include "DOMRequest.h" #include "nsServiceManagerUtils.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIDirectoryEnumerator.h" #include "nsAppDirectoryServiceDefs.h" #include "nsIDOMFile.h" @@ -133,7 +133,7 @@ nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType, const PRInt32 aIn { PRInt32 typeResult = DEVICE_STORAGE_TYPE_DEFAULT; - nsCOMPtr f; + nsCOMPtr f; nsCOMPtr dirService = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID); NS_ASSERTION(dirService, "Must have directory service"); @@ -149,11 +149,11 @@ nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType, const PRInt32 aIn } #elif defined (MOZ_WIDGET_COCOA) if (aIndex == 0) { - dirService->Get(NS_OSX_PICTURE_DOCUMENTS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f)); + dirService->Get(NS_OSX_PICTURE_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f)); } #elif defined (XP_UNIX) if (aIndex == 0) { - dirService->Get(NS_UNIX_XDG_PICTURES_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f)); + dirService->Get(NS_UNIX_XDG_PICTURES_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f)); } #endif } @@ -170,11 +170,11 @@ nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType, const PRInt32 aIn } #elif defined (MOZ_WIDGET_COCOA) if (aIndex == 0) { - dirService->Get(NS_OSX_MOVIE_DOCUMENTS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f)); + dirService->Get(NS_OSX_MOVIE_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f)); } #elif defined (XP_UNIX) if (aIndex == 0) { - dirService->Get(NS_UNIX_XDG_VIDEOS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f)); + dirService->Get(NS_UNIX_XDG_VIDEOS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f)); } #endif } @@ -191,11 +191,11 @@ nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType, const PRInt32 aIn } #elif defined (MOZ_WIDGET_COCOA) if (aIndex == 0) { - dirService->Get(NS_OSX_MUSIC_DOCUMENTS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f)); + dirService->Get(NS_OSX_MUSIC_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f)); } #elif defined (XP_UNIX) if (aIndex == 0) { - dirService->Get(NS_UNIX_XDG_MUSIC_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f)); + dirService->Get(NS_UNIX_XDG_MUSIC_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f)); } #endif } @@ -205,12 +205,12 @@ nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType, const PRInt32 aIn // Temp directory if (aType.Equals(NS_LITERAL_STRING("temp")) && aIndex == 0) { - dirService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f)); + dirService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f)); } // Profile directory else if (aType.Equals(NS_LITERAL_STRING("profile")) && aIndex == 0) { - dirService->Get(NS_APP_USER_PROFILE_50_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f)); + dirService->Get(NS_APP_USER_PROFILE_50_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f)); } } diff --git a/dom/indexedDB/FileManager.cpp b/dom/indexedDB/FileManager.cpp index e995553f9ce..43bfd02d914 100644 --- a/dom/indexedDB/FileManager.cpp +++ b/dom/indexedDB/FileManager.cpp @@ -194,7 +194,7 @@ FileManager::Invalidate() already_AddRefed FileManager::GetDirectory() { - nsCOMPtr directory = + nsCOMPtr directory = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); NS_ENSURE_TRUE(directory, nsnull); diff --git a/dom/indexedDB/FileManager.h b/dom/indexedDB/FileManager.h index 8b62744f931..0aef5852941 100644 --- a/dom/indexedDB/FileManager.h +++ b/dom/indexedDB/FileManager.h @@ -9,7 +9,6 @@ #include "IndexedDatabase.h" #include "nsIFile.h" -#include "nsILocalFile.h" #include "nsIDOMFile.h" #include "nsDataHashtable.h" diff --git a/dom/indexedDB/IDBFactory.cpp b/dom/indexedDB/IDBFactory.cpp index 9cca7b3497b..5e6594bb32f 100644 --- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -8,7 +8,7 @@ #include "IDBFactory.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIPrincipal.h" #include "nsIScriptContext.h" @@ -164,7 +164,7 @@ IDBFactory::GetConnection(const nsAString& aDatabaseFilePath) NS_ASSERTION(StringEndsWith(aDatabaseFilePath, NS_LITERAL_STRING(".sqlite")), "Bad file path!"); - nsCOMPtr dbFile(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); + nsCOMPtr dbFile(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); NS_ENSURE_TRUE(dbFile, nsnull); nsresult rv = dbFile->InitWithPath(aDatabaseFilePath); diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 264adbc0a31..dfd7b54cc0a 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -10,7 +10,6 @@ #include "nsIDOMScriptObjectFactory.h" #include "nsIFile.h" #include "nsIFileStorage.h" -#include "nsILocalFile.h" #include "nsIObserverService.h" #include "nsIScriptObjectPrincipal.h" #include "nsIScriptSecurityManager.h" @@ -278,7 +277,7 @@ IndexedDatabaseManager::GetDirectoryForOrigin(const nsACString& aASCIIOrigin, nsIFile** aDirectory) const { nsresult rv; - nsCOMPtr directory = + nsCOMPtr directory = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); @@ -291,7 +290,7 @@ IndexedDatabaseManager::GetDirectoryForOrigin(const nsACString& aASCIIOrigin, rv = directory->Append(originSanitized); NS_ENSURE_SUCCESS(rv, rv); - directory.forget(reinterpret_cast(aDirectory)); + directory.forget(aDirectory); return NS_OK; } diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index e778844e62f..66ebe22b5ce 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1014,7 +1014,7 @@ ContentParent::RecvShowFilePicker(const PRInt16& mode, nsCOMPtr fileIter; *result = filePicker->GetFiles(getter_AddRefs(fileIter)); - nsCOMPtr singleFile; + nsCOMPtr singleFile; bool loop = true; while (NS_SUCCEEDED(fileIter->HasMoreElements(&loop)) && loop) { fileIter->GetNext(getter_AddRefs(singleFile)); @@ -1026,7 +1026,7 @@ ContentParent::RecvShowFilePicker(const PRInt16& mode, } return true; } - nsCOMPtr file; + nsCOMPtr file; filePicker->GetFile(getter_AddRefs(file)); // even with NS_OK file can be null if nothing was selected diff --git a/dom/ipc/CrashReporterParent.h b/dom/ipc/CrashReporterParent.h index b5190b60af1..53230ce9cff 100644 --- a/dom/ipc/CrashReporterParent.h +++ b/dom/ipc/CrashReporterParent.h @@ -6,7 +6,7 @@ #include "mozilla/dom/PCrashReporterParent.h" #include "mozilla/dom/TabMessageUtils.h" #include "nsXULAppAPI.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #ifdef MOZ_CRASHREPORTER #include "nsExceptionHandler.h" #endif @@ -115,8 +115,8 @@ CrashReporterParent::GeneratePairedMinidump(Toplevel* t) #else child = t->OtherProcess(); #endif - nsCOMPtr childDump; - nsCOMPtr parentDump; + nsCOMPtr childDump; + nsCOMPtr parentDump; if (CrashReporter::CreatePairedMinidumps(child, mMainThread, &mHangID, @@ -134,7 +134,7 @@ inline bool CrashReporterParent::GenerateCrashReport(Toplevel* t, const AnnotationTable* processNotes) { - nsCOMPtr crashDump; + nsCOMPtr crashDump; if (t->TakeMinidump(getter_AddRefs(crashDump)) && CrashReporter::GetIDFromMinidump(crashDump, mChildDumpID)) { return GenerateChildData(processNotes); diff --git a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp index fa8b740764e..286b64e1503 100644 --- a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp +++ b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp @@ -8,7 +8,7 @@ #include "prmem.h" #include "nsDirectoryServiceDefs.h" #include "nsDirectoryServiceUtils.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "nsPluginHost.h" #include "nsNPAPIPlugin.h" diff --git a/dom/plugins/base/nsNPAPIPluginStreamListener.h b/dom/plugins/base/nsNPAPIPluginStreamListener.h index 9f329e70ce4..577aa2d28e4 100644 --- a/dom/plugins/base/nsNPAPIPluginStreamListener.h +++ b/dom/plugins/base/nsNPAPIPluginStreamListener.h @@ -114,7 +114,7 @@ public: protected: char* mTarget; nsCString mFileURL; - nsCOMPtr mTempFile; + nsCOMPtr mTempFile; nsCOMPtr mOutputStream; nsIPluginInstanceOwner* mOwner; }; diff --git a/dom/plugins/base/nsPluginDirServiceProvider.cpp b/dom/plugins/base/nsPluginDirServiceProvider.cpp index aff8813900f..a4e904ad207 100644 --- a/dom/plugins/base/nsPluginDirServiceProvider.cpp +++ b/dom/plugins/base/nsPluginDirServiceProvider.cpp @@ -6,7 +6,7 @@ #include "nsPluginDirServiceProvider.h" #include "nsCRT.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsDependentString.h" #include "prmem.h" #include "nsArrayEnumerator.h" @@ -189,7 +189,7 @@ NS_IMETHODIMP nsPluginDirServiceProvider::GetFile(const char *charProp, bool *persistant, nsIFile **_retval) { - nsCOMPtr localFile; + nsCOMPtr localFile; nsresult rv = NS_ERROR_FAILURE; NS_ENSURE_ARG(charProp); @@ -451,7 +451,7 @@ nsPluginDirServiceProvider::GetPLIDDirectories(nsISimpleEnumerator **aEnumerator NS_ENSURE_ARG_POINTER(aEnumerator); *aEnumerator = nsnull; - nsCOMArray dirs; + nsCOMArray dirs; GetPLIDDirectoriesWithRootKey(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER, dirs); GetPLIDDirectoriesWithRootKey(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE, dirs); @@ -460,7 +460,7 @@ nsPluginDirServiceProvider::GetPLIDDirectories(nsISimpleEnumerator **aEnumerator } nsresult -nsPluginDirServiceProvider::GetPLIDDirectoriesWithRootKey(PRUint32 aKey, nsCOMArray &aDirs) +nsPluginDirServiceProvider::GetPLIDDirectoriesWithRootKey(PRUint32 aKey, nsCOMArray &aDirs) { nsCOMPtr regKey = do_CreateInstance("@mozilla.org/windows-registry-key;1"); @@ -485,7 +485,7 @@ nsPluginDirServiceProvider::GetPLIDDirectoriesWithRootKey(PRUint32 aKey, nsCOMAr nsAutoString path; rv = childKey->ReadStringValue(NS_LITERAL_STRING("Path"), path); if (NS_SUCCEEDED(rv)) { - nsCOMPtr localFile; + nsCOMPtr localFile; if (NS_SUCCEEDED(NS_NewLocalFile(path, true, getter_AddRefs(localFile))) && localFile) { @@ -496,7 +496,7 @@ nsPluginDirServiceProvider::GetPLIDDirectoriesWithRootKey(PRUint32 aKey, nsCOMAr nsCOMPtr temp; localFile->GetParent(getter_AddRefs(temp)); if (temp) - localFile = do_QueryInterface(temp); + localFile = temp; } // Now we check to make sure it's actually on disk and diff --git a/dom/plugins/base/nsPluginDirServiceProvider.h b/dom/plugins/base/nsPluginDirServiceProvider.h index 0460cd9a1cc..acaaa61490f 100644 --- a/dom/plugins/base/nsPluginDirServiceProvider.h +++ b/dom/plugins/base/nsPluginDirServiceProvider.h @@ -37,7 +37,7 @@ public: static nsresult GetPLIDDirectories(nsISimpleEnumerator **aEnumerator); private: static nsresult GetPLIDDirectoriesWithRootKey(PRUint32 aKey, - nsCOMArray &aDirs); + nsCOMArray &aDirs); #endif protected: diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index 89cafdc5f51..8c76ca0e706 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -84,7 +84,6 @@ #include "nsIMIMEService.h" #include "nsCExternalHandlerService.h" -#include "nsILocalFile.h" #include "nsIFileChannel.h" #include "nsPluginSafety.h" @@ -96,7 +95,6 @@ #include "nsDirectoryServiceDefs.h" #include "nsXULAppAPI.h" #include "nsAppDirectoryServiceDefs.h" -#include "nsIFile.h" #include "nsPluginDirServiceProvider.h" #include "nsPluginError.h" @@ -1546,7 +1544,7 @@ static nsresult CreateNPAPIPlugin(nsPluginTag *aPluginTag, if (!nsNPAPIPlugin::RunPluginOOP(aPluginTag)) { if (aPluginTag->mFullPath.IsEmpty()) return NS_ERROR_FAILURE; - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); file->InitWithPath(NS_ConvertUTF8toUTF16(aPluginTag->mFullPath)); nsPluginFile pluginFile(file); PRLibrary* pluginLibrary = NULL; @@ -1896,7 +1894,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir, if (NS_FAILED(rv)) return rv; - nsAutoTArray, 6> pluginFiles; + nsAutoTArray, 6> pluginFiles; bool hasMore; while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) { @@ -1904,7 +1902,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir, rv = iter->GetNext(getter_AddRefs(supports)); if (NS_FAILED(rv)) continue; - nsCOMPtr dirEntry(do_QueryInterface(supports, &rv)); + nsCOMPtr dirEntry(do_QueryInterface(supports, &rv)); if (NS_FAILED(rv)) continue; @@ -1920,7 +1918,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir, bool warnOutdated = false; for (PRUint32 i = 0; i < pluginFiles.Length(); i++) { - nsCOMPtr& localfile = pluginFiles[i]; + nsCOMPtr& localfile = pluginFiles[i]; nsString utf16FilePath; rv = localfile->GetPath(utf16FilePath); @@ -2445,11 +2443,7 @@ nsPluginHost::WritePluginInfo() if (NS_FAILED(rv)) return rv; - nsCOMPtr localFile = do_QueryInterface(pluginReg, &rv); - if (NS_FAILED(rv)) - return rv; - - rv = localFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd); + rv = pluginReg->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd); if (NS_FAILED(rv)) return rv; @@ -2555,9 +2549,9 @@ nsPluginHost::WritePluginInfo() PR_Close(fd); nsCOMPtr parent; - rv = localFile->GetParent(getter_AddRefs(parent)); + rv = pluginReg->GetParent(getter_AddRefs(parent)); NS_ENSURE_SUCCESS(rv, rv); - rv = localFile->MoveToNative(parent, kPluginRegistryFilename); + rv = pluginReg->MoveToNative(parent, kPluginRegistryFilename); return rv; } @@ -2597,12 +2591,8 @@ nsPluginHost::ReadPluginInfo() if (NS_FAILED(rv)) return rv; - nsCOMPtr localFile = do_QueryInterface(pluginReg, &rv); - if (NS_FAILED(rv)) - return rv; - PRInt64 fileSize; - rv = localFile->GetFileSize(&fileSize); + rv = pluginReg->GetFileSize(&fileSize); if (NS_FAILED(rv)) return rv; @@ -2617,7 +2607,7 @@ nsPluginHost::ReadPluginInfo() if (!registry) return NS_ERROR_OUT_OF_MEMORY; - rv = localFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &fd); + rv = pluginReg->OpenNSPRFileDesc(PR_RDONLY, 0444, &fd); if (NS_FAILED(rv)) return rv; @@ -2720,7 +2710,7 @@ nsPluginHost::ReadPluginInfo() return rv; // try to derive a file name from the full path if (fullpath) { - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); file->InitWithNativePath(nsDependentCString(fullpath)); file->GetNativeLeafName(derivedFileName); filename = derivedFileName.get(); @@ -3532,7 +3522,7 @@ nsPluginHost::CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile) rv = NS_GetFileFromURLSpec(nsDependentCString(aPostDataURL), getter_AddRefs(inFile)); if (NS_FAILED(rv)) { - nsCOMPtr localFile; + nsCOMPtr localFile; rv = NS_NewNativeLocalFile(nsDependentCString(aPostDataURL), false, getter_AddRefs(localFile)); if (NS_FAILED(rv)) return rv; diff --git a/dom/plugins/base/nsPluginsDirUnix.cpp b/dom/plugins/base/nsPluginsDirUnix.cpp index 236fcd394bb..04925c69fc9 100644 --- a/dom/plugins/base/nsPluginsDirUnix.cpp +++ b/dom/plugins/base/nsPluginsDirUnix.cpp @@ -13,7 +13,7 @@ #include "prerror.h" #include #include "nsString.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" diff --git a/dom/plugins/base/nsPluginsDirWin.cpp b/dom/plugins/base/nsPluginsDirWin.cpp index 24f8c306783..cc25b284721 100644 --- a/dom/plugins/base/nsPluginsDirWin.cpp +++ b/dom/plugins/base/nsPluginsDirWin.cpp @@ -23,7 +23,7 @@ #include "winbase.h" #include "nsString.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsUnicharUtils.h" using namespace mozilla; @@ -239,15 +239,13 @@ nsPluginFile::~nsPluginFile() */ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary) { - nsCOMPtr plugin = do_QueryInterface(mPlugin); - - if (!plugin) + if (!mPlugin) return NS_ERROR_NULL_POINTER; bool protectCurrentDirectory = true; nsAutoString pluginFolderPath; - plugin->GetPath(pluginFolderPath); + mPlugin->GetPath(pluginFolderPath); PRInt32 idx = pluginFolderPath.RFindChar('\\'); if (kNotFound == idx) @@ -273,7 +271,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary) SetDllDirectory(NULL); } - nsresult rv = plugin->Load(outLibrary); + nsresult rv = mPlugin->Load(outLibrary); if (NS_FAILED(rv)) *outLibrary = NULL; diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 0379a385d7c..2d7955a10ab 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -21,7 +21,7 @@ #include #endif -#include "nsILocalFile.h" +#include "nsIFile.h" #include "pratom.h" #include "nsDebug.h" @@ -152,7 +152,7 @@ PluginModuleChild::Init(const std::string& aPluginFilename, return false; mPluginFilename = aPluginFilename.c_str(); - nsCOMPtr localFile; + nsCOMPtr localFile; NS_NewLocalFile(NS_ConvertUTF8toUTF16(mPluginFilename), true, getter_AddRefs(localFile)); diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 116809f6225..9cee8cebef5 100644 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -31,7 +31,7 @@ #include "mozilla/dom/CrashReporterParent.h" #endif #include "nsNPAPIPlugin.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #ifdef XP_WIN #include "mozilla/widget/AudioSession.h" diff --git a/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl b/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl index dc0188f9cd7..4daff212795 100644 --- a/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl +++ b/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl @@ -10,7 +10,7 @@ interface nsIURI; interface nsIInputStream; interface nsIDOMDocument; interface nsIWebProgressListener; -interface nsILocalFile; +interface nsIFile; interface nsIChannel; /** @@ -127,11 +127,11 @@ interface nsIWebBrowserPersist : nsICancelable * nsnull. * @param aExtraHeaders Additional headers to supply with an HTTP request * or nsnull. - * @param aFile Target file. This may be a nsILocalFile object or an + * @param aFile Target file. This may be a nsIFile object or an * nsIURI object with a file scheme or a scheme that * supports uploading (e.g. ftp). * - * @see nsILocalFile + * @see nsIFile * @see nsIURI * @see nsIInputStream * @@ -227,12 +227,12 @@ interface nsIWebBrowserPersist : nsICancelable * @param aDocument Document to save to file. Some implementations of * this interface may also support nsnull * to imply the currently loaded document. - * @param aFile Target local file. This may be a nsILocalFile object or an + * @param aFile Target local file. This may be a nsIFile object or an * nsIURI object with a file scheme or a scheme that * supports uploading (e.g. ftp). * @param aDataPath Path to directory where URIs linked to the document * are saved or nsnull if no linked URIs should be saved. - * This may be a nsILocalFile object or an nsIURI object + * This may be a nsIFile object or an nsIURI object * with a file scheme. * @param aOutputContentType The desired MIME type format to save the * document and all subdocuments into or nsnull to use @@ -242,7 +242,7 @@ interface nsIWebBrowserPersist : nsICancelable * wrap text at. Parameter is ignored if wrapping is not * specified by the encoding flags. * - * @see nsILocalFile + * @see nsIFile * @see nsIURI * * @return NS_OK Operation has been started. diff --git a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index 9838680fde5..3614cd5ba30 100644 --- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -168,7 +168,7 @@ struct UploadData struct CleanupData { - nsCOMPtr mFile; + nsCOMPtr mFile; // Snapshot of what the file actually is at the time of creation so that if // it transmutes into something else later on it can be ignored. For example, // catch files that turn into dirs or vice versa. @@ -698,7 +698,7 @@ NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest( // delete 'data'; this will close the stream and let // us tag the file it created with its source URI nsCOMPtr uriSource = data->mOriginalLocation; - nsCOMPtr localFile; + nsCOMPtr localFile; GetLocalFileFromURI(data->mFile, getter_AddRefs(localFile)); delete data; mOutputMap.Remove(&key); @@ -1035,7 +1035,7 @@ nsresult nsWebBrowserPersist::SendErrorStatusChange( } // Get the file path or spec from the supplied URI - nsCOMPtr file; + nsCOMPtr file; GetLocalFileFromURI(aURI, getter_AddRefs(file)); nsAutoString path; if (file) @@ -1125,7 +1125,7 @@ nsresult nsWebBrowserPersist::GetValidURIFromObject(nsISupports *aObject, nsIURI return NS_ERROR_FAILURE; } -nsresult nsWebBrowserPersist::GetLocalFileFromURI(nsIURI *aURI, nsILocalFile **aLocalFile) const +nsresult nsWebBrowserPersist::GetLocalFileFromURI(nsIURI *aURI, nsIFile **aLocalFile) const { nsresult rv; @@ -1485,10 +1485,10 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal( NS_ENSURE_ARG_POINTER(aFile); // See if we can get the local file representation of this URI - nsCOMPtr localFile; + nsCOMPtr localFile; nsresult rv = GetLocalFileFromURI(aFile, getter_AddRefs(localFile)); - nsCOMPtr localDataPath; + nsCOMPtr localDataPath; if (NS_SUCCEEDED(rv) && aDataPath) { // See if we can get the local file representation of this URI @@ -1634,7 +1634,7 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal( } if (!haveDir) { - rv = localDataPath->Create(nsILocalFile::DIRECTORY_TYPE, 0755); + rv = localDataPath->Create(nsIFile::DIRECTORY_TYPE, 0755); if (NS_SUCCEEDED(rv)) haveDir = true; else @@ -1819,7 +1819,7 @@ void nsWebBrowserPersist::CleanupLocalFiles() for (i = 0; i < mCleanupList.Length(); i++) { CleanupData *cleanupData = mCleanupList.ElementAt(i); - nsCOMPtr file = cleanupData->mFile; + nsCOMPtr file = cleanupData->mFile; // Test if the dir / file exists (something in an earlier loop // may have already removed it) @@ -1880,7 +1880,7 @@ void nsWebBrowserPersist::CleanupLocalFiles() NS_ASSERTION(child, "No child element, but hasMoreElements says otherwise"); if (!child) continue; - nsCOMPtr childAsFile = do_QueryInterface(child); + nsCOMPtr childAsFile = do_QueryInterface(child); NS_ASSERTION(childAsFile, "This should be a file but isn't"); bool childIsSymlink = false; @@ -2051,7 +2051,7 @@ nsWebBrowserPersist::CalculateUniqueFilename(nsIURI *aURI) return NS_ERROR_FAILURE; } - nsCOMPtr localFile; + nsCOMPtr localFile; GetLocalFileFromURI(aURI, getter_AddRefs(localFile)); if (localFile) @@ -2114,7 +2114,7 @@ nsWebBrowserPersist::MakeFilenameFromURI(nsIURI *aURI, nsString &aFilename) // There is no point going any further since it will be // truncated in CalculateUniqueFilename anyway. // More importantly, certain implementations of - // nsILocalFile (e.g. the Mac impl) might truncate + // nsIFile (e.g. the Mac impl) might truncate // names in undesirable ways, such as truncating from // the middle, inserting ellipsis and so on. break; @@ -2170,7 +2170,7 @@ nsWebBrowserPersist::CalculateAndAppendFileExt(nsIURI *aURI, nsIChannel *aChanne mMIMEService->GetFromTypeAndExtension( contentType, EmptyCString(), getter_AddRefs(mimeInfo)); - nsCOMPtr localFile; + nsCOMPtr localFile; GetLocalFileFromURI(aURI, getter_AddRefs(localFile)); if (mimeInfo) @@ -2247,7 +2247,7 @@ nsWebBrowserPersist::MakeOutputStream( { nsresult rv; - nsCOMPtr localFile; + nsCOMPtr localFile; GetLocalFileFromURI(aURI, getter_AddRefs(localFile)); if (localFile) rv = MakeOutputStreamFromFile(localFile, aOutputStream); @@ -2259,7 +2259,7 @@ nsWebBrowserPersist::MakeOutputStream( nsresult nsWebBrowserPersist::MakeOutputStreamFromFile( - nsILocalFile *aFile, nsIOutputStream **aOutputStream) + nsIFile *aFile, nsIOutputStream **aOutputStream) { nsresult rv = NS_OK; @@ -3691,7 +3691,7 @@ nsWebBrowserPersist::SaveDocumentWithFixup( NS_ENSURE_ARG_POINTER(aFile); nsresult rv = NS_OK; - nsCOMPtr localFile; + nsCOMPtr localFile; GetLocalFileFromURI(aFile, getter_AddRefs(localFile)); if (localFile) { diff --git a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h index 43e94990d4b..8096200c77f 100644 --- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h +++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h @@ -20,7 +20,7 @@ #include "nsIDocumentEncoder.h" #include "nsITransport.h" #include "nsIProgressEventSink.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIWebProgressListener2.h" #include "nsHashtable.h" @@ -81,14 +81,14 @@ private: void Cleanup(); void CleanupLocalFiles(); nsresult GetValidURIFromObject(nsISupports *aObject, nsIURI **aURI) const; - nsresult GetLocalFileFromURI(nsIURI *aURI, nsILocalFile **aLocalFile) const; + nsresult GetLocalFileFromURI(nsIURI *aURI, nsIFile **aLocalFile) const; nsresult AppendPathToURI(nsIURI *aURI, const nsAString & aPath) const; nsresult MakeAndStoreLocalFilenameInURIMap( nsIURI *aURI, bool aNeedsPersisting, URIData **aData); nsresult MakeOutputStream( nsIURI *aFile, nsIOutputStream **aOutputStream); nsresult MakeOutputStreamFromFile( - nsILocalFile *aFile, nsIOutputStream **aOutputStream); + nsIFile *aFile, nsIOutputStream **aOutputStream); nsresult MakeOutputStreamFromURI(nsIURI *aURI, nsIOutputStream **aOutStream); nsresult CreateChannelFromURI(nsIURI *aURI, nsIChannel **aChannel); nsresult StartUpload(nsIStorageStream *aOutStream, nsIURI *aDestinationURI, diff --git a/embedding/tests/winEmbed/winEmbed.cpp b/embedding/tests/winEmbed/winEmbed.cpp index bf31e6f3c29..88ef0324721 100644 --- a/embedding/tests/winEmbed/winEmbed.cpp +++ b/embedding/tests/winEmbed/winEmbed.cpp @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) { strcpy(lastslash, "\\xulrunner"); - nsCOMPtr xuldir; + nsCOMPtr xuldir; rv = NS_NewNativeLocalFile(nsCString(path), false, getter_AddRefs(xuldir)); if (NS_FAILED(rv)) @@ -210,7 +210,7 @@ int main(int argc, char *argv[]) *lastslash = '\0'; - nsCOMPtr appdir; + nsCOMPtr appdir; rv = NS_NewNativeLocalFile(nsCString(path), false, getter_AddRefs(appdir)); if (NS_FAILED(rv)) @@ -746,7 +746,6 @@ nsresult StartupProfile() return rv; appDataDir->AppendNative(nsCString("winembed")); - nsCOMPtr localAppDataDir(do_QueryInterface(appDataDir)); nsCOMPtr locProvider; NS_NewProfileDirServiceProvider(true, getter_AddRefs(locProvider)); @@ -757,7 +756,7 @@ nsresult StartupProfile() if (NS_FAILED(rv)) return rv; - return locProvider->SetProfileDir(localAppDataDir); + return locProvider->SetProfileDir(appDataDir); } diff --git a/extensions/spellcheck/hunspell/src/mozHunspell.cpp b/extensions/spellcheck/hunspell/src/mozHunspell.cpp index e9d31c33fef..a2d19350782 100644 --- a/extensions/spellcheck/hunspell/src/mozHunspell.cpp +++ b/extensions/spellcheck/hunspell/src/mozHunspell.cpp @@ -188,7 +188,7 @@ NS_IMETHODIMP mozHunspell::SetDictionary(const PRUnichar *aDictionary) // XXX This isn't really good. nsIFile->NativePath isn't safe for all // character sets on Windows. - // A better way would be to QI to nsILocalFile, and get a filehandle + // A better way would be to QI to nsIFile, and get a filehandle // from there. Only problem is that hunspell wants a path nsresult rv = affFile->GetNativePath(affFileName); diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp index 47aaa00da7b..32e70c2a56b 100644 --- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -41,7 +41,7 @@ #elif defined(XP_WIN) -#include "nsILocalFile.h" +#include "nsIFile.h" #define GLES2_LIB "libGLESv2.dll" diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h index f0ad43bc3db..13861125809 100644 --- a/gfx/gl/GLLibraryEGL.h +++ b/gfx/gl/GLLibraryEGL.h @@ -12,7 +12,7 @@ #include "GLContext.h" #include "GLLibraryLoader.h" -#include "nsILocalFile.h" +#include "nsIFile.h" typedef int EGLint; typedef unsigned int EGLBoolean; diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index 4d8fb982e39..199963b43d4 100644 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -17,7 +17,7 @@ #include "nsTArray.h" #include "nsIWindowsRegKey.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "plbase64.h" #include "nsIXULRuntime.h" diff --git a/image/decoders/icon/mac/nsIconChannelCocoa.mm b/image/decoders/icon/mac/nsIconChannelCocoa.mm index 79c364c41d2..7273a6e1bba 100644 --- a/image/decoders/icon/mac/nsIconChannelCocoa.mm +++ b/image/decoders/icon/mac/nsIconChannelCocoa.mm @@ -210,14 +210,12 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, bool nonBlocki nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(fileloc), &desiredImageSize, contentType, fileExt); NS_ENSURE_SUCCESS(rv, rv); - // ensure that we DO NOT resolve aliases, very important for file views - nsCOMPtr localFile = do_QueryInterface(fileloc); - if (localFile) - localFile->SetFollowLinks(false); - bool fileExists = false; - if (fileloc) - localFile->Exists(&fileExists); + if (fileloc) { + // ensure that we DO NOT resolve aliases, very important for file views + fileloc->SetFollowLinks(false); + fileloc->Exists(&fileExists); + } NSImage* iconImage = nil; diff --git a/image/decoders/icon/os2/nsIconChannel.cpp b/image/decoders/icon/os2/nsIconChannel.cpp index 2a6b414887d..34ce6e52e0f 100644 --- a/image/decoders/icon/os2/nsIconChannel.cpp +++ b/image/decoders/icon/os2/nsIconChannel.cpp @@ -11,7 +11,7 @@ #include "nsReadableUtils.h" #include "nsMemory.h" #include "nsNetUtil.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIFileURL.h" #include "nsDirectoryServiceDefs.h" #include "nsIRwsService.h" diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index e484f50ecc6..e6fd88c1aa9 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -27,7 +27,6 @@ #include "nsDirectoryServiceDefs.h" #include "nsIFile.h" -#include "nsILocalFile.h" #include "mozilla/ipc/BrowserProcessSubThread.h" #include "mozilla/Omnijar.h" diff --git a/ipc/glue/ScopedXREEmbed.cpp b/ipc/glue/ScopedXREEmbed.cpp index e70771b79ad..f5fdd805a03 100644 --- a/ipc/glue/ScopedXREEmbed.cpp +++ b/ipc/glue/ScopedXREEmbed.cpp @@ -8,7 +8,6 @@ #include "base/string_util.h" #include "nsIFile.h" -#include "nsILocalFile.h" #include "nsCOMPtr.h" #include "nsServiceManagerUtils.h" @@ -41,7 +40,7 @@ ScopedXREEmbed::Start() # error Sorry #endif - nsCOMPtr localFile; + nsCOMPtr localFile; nsresult rv = XRE_GetBinaryPath(path.c_str(), getter_AddRefs(localFile)); if (NS_FAILED(rv)) return; diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index a15eda9f111..82555e9fd00 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -3040,7 +3040,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor): dumpvar = ExprVar('aDump') getdump = MethodDefn(MethodDecl( 'TakeMinidump', - params=[ Decl(Type('nsILocalFile', ptrptr=1), dumpvar.name) ], + params=[ Decl(Type('nsIFile', ptrptr=1), dumpvar.name) ], ret=Type.BOOL, const=1)) getdump.addstmts([ diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index 04e075120aa..a922d7fe925 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -84,7 +84,7 @@ public: void ClearGREDir() { mGREDir = nsnull; } private: - nsCOMPtr mGREDir; + nsCOMPtr mGREDir; }; inline XPCShellEnvironment* diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index 5bfa5e1ee29..c5ce4ae135d 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -22,7 +22,7 @@ #include "nsICategoryManager.h" #include "nsIComponentManager.h" #include "mozilla/Module.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIServiceManager.h" #include "nsISupports.h" #include "mozJSComponentLoader.h" @@ -442,7 +442,7 @@ mozJSComponentLoader::ReallyInit() const mozilla::Module* mozJSComponentLoader::LoadModule(FileLocation &aFile) { - nsCOMPtr file = aFile.GetBaseFile(); + nsCOMPtr file = aFile.GetBaseFile(); nsCString spec; aFile.GetURIString(spec); @@ -608,7 +608,7 @@ class ANSIFileAutoCloser #endif nsresult -mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile, +mozJSComponentLoader::GlobalForLocation(nsIFile *aComponentFile, nsIURI *aURI, JSObject **aGlobal, char **aLocation, @@ -666,7 +666,7 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile, nsCOMPtr locationHolder; rv = xpc->WrapNative(cx, global, aComponentFile, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(locationHolder)); NS_ENSURE_SUCCESS(rv, rv); @@ -1092,7 +1092,7 @@ mozJSComponentLoader::ImportInto(const nsACString & aLocation, rv = baseFileURL->GetFile(getter_AddRefs(sourceFile)); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr sourceLocalFile; + nsCOMPtr sourceLocalFile; sourceLocalFile = do_QueryInterface(sourceFile, &rv); NS_ENSURE_SUCCESS(rv, rv); diff --git a/js/xpconnect/loader/mozJSComponentLoader.h b/js/xpconnect/loader/mozJSComponentLoader.h index c234c95fa2f..752c680bc24 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.h +++ b/js/xpconnect/loader/mozJSComponentLoader.h @@ -54,7 +54,7 @@ class mozJSComponentLoader : public mozilla::ModuleLoader, nsresult ReallyInit(); void UnloadModules(); - nsresult GlobalForLocation(nsILocalFile* aComponentFile, + nsresult GlobalForLocation(nsIFile* aComponentFile, nsIURI *aComponent, JSObject **aGlobal, char **location, diff --git a/js/xpconnect/shell/xpcshell.cpp b/js/xpconnect/shell/xpcshell.cpp index a27adedb236..cf11514e963 100644 --- a/js/xpconnect/shell/xpcshell.cpp +++ b/js/xpconnect/shell/xpcshell.cpp @@ -27,10 +27,9 @@ #include "nsIServiceManager.h" #include "nsIComponentManager.h" #include "nsIComponentRegistrar.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsStringAPI.h" #include "nsIDirectoryService.h" -#include "nsILocalFile.h" #include "nsDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h" #include "nscore.h" @@ -91,12 +90,12 @@ public: bool SetGREDir(const char *dir); void ClearGREDir() { mGREDir = nsnull; } - void SetAppFile(nsILocalFile *appFile); + void SetAppFile(nsIFile *appFile); void ClearAppFile() { mAppFile = nsnull; } private: - nsCOMPtr mGREDir; - nsCOMPtr mAppFile; + nsCOMPtr mGREDir; + nsCOMPtr mAppFile; }; /***************************************************************************/ @@ -171,7 +170,7 @@ GetLocationProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, jsval *vp) NS_ConvertUTF8toUTF16 filenameString(filename); #endif - nsCOMPtr location; + nsCOMPtr location; if (NS_SUCCEEDED(rv)) { rv = NS_NewLocalFile(filenameString, false, getter_AddRefs(location)); @@ -197,7 +196,7 @@ GetLocationProperty(JSContext *cx, JSHandleObject obj, JSHandleId id, jsval *vp) !symlink) location->Normalize(); rv = xpc->WrapNative(cx, obj, location, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(locationHolder)); if (NS_SUCCEEDED(rv) && @@ -1705,7 +1704,7 @@ main(int argc, char **argv, char **envp) NS_LogInit(); - nsCOMPtr appFile; + nsCOMPtr appFile; rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appFile)); if (NS_FAILED(rv)) { printf("Couldn't find application file.\n"); @@ -1738,7 +1737,7 @@ main(int argc, char **argv, char **envp) if (argc < 3) return usage(); - nsCOMPtr dir; + nsCOMPtr dir; rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(dir)); if (NS_SUCCEEDED(rv)) { appDir = do_QueryInterface(dir, &rv); @@ -1755,7 +1754,7 @@ main(int argc, char **argv, char **envp) if (argc < 3) return usage(); - nsCOMPtr lf; + nsCOMPtr lf; rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(lf)); if (NS_FAILED(rv)) { printf("Couldn't get manifest file.\n"); @@ -1769,8 +1768,8 @@ main(int argc, char **argv, char **envp) { if (argc > 1 && !strcmp(argv[1], "--greomni")) { - nsCOMPtr greOmni; - nsCOMPtr appOmni; + nsCOMPtr greOmni; + nsCOMPtr appOmni; XRE_GetFileFromPath(argv[2], getter_AddRefs(greOmni)); if (argc > 3 && !strcmp(argv[3], "--appomni")) { XRE_GetFileFromPath(argv[4], getter_AddRefs(appOmni)); @@ -2008,7 +2007,7 @@ XPCShellDirProvider::SetGREDir(const char *dir) } void -XPCShellDirProvider::SetAppFile(nsILocalFile* appFile) +XPCShellDirProvider::SetAppFile(nsIFile* appFile) { mAppFile = appFile; } @@ -2068,7 +2067,7 @@ XPCShellDirProvider::GetFile(const char *prop, bool *persistent, #endif nsAutoString pathName; pathName.AssignASCII(path); - nsCOMPtr localFile; + nsCOMPtr localFile; nsresult rv = NS_NewLocalFile(pathName, true, getter_AddRefs(localFile)); if (NS_FAILED(rv)) { return rv; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index d157c6d239b..4a36086d124 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -8036,7 +8036,7 @@ DumpToPNG(nsIPresShell* shell, nsAString& name) { imgIEncoder::INPUT_FORMAT_HOSTARGB, EmptyString()); // XXX not sure if this is the right way to write to a file - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); rv = file->InitWithPath(name); NS_ENSURE_SUCCESS(rv, rv); diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index d4c08b0dee2..d1bada8eeb9 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -28,7 +28,7 @@ #include "nsIDOMMouseEvent.h" #include "nsINodeInfo.h" #include "nsIDOMEventTarget.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsHTMLInputElement.h" #include "nsNodeInfoManager.h" #include "nsContentCreatorFunctions.h" diff --git a/layout/style/nsFontFaceLoader.cpp b/layout/style/nsFontFaceLoader.cpp index 6750e3a32d7..17b8fbbba62 100644 --- a/layout/style/nsFontFaceLoader.cpp +++ b/layout/style/nsFontFaceLoader.cpp @@ -15,7 +15,6 @@ #include "nsError.h" #include "nsIFile.h" -#include "nsILocalFile.h" #include "nsIStreamListener.h" #include "nsNetUtil.h" #include "nsIChannelEventSink.h" diff --git a/layout/style/test/ParseCSS.cpp b/layout/style/test/ParseCSS.cpp index 4f3840b0fc0..c4681086453 100644 --- a/layout/style/test/ParseCSS.cpp +++ b/layout/style/test/ParseCSS.cpp @@ -15,7 +15,7 @@ #include "nsXPCOM.h" #include "nsCOMPtr.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "nsContentCID.h" @@ -25,7 +25,7 @@ static already_AddRefed FileToURI(const char *aFilename, nsresult *aRv = 0) { - nsCOMPtr lf(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, aRv)); + nsCOMPtr lf(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, aRv)); NS_ENSURE_TRUE(lf, nsnull); // XXX Handle relative paths somehow. lf->InitWithNativePath(nsDependentCString(aFilename)); diff --git a/layout/tools/layout-debug/src/nsILayoutRegressionTester.idl b/layout/tools/layout-debug/src/nsILayoutRegressionTester.idl index a915a0b2ff2..4de76417470 100644 --- a/layout/tools/layout-debug/src/nsILayoutRegressionTester.idl +++ b/layout/tools/layout-debug/src/nsILayoutRegressionTester.idl @@ -6,7 +6,7 @@ #include "nsISupports.idl" interface nsIDOMWindow; -interface nsILocalFile; +interface nsIFile; [scriptable, uuid(B249B2C0-EE11-11DA-8AD9-0800200C9A66)] interface nsILayoutRegressionTester : nsISupports @@ -28,7 +28,7 @@ interface nsILayoutRegressionTester : nsISupports const long DUMP_RESULT_LOADING = 1; // still loading const long DUMP_RESULT_ERROR = 2; // an error occurred - long dumpFrameModel(in nsIDOMWindow aWindowToDump, in nsILocalFile aFile, in unsigned long aFlagsMask); + long dumpFrameModel(in nsIDOMWindow aWindowToDump, in nsIFile aFile, in unsigned long aFlagsMask); /** * Compares the contents of frame model files @@ -39,6 +39,6 @@ interface nsILayoutRegressionTester : nsISupports */ const short COMPARE_FLAGS_VERBOSE = 0; const short COMPARE_FLAGS_BRIEF = 1; - long compareFrameModels(in nsILocalFile aBaseFile, in nsILocalFile aVerFile, in unsigned long aFlags); + long compareFrameModels(in nsIFile aBaseFile, in nsIFile aVerFile, in unsigned long aFlags); }; diff --git a/layout/tools/layout-debug/src/nsRegressionTester.cpp b/layout/tools/layout-debug/src/nsRegressionTester.cpp index 6f82a3d8518..fbaaea39cbe 100644 --- a/layout/tools/layout-debug/src/nsRegressionTester.cpp +++ b/layout/tools/layout-debug/src/nsRegressionTester.cpp @@ -28,7 +28,7 @@ #include "nsIFrameUtil.h" #include "nsLayoutCID.h" #include "nsNetUtil.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIViewManager.h" #include "nsIView.h" @@ -49,7 +49,7 @@ NS_IMPL_ISUPPORTS1(nsRegressionTester, nsILayoutRegressionTester) NS_IMETHODIMP nsRegressionTester::DumpFrameModel(nsIDOMWindow *aWindowToDump, - nsILocalFile *aDestFile, + nsIFile *aDestFile, PRUint32 aFlagsMask, PRInt32 *aResult) { NS_ENSURE_ARG(aWindowToDump); @@ -110,7 +110,7 @@ nsRegressionTester::DumpFrameModel(nsIDOMWindow *aWindowToDump, } NS_IMETHODIMP -nsRegressionTester::CompareFrameModels(nsILocalFile *aBaseFile, nsILocalFile *aVerFile, PRUint32 aFlags, PRInt32 *aResult) +nsRegressionTester::CompareFrameModels(nsIFile *aBaseFile, nsIFile *aVerFile, PRUint32 aFlags, PRInt32 *aResult) { NS_ENSURE_ARG(aBaseFile); NS_ENSURE_ARG(aVerFile); diff --git a/mobile/xul/app/nsBrowserApp.cpp b/mobile/xul/app/nsBrowserApp.cpp index 7b518a75050..228b3584cdb 100644 --- a/mobile/xul/app/nsBrowserApp.cpp +++ b/mobile/xul/app/nsBrowserApp.cpp @@ -18,7 +18,7 @@ #include #include "nsCOMPtr.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsStringGlue.h" #ifdef XP_WIN @@ -109,7 +109,7 @@ static const nsDynamicFunctionLoad kXULFuncs[] = { static int do_main(int argc, char* argv[]) { - nsCOMPtr appini; + nsCOMPtr appini; nsresult rv; // Allow firefox.exe to launch XULRunner apps via -app diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp index 7f086fb5d6c..815359b722b 100644 --- a/modules/libjar/nsJAR.cpp +++ b/modules/libjar/nsJAR.cpp @@ -5,7 +5,7 @@ #include #include "nsJARInputStream.h" #include "nsJAR.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIConsoleService.h" #include "nsICryptoHash.h" #include "prprf.h" @@ -216,10 +216,6 @@ nsJAR::Extract(const nsACString &aEntryName, nsIFile* outFile) // we need to use a lock to prevent bug #51267 MutexAutoLock lock(mLock); - nsresult rv; - nsCOMPtr localFile = do_QueryInterface(outFile, &rv); - if (NS_FAILED(rv)) return rv; - nsZipItem *item = mZip->GetItem(PromiseFlatCString(aEntryName).get()); NS_ENSURE_TRUE(item, NS_ERROR_FILE_TARGET_DOES_NOT_EXIST); @@ -232,22 +228,22 @@ nsJAR::Extract(const nsACString &aEntryName, nsIFile* outFile) //XXX is always FILE_DIR_NOT_EMPTY, we can remove //XXX |rv == NS_ERROR_FAILURE| - bug 322183 needs to be completely //XXX fixed before that can happen - rv = localFile->Remove(false); + nsresult rv = outFile->Remove(false); if (rv == NS_ERROR_FILE_DIR_NOT_EMPTY || rv == NS_ERROR_FAILURE) return rv; if (item->IsDirectory()) { - rv = localFile->Create(nsIFile::DIRECTORY_TYPE, item->Mode()); + rv = outFile->Create(nsIFile::DIRECTORY_TYPE, item->Mode()); //XXX Do this in nsZipArchive? It would be nice to keep extraction //XXX code completely there, but that would require a way to get a - //XXX PRDir from localFile. + //XXX PRDir from outFile. } else { PRFileDesc* fd; - rv = localFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE, item->Mode(), &fd); + rv = outFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE, item->Mode(), &fd); if (NS_FAILED(rv)) return rv; // ExtractFile also closes the fd handle and resolves the symlink if needed diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index e520da23877..aebe5c1532b 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -98,7 +98,7 @@ nsZipHandle::nsZipHandle() NS_IMPL_THREADSAFE_ADDREF(nsZipHandle) NS_IMPL_THREADSAFE_RELEASE(nsZipHandle) -nsresult nsZipHandle::Init(nsILocalFile *file, nsZipHandle **ret) +nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret) { mozilla::AutoFDClose fd; nsresult rv = file->OpenNSPRFileDesc(PR_RDONLY, 0000, &fd.rwget()); @@ -192,7 +192,7 @@ nsresult nsZipArchive::OpenArchive(nsZipHandle *aZipHandle) nsresult rv = BuildFileList(); char *env = PR_GetEnv("MOZ_JAR_LOG_DIR"); if (env && NS_SUCCEEDED(rv) && aZipHandle->mFile) { - nsCOMPtr logFile; + nsCOMPtr logFile; nsresult rv2 = NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), false, getter_AddRefs(logFile)); if (!NS_SUCCEEDED(rv2)) @@ -202,7 +202,7 @@ nsresult nsZipArchive::OpenArchive(nsZipHandle *aZipHandle) logFile->Create(nsIFile::DIRECTORY_TYPE, 0700); nsAutoString name; - nsCOMPtr file = aZipHandle->mFile.GetBaseFile(); + nsCOMPtr file = aZipHandle->mFile.GetBaseFile(); file->GetLeafName(name); name.Append(NS_LITERAL_STRING(".log")); logFile->Append(name); @@ -217,12 +217,8 @@ nsresult nsZipArchive::OpenArchive(nsZipHandle *aZipHandle) nsresult nsZipArchive::OpenArchive(nsIFile *aFile) { - nsresult rv; - nsCOMPtr localFile = do_QueryInterface(aFile, &rv); - NS_ENSURE_SUCCESS(rv, rv); - nsRefPtr handle; - rv = nsZipHandle::Init(localFile, getter_AddRefs(handle)); + nsresult rv = nsZipHandle::Init(aFile, getter_AddRefs(handle)); if (NS_FAILED(rv)) return rv; diff --git a/modules/libjar/nsZipArchive.h b/modules/libjar/nsZipArchive.h index 455890b05f3..ebf5ac604c0 100644 --- a/modules/libjar/nsZipArchive.h +++ b/modules/libjar/nsZipArchive.h @@ -19,7 +19,7 @@ #include "zlib.h" #include "zipstruct.h" #include "nsAutoPtr.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "mozilla/FileUtils.h" #include "mozilla/FileLocation.h" @@ -375,7 +375,7 @@ class nsZipHandle { friend class nsZipArchive; friend class mozilla::FileLocation; public: - static nsresult Init(nsILocalFile *file, nsZipHandle **ret NS_OUTPARAM); + static nsresult Init(nsIFile *file, nsZipHandle **ret NS_OUTPARAM); static nsresult Init(nsZipArchive *zip, const char *entry, nsZipHandle **ret NS_OUTPARAM); diff --git a/modules/libpref/public/nsIPrefBranch.idl b/modules/libpref/public/nsIPrefBranch.idl index f14546cc385..5c11652316d 100644 --- a/modules/libpref/public/nsIPrefBranch.idl +++ b/modules/libpref/public/nsIPrefBranch.idl @@ -133,7 +133,7 @@ interface nsIPrefBranch : nsISupports * @param aPrefName The complex preference to get the value of. * @param aType The XPCOM interface that this complex preference * represents. Interfaces currently supported are: - * - nsILocalFile + * - nsIFile * - nsISupportsString (UniChar) * - nsIPrefLocalizedString (Localized UniChar) * @param aValue The XPCOM object into which to the complex preference @@ -155,7 +155,7 @@ interface nsIPrefBranch : nsISupports * @param aPrefName The complex preference to set the value of. * @param aType The XPCOM interface that this complex preference * represents. Interfaces currently supported are: - * - nsILocalFile + * - nsIFile * - nsISupportsString (UniChar) * - nsIPrefLocalizedString (Localized UniChar) * @param aValue The XPCOM object from which to set the complex preference diff --git a/modules/libpref/public/nsIPrefService.idl b/modules/libpref/public/nsIPrefService.idl index 14d29027201..73adfb95409 100644 --- a/modules/libpref/public/nsIPrefService.idl +++ b/modules/libpref/public/nsIPrefService.idl @@ -17,7 +17,6 @@ struct nsTArrayInfallibleAllocator; [ptr] native nsPreferencePtrConst(const PrefTuple); interface nsIFile; -interface nsILocalFile; /** * The nsIPrefService interface is the main entry point into the back end diff --git a/modules/libpref/public/nsIRelativeFilePref.idl b/modules/libpref/public/nsIRelativeFilePref.idl index da26297f34b..9c695533760 100644 --- a/modules/libpref/public/nsIRelativeFilePref.idl +++ b/modules/libpref/public/nsIRelativeFilePref.idl @@ -4,10 +4,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -interface nsILocalFile; +interface nsIFile; /** - * The nsIRelativeFilePref interface is a wrapper for an nsILocalFile and + * The nsIRelativeFilePref interface is a wrapper for an nsIFile and * and a directory service key. When used as a pref value, it stores a * relative path to the file from the location pointed to by the directory * service key. The path has the same syntax across all platforms. @@ -25,7 +25,7 @@ interface nsIRelativeFilePref : nsISupports * * The file whose location is stored or retrieved. */ - attribute nsILocalFile file; + attribute nsIFile file; /** * relativeToKey @@ -53,7 +53,7 @@ interface nsIRelativeFilePref : nsISupports #include "nsComponentManagerUtils.h" inline nsresult -NS_NewRelativeFilePref(nsILocalFile* aFile, const nsACString& relativeToKey, nsIRelativeFilePref** result) +NS_NewRelativeFilePref(nsIFile* aFile, const nsACString& relativeToKey, nsIRelativeFilePref** result) { nsresult rv; nsCOMPtr local(do_CreateInstance(NS_RELATIVEFILEPREF_CONTRACTID, &rv)); diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp index a3071f447d3..21f783e27c3 100644 --- a/modules/libpref/src/Preferences.cpp +++ b/modules/libpref/src/Preferences.cpp @@ -18,7 +18,6 @@ #include "nsNetUtil.h" #include "nsIFile.h" #include "nsIInputStream.h" -#include "nsILocalFile.h" #include "nsIObserverService.h" #include "nsIStringEnumerator.h" #include "nsIZipReader.h" diff --git a/modules/libpref/src/nsPrefBranch.cpp b/modules/libpref/src/nsPrefBranch.cpp index ba7c6daa495..66bc6f36a30 100644 --- a/modules/libpref/src/nsPrefBranch.cpp +++ b/modules/libpref/src/nsPrefBranch.cpp @@ -7,7 +7,7 @@ #include "nsXULAppAPI.h" #include "nsPrefBranch.h" -#include "nsILocalFile.h" +#include "nsILocalFile.h" // nsILocalFile used for backwards compatibility #include "nsIObserverService.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" @@ -232,18 +232,19 @@ NS_IMETHODIMP nsPrefBranch::GetComplexValue(const char *aPrefName, const nsIID & return rv; } - if (aType.Equals(NS_GET_IID(nsILocalFile))) { + // also check nsILocalFile, for backwards compatibility + if (aType.Equals(NS_GET_IID(nsIFile)) || aType.Equals(NS_GET_IID(nsILocalFile))) { if (GetContentChild()) { - NS_ERROR("cannot get nsILocalFile pref from content process"); + NS_ERROR("cannot get nsIFile pref from content process"); return NS_ERROR_NOT_AVAILABLE; } - nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); + nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); if (NS_SUCCEEDED(rv)) { rv = file->SetPersistentDescriptor(utf8String); if (NS_SUCCEEDED(rv)) { - file.forget(reinterpret_cast(_retval)); + file.forget(reinterpret_cast(_retval)); return NS_OK; } } @@ -268,15 +269,15 @@ NS_IMETHODIMP nsPrefBranch::GetComplexValue(const char *aPrefName, const nsIID & return NS_ERROR_FAILURE; nsCAutoString key(Substring(keyBegin, keyEnd)); - nsCOMPtr fromFile; + nsCOMPtr fromFile; nsCOMPtr directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; - rv = directoryService->Get(key.get(), NS_GET_IID(nsILocalFile), getter_AddRefs(fromFile)); + rv = directoryService->Get(key.get(), NS_GET_IID(nsIFile), getter_AddRefs(fromFile)); if (NS_FAILED(rv)) return rv; - nsCOMPtr theFile; + nsCOMPtr theFile; rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(theFile)); if (NS_FAILED(rv)) return rv; @@ -317,8 +318,9 @@ NS_IMETHODIMP nsPrefBranch::SetComplexValue(const char *aPrefName, const nsIID & nsresult rv = NS_NOINTERFACE; - if (aType.Equals(NS_GET_IID(nsILocalFile))) { - nsCOMPtr file = do_QueryInterface(aValue); + // also check nsILocalFile, for backwards compatibility + if (aType.Equals(NS_GET_IID(nsIFile)) || aType.Equals(NS_GET_IID(nsILocalFile))) { + nsCOMPtr file = do_QueryInterface(aValue); if (!file) return NS_NOINTERFACE; nsCAutoString descriptorString; @@ -335,18 +337,18 @@ NS_IMETHODIMP nsPrefBranch::SetComplexValue(const char *aPrefName, const nsIID & if (!relFilePref) return NS_NOINTERFACE; - nsCOMPtr file; + nsCOMPtr file; relFilePref->GetFile(getter_AddRefs(file)); if (!file) return NS_NOINTERFACE; nsCAutoString relativeToKey; (void) relFilePref->GetRelativeToKey(relativeToKey); - nsCOMPtr relativeToFile; + nsCOMPtr relativeToFile; nsCOMPtr directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; - rv = directoryService->Get(relativeToKey.get(), NS_GET_IID(nsILocalFile), getter_AddRefs(relativeToFile)); + rv = directoryService->Get(relativeToKey.get(), NS_GET_IID(nsIFile), getter_AddRefs(relativeToFile)); if (NS_FAILED(rv)) return rv; @@ -802,7 +804,7 @@ nsRelativeFilePref::~nsRelativeFilePref() { } -NS_IMETHODIMP nsRelativeFilePref::GetFile(nsILocalFile **aFile) +NS_IMETHODIMP nsRelativeFilePref::GetFile(nsIFile **aFile) { NS_ENSURE_ARG_POINTER(aFile); *aFile = mFile; @@ -810,7 +812,7 @@ NS_IMETHODIMP nsRelativeFilePref::GetFile(nsILocalFile **aFile) return NS_OK; } -NS_IMETHODIMP nsRelativeFilePref::SetFile(nsILocalFile *aFile) +NS_IMETHODIMP nsRelativeFilePref::SetFile(nsIFile *aFile) { mFile = aFile; return NS_OK; diff --git a/modules/libpref/src/nsPrefBranch.h b/modules/libpref/src/nsPrefBranch.h index 1063393c6db..83b0559cac4 100644 --- a/modules/libpref/src/nsPrefBranch.h +++ b/modules/libpref/src/nsPrefBranch.h @@ -11,7 +11,7 @@ #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" #include "nsIRelativeFilePref.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsString.h" #include "nsVoidArray.h" #include "nsTArray.h" @@ -243,6 +243,6 @@ public: virtual ~nsRelativeFilePref(); private: - nsCOMPtr mFile; + nsCOMPtr mFile; nsCString mRelativeToKey; }; diff --git a/netwerk/base/public/nsIApplicationCache.idl b/netwerk/base/public/nsIApplicationCache.idl index 4a206f3725d..8bf5fe6a833 100644 --- a/netwerk/base/public/nsIApplicationCache.idl +++ b/netwerk/base/public/nsIApplicationCache.idl @@ -7,7 +7,7 @@ #include "nsISupports.idl" interface nsIArray; -interface nsILocalFile; +interface nsIFile; /** * Application caches can store a set of namespace entries that affect @@ -195,5 +195,5 @@ interface nsIApplicationCache : nsISupports * If set, this offline cache is placed in a different directory * than the current application profile. */ - readonly attribute nsILocalFile cacheDirectory; + readonly attribute nsIFile cacheDirectory; }; diff --git a/netwerk/base/public/nsIApplicationCacheService.idl b/netwerk/base/public/nsIApplicationCacheService.idl index 6e80001b1bb..4f6244587af 100644 --- a/netwerk/base/public/nsIApplicationCacheService.idl +++ b/netwerk/base/public/nsIApplicationCacheService.idl @@ -7,7 +7,7 @@ #include "nsISupports.idl" interface nsIApplicationCache; -interface nsILocalFile; +interface nsIFile; /** * The application cache service manages the set of application cache @@ -35,7 +35,7 @@ interface nsIApplicationCacheService : nsISupports * Optional override of the default quota. */ nsIApplicationCache createCustomApplicationCache(in ACString group, - in nsILocalFile profileDir, + in nsIFile profileDir, in PRInt32 quota); /** diff --git a/netwerk/base/public/nsICachingChannel.idl b/netwerk/base/public/nsICachingChannel.idl index 96a8aef8d97..05197c5a2fe 100644 --- a/netwerk/base/public/nsICachingChannel.idl +++ b/netwerk/base/public/nsICachingChannel.idl @@ -6,7 +6,6 @@ #include "nsICacheInfoChannel.idl" interface nsIFile; -interface nsILocalFile; /** * A channel may optionally implement this interface to allow clients @@ -92,7 +91,7 @@ interface nsICachingChannel : nsICacheInfoChannel * Override base (profile) directory to work with when accessing the cache. * When not specified, the current process' profile directory will be used. */ - attribute nsILocalFile profileDirectory; + attribute nsIFile profileDirectory; /** * Get the "file" where the cached data can be found. This is valid for diff --git a/netwerk/base/public/nsIFileStreams.idl b/netwerk/base/public/nsIFileStreams.idl index 1129facb16f..6943ec5c916 100644 --- a/netwerk/base/public/nsIFileStreams.idl +++ b/netwerk/base/public/nsIFileStreams.idl @@ -15,7 +15,7 @@ interface nsIFile; interface nsIFileInputStream : nsIInputStream { /** - * @param file file to read from (must QI to nsILocalFile) + * @param file file to read from * @param ioFlags file open flags listed in prio.h (see * PR_Open documentation) or -1 to open the * file in default mode (PR_RDONLY). @@ -81,7 +81,7 @@ interface nsIFileInputStream : nsIInputStream interface nsIFileOutputStream : nsIOutputStream { /** - * @param file file to write to (must QI to nsILocalFile) + * @param file file to write to * @param ioFlags file open flags listed in prio.h (see * PR_Open documentation) or -1 to open the * file in default mode (PR_WRONLY | @@ -125,7 +125,7 @@ interface nsIPartialFileInputStream : nsISupports * You must initialize the stream, and only initialize it once, before it * can be used. * - * @param file file to read from (must QI to nsILocalFile) + * @param file file to read from * @param start start offset of slice to read. Must be smaller * than the size of the file. * @param length length of slice to read. Must be small enough that @@ -150,8 +150,7 @@ interface nsIPartialFileInputStream : nsISupports interface nsIFileStream : nsISupports { /** - * @param file file to read from or stream to (must QI to - * nsILocalFile) + * @param file file to read from or stream to * @param ioFlags file open flags listed in prio.h (see * PR_Open documentation) or -1 to open the * file in default mode (PR_RDWR). diff --git a/netwerk/base/public/nsNetUtil.h b/netwerk/base/public/nsNetUtil.h index 6eed02a428d..947914a8dfa 100644 --- a/netwerk/base/public/nsNetUtil.h +++ b/netwerk/base/public/nsNetUtil.h @@ -44,7 +44,7 @@ #include "nsIProtocolHandler.h" #include "nsIFileProtocolHandler.h" #include "nsIStringStream.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIFileStreams.h" #include "nsIFileURL.h" #include "nsIProtocolProxyService.h" @@ -1119,7 +1119,7 @@ NS_NewPostDataStream(nsIInputStream **result, nsresult rv; if (isFile) { - nsCOMPtr file; + nsCOMPtr file; nsCOMPtr fileStream; rv = NS_NewNativeLocalFile(data, false, getter_AddRefs(file)); diff --git a/netwerk/base/src/nsFileStreams.cpp b/netwerk/base/src/nsFileStreams.cpp index b727b77a2bf..5a834e8bc37 100644 --- a/netwerk/base/src/nsFileStreams.cpp +++ b/netwerk/base/src/nsFileStreams.cpp @@ -19,7 +19,6 @@ #include "private/pprio.h" #include "nsFileStreams.h" -#include "nsILocalFile.h" #include "nsXPIDLString.h" #include "prerror.h" #include "nsCRT.h" @@ -251,7 +250,7 @@ nsFileStreamBase::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint3 } nsresult -nsFileStreamBase::MaybeOpen(nsILocalFile* aFile, PRInt32 aIoFlags, +nsFileStreamBase::MaybeOpen(nsIFile* aFile, PRInt32 aIoFlags, PRInt32 aPerm, bool aDeferred) { mOpenParams.ioFlags = aIoFlags; @@ -356,14 +355,12 @@ nsFileInputStream::Open(nsIFile* aFile, PRInt32 aIOFlags, PRInt32 aPerm) } // Open the file - nsCOMPtr localFile = do_QueryInterface(aFile, &rv); - if (NS_FAILED(rv)) return rv; if (aIOFlags == -1) aIOFlags = PR_RDONLY; if (aPerm == -1) aPerm = 0; - rv = MaybeOpen(localFile, aIOFlags, aPerm, + rv = MaybeOpen(aFile, aIOFlags, aPerm, mBehaviorFlags & nsIFileInputStream::DEFER_OPEN); if (NS_FAILED(rv)) return rv; @@ -478,7 +475,7 @@ nsFileInputStream::Read(const IPC::Message *aMsg, void **aIter) !ReadParam(aMsg, aIter, &flags)) return false; - nsCOMPtr file; + nsCOMPtr file; nsresult rv = NS_NewNativeLocalFile(path, followLinks, getter_AddRefs(file)); if (NS_FAILED(rv)) return false; @@ -500,9 +497,8 @@ nsFileInputStream::Write(IPC::Message *aMsg) nsCString path; mFile->GetNativePath(path); WriteParam(aMsg, path); - nsCOMPtr localFile = do_QueryInterface(mFile); bool followLinks; - localFile->GetFollowLinks(&followLinks); + mFile->GetFollowLinks(&followLinks); WriteParam(aMsg, followLinks); WriteParam(aMsg, mBehaviorFlags); } @@ -647,15 +643,12 @@ nsFileOutputStream::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm, mBehaviorFlags = behaviorFlags; - nsresult rv; - nsCOMPtr localFile = do_QueryInterface(file, &rv); - if (NS_FAILED(rv)) return rv; if (ioFlags == -1) ioFlags = PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE; if (perm <= 0) perm = 0664; - return MaybeOpen(localFile, ioFlags, perm, + return MaybeOpen(file, ioFlags, perm, mBehaviorFlags & nsIFileOutputStream::DEFER_OPEN); } @@ -680,7 +673,7 @@ nsSafeFileOutputStream::DoOpen() { // Make sure mOpenParams.localFile will be empty if we bail somewhere in // this function - nsCOMPtr file; + nsCOMPtr file; file.swap(mOpenParams.localFile); nsresult rv = file->Exists(&mTargetFileExists); @@ -696,9 +689,7 @@ nsSafeFileOutputStream::DoOpen() nsCOMPtr tempResult; rv = file->Clone(getter_AddRefs(tempResult)); if (NS_SUCCEEDED(rv)) { - nsCOMPtr tempLocal = do_QueryInterface(tempResult); - if (tempLocal) - tempLocal->SetFollowLinks(true); + tempResult->SetFollowLinks(true); // XP_UNIX ignores SetFollowLinks(), so we have to normalize. tempResult->Normalize(); @@ -717,9 +708,7 @@ nsSafeFileOutputStream::DoOpen() if (NS_SUCCEEDED(rv)) { // nsFileOutputStream::DoOpen will work on the temporary file, so we // prepare it and place it in mOpenParams.localFile. - nsCOMPtr localFile = do_QueryInterface(tempResult, &rv); - NS_ENSURE_SUCCESS(rv, rv); - mOpenParams.localFile = localFile; + mOpenParams.localFile = tempResult; mTempFile = tempResult; mTargetFile = file; rv = nsFileOutputStream::DoOpen(); @@ -826,14 +815,13 @@ nsFileStream::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm, mBehaviorFlags = behaviorFlags; nsresult rv; - nsCOMPtr localFile = do_QueryInterface(file, &rv); if (NS_FAILED(rv)) return rv; if (ioFlags == -1) ioFlags = PR_RDWR; if (perm <= 0) perm = 0; - return MaybeOpen(localFile, ioFlags, perm, + return MaybeOpen(file, ioFlags, perm, mBehaviorFlags & nsIFileStream::DEFER_OPEN); } diff --git a/netwerk/base/src/nsFileStreams.h b/netwerk/base/src/nsFileStreams.h index cd5c5cfaab4..d1401e9cf0e 100644 --- a/netwerk/base/src/nsFileStreams.h +++ b/netwerk/base/src/nsFileStreams.h @@ -59,7 +59,7 @@ protected: bool mDeferredOpen; struct OpenParams { - nsCOMPtr localFile; + nsCOMPtr localFile; PRInt32 ioFlags; PRInt32 perm; }; @@ -74,7 +74,7 @@ protected: * by calling DoOpen(), or leaves it to be opened later by a call to * DoPendingOpen(). */ - nsresult MaybeOpen(nsILocalFile* aFile, PRInt32 aIoFlags, PRInt32 aPerm, + nsresult MaybeOpen(nsIFile* aFile, PRInt32 aIoFlags, PRInt32 aPerm, bool aDeferred); /** diff --git a/netwerk/base/src/nsIncrementalDownload.cpp b/netwerk/base/src/nsIncrementalDownload.cpp index 8ebda536ea1..d6752aaefd0 100644 --- a/netwerk/base/src/nsIncrementalDownload.cpp +++ b/netwerk/base/src/nsIncrementalDownload.cpp @@ -16,7 +16,7 @@ #include "nsIObserver.h" #include "nsIPropertyBag2.h" #include "nsIServiceManager.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsITimer.h" #include "nsNetUtil.h" #include "nsAutoPtr.h" @@ -47,7 +47,7 @@ //----------------------------------------------------------------------------- static nsresult -WriteToFile(nsILocalFile *lf, const char *data, PRUint32 len, PRInt32 flags) +WriteToFile(nsIFile *lf, const char *data, PRUint32 len, PRInt32 flags) { PRFileDesc *fd; nsresult rv = lf->OpenNSPRFileDesc(flags, 0600, &fd); @@ -62,7 +62,7 @@ WriteToFile(nsILocalFile *lf, const char *data, PRUint32 len, PRInt32 flags) } static nsresult -AppendToFile(nsILocalFile *lf, const char *data, PRUint32 len) +AppendToFile(nsIFile *lf, const char *data, PRUint32 len) { PRInt32 flags = PR_WRONLY | PR_CREATE_FILE | PR_APPEND; return WriteToFile(lf, data, len, flags); @@ -128,7 +128,7 @@ private: nsCOMPtr mProgressSink; nsCOMPtr mURI; nsCOMPtr mFinalURI; - nsCOMPtr mDest; + nsCOMPtr mDest; nsCOMPtr mChannel; nsCOMPtr mTimer; nsAutoArrayPtr mChunk; diff --git a/netwerk/base/src/nsStandardURL.cpp b/netwerk/base/src/nsStandardURL.cpp index bc0951ce9f3..ff89d6dc1d8 100644 --- a/netwerk/base/src/nsStandardURL.cpp +++ b/netwerk/base/src/nsStandardURL.cpp @@ -11,7 +11,7 @@ #include "nsReadableUtils.h" #include "nsCRT.h" #include "nsEscape.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIObjectInputStream.h" #include "nsIObjectOutputStream.h" #include "nsICharsetConverterManager.h" diff --git a/netwerk/base/src/nsURLHelper.cpp b/netwerk/base/src/nsURLHelper.cpp index a859efa1e3e..b5da65bc754 100644 --- a/netwerk/base/src/nsURLHelper.cpp +++ b/netwerk/base/src/nsURLHelper.cpp @@ -10,7 +10,7 @@ #include "nsReadableUtils.h" #include "nsIServiceManager.h" #include "nsIIOService.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIURLParser.h" #include "nsIURI.h" #include "nsMemory.h" diff --git a/netwerk/base/src/nsURLHelperOS2.cpp b/netwerk/base/src/nsURLHelperOS2.cpp index 0fb0256dbf2..7b3a1505378 100644 --- a/netwerk/base/src/nsURLHelperOS2.cpp +++ b/netwerk/base/src/nsURLHelperOS2.cpp @@ -10,7 +10,7 @@ #include #include "nsURLHelper.h" #include "nsEscape.h" -#include "nsILocalFile.h" +#include "nsIFile.h" nsresult net_GetURLSpecFromActualFile(nsIFile *aFile, nsACString &result) @@ -49,10 +49,10 @@ net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result) { nsresult rv; - nsCOMPtr localFile( + nsCOMPtr localFile( do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); if (NS_FAILED(rv)) { - NS_ERROR("Only nsILocalFile supported right now"); + NS_ERROR("Only nsIFile supported right now"); return rv; } diff --git a/netwerk/base/src/nsURLHelperOSX.cpp b/netwerk/base/src/nsURLHelperOSX.cpp index 415b5c9fd36..e85bfb11dd4 100644 --- a/netwerk/base/src/nsURLHelperOSX.cpp +++ b/netwerk/base/src/nsURLHelperOSX.cpp @@ -7,7 +7,7 @@ /* Mac OS X-specific local file uri parsing */ #include "nsURLHelper.h" #include "nsEscape.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsTArray.h" #include "nsReadableUtils.h" #include @@ -148,7 +148,7 @@ net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result) nsresult rv; - nsCOMPtr localFile; + nsCOMPtr localFile; rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(localFile)); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/base/src/nsURLHelperUnix.cpp b/netwerk/base/src/nsURLHelperUnix.cpp index 2f75719057b..66d7ea75bae 100644 --- a/netwerk/base/src/nsURLHelperUnix.cpp +++ b/netwerk/base/src/nsURLHelperUnix.cpp @@ -7,7 +7,7 @@ /* Unix-specific local file uri parsing */ #include "nsURLHelper.h" #include "nsEscape.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNativeCharsetUtils.h" nsresult @@ -55,7 +55,7 @@ net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result) nsresult rv; - nsCOMPtr localFile; + nsCOMPtr localFile; rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(localFile)); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/base/src/nsURLHelperWin.cpp b/netwerk/base/src/nsURLHelperWin.cpp index 41edc78d3a2..a1cdcb23c93 100644 --- a/netwerk/base/src/nsURLHelperWin.cpp +++ b/netwerk/base/src/nsURLHelperWin.cpp @@ -7,7 +7,7 @@ /* Windows-specific local file uri parsing */ #include "nsURLHelper.h" #include "nsEscape.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include nsresult @@ -51,10 +51,10 @@ net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result) { nsresult rv; - nsCOMPtr localFile( + nsCOMPtr localFile( do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); if (NS_FAILED(rv)) { - NS_ERROR("Only nsILocalFile supported right now"); + NS_ERROR("Only nsIFile supported right now"); return rv; } diff --git a/netwerk/cache/nsApplicationCacheService.cpp b/netwerk/cache/nsApplicationCacheService.cpp index 4a016aec0f4..dc69f5b9079 100644 --- a/netwerk/cache/nsApplicationCacheService.cpp +++ b/netwerk/cache/nsApplicationCacheService.cpp @@ -36,7 +36,7 @@ nsApplicationCacheService::CreateApplicationCache(const nsACString &group, NS_IMETHODIMP nsApplicationCacheService::CreateCustomApplicationCache(const nsACString & group, - nsILocalFile *profileDir, + nsIFile *profileDir, PRInt32 quota, nsIApplicationCache **out) { diff --git a/netwerk/cache/nsCacheRequest.h b/netwerk/cache/nsCacheRequest.h index 0cdc14786ee..462718939fc 100644 --- a/netwerk/cache/nsCacheRequest.h +++ b/netwerk/cache/nsCacheRequest.h @@ -153,7 +153,7 @@ private: nsCOMPtr mThread; Mutex mLock; CondVar mCondVar; - nsCOMPtr mProfileDir; + nsCOMPtr mProfileDir; }; #endif // _nsCacheRequest_h_ diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp index 63998349569..ec6d13965fa 100644 --- a/netwerk/cache/nsCacheService.cpp +++ b/netwerk/cache/nsCacheService.cpp @@ -23,7 +23,7 @@ #include "nsIObserverService.h" #include "nsIPrefService.h" #include "nsIPrefBranch.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIOService.h" #include "nsDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h" @@ -140,12 +140,12 @@ public: PRInt32 DiskCacheCapacity() { return mDiskCacheCapacity; } void SetDiskCacheCapacity(PRInt32); PRInt32 DiskCacheMaxEntrySize() { return mDiskCacheMaxEntrySize; } - nsILocalFile * DiskCacheParentDirectory() { return mDiskCacheParentDirectory; } + nsIFile * DiskCacheParentDirectory() { return mDiskCacheParentDirectory; } bool SmartSizeEnabled() { return mSmartSizeEnabled; } bool OfflineCacheEnabled(); PRInt32 OfflineCacheCapacity() { return mOfflineCacheCapacity; } - nsILocalFile * OfflineCacheParentDirectory() { return mOfflineCacheParentDirectory; } + nsIFile * OfflineCacheParentDirectory() { return mOfflineCacheParentDirectory; } bool MemoryCacheEnabled(); PRInt32 MemoryCacheCapacity(); @@ -165,12 +165,12 @@ private: bool mDiskCacheEnabled; PRInt32 mDiskCacheCapacity; // in kilobytes PRInt32 mDiskCacheMaxEntrySize; // in kilobytes - nsCOMPtr mDiskCacheParentDirectory; + nsCOMPtr mDiskCacheParentDirectory; bool mSmartSizeEnabled; bool mOfflineCacheEnabled; PRInt32 mOfflineCacheCapacity; // in kilobytes - nsCOMPtr mOfflineCacheParentDirectory; + nsCOMPtr mOfflineCacheParentDirectory; bool mMemoryCacheEnabled; PRInt32 mMemoryCacheCapacity; // in kilobytes @@ -584,7 +584,7 @@ nsCacheProfilePrefObserver::GetSmartCacheSize(const nsAString& cachePath, { // Check for free space on device where cache directory lives nsresult rv; - nsCOMPtr + nsCOMPtr cacheDirectory (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); if (NS_FAILED(rv) || !cacheDirectory) return DEFAULT_CACHE_SIZE; @@ -656,7 +656,7 @@ nsCacheProfilePrefObserver::ReadPrefs(nsIPrefBranch* branch) mDiskCacheMaxEntrySize = NS_MAX(-1, mDiskCacheMaxEntrySize); (void) branch->GetComplexValue(DISK_CACHE_DIR_PREF, // ignore error - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(mDiskCacheParentDirectory)); if (!mDiskCacheParentDirectory) { @@ -733,7 +733,7 @@ nsCacheProfilePrefObserver::ReadPrefs(nsIPrefBranch* branch) mOfflineCacheCapacity = NS_MAX(0, mOfflineCacheCapacity); (void) branch->GetComplexValue(OFFLINE_CACHE_DIR_PREF, // ignore error - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(mOfflineCacheParentDirectory)); if (!mOfflineCacheParentDirectory) { @@ -1161,7 +1161,7 @@ nsCacheService::Shutdown() Telemetry::AutoTimer totalTimer; bool shouldSanitize = false; - nsCOMPtr parentDir; + nsCOMPtr parentDir; { nsCacheServiceAutoLock lock; @@ -1545,7 +1545,7 @@ nsCacheService::GetOfflineDevice(nsOfflineCacheDevice **aDevice) } nsresult -nsCacheService::GetCustomOfflineDevice(nsILocalFile *aProfileDir, +nsCacheService::GetCustomOfflineDevice(nsIFile *aProfileDir, PRInt32 aQuota, nsOfflineCacheDevice **aDevice) { @@ -1583,7 +1583,7 @@ nsCacheService::CreateOfflineDevice() } nsresult -nsCacheService::CreateCustomOfflineDevice(nsILocalFile *aProfileDir, +nsCacheService::CreateCustomOfflineDevice(nsIFile *aProfileDir, PRInt32 aQuota, nsOfflineCacheDevice **aDevice) { diff --git a/netwerk/cache/nsCacheService.h b/netwerk/cache/nsCacheService.h index 238a66e82c0..e36dd3600fe 100644 --- a/netwerk/cache/nsCacheService.h +++ b/netwerk/cache/nsCacheService.h @@ -118,7 +118,7 @@ public: * A tool to preload offline cache for profiles different from the current * application's profile directory. */ - nsresult GetCustomOfflineDevice(nsILocalFile *aProfileDir, + nsresult GetCustomOfflineDevice(nsIFile *aProfileDir, PRInt32 aQuota, nsOfflineCacheDevice **aDevice); @@ -193,7 +193,7 @@ private: nsresult CreateDiskDevice(); nsresult CreateOfflineDevice(); - nsresult CreateCustomOfflineDevice(nsILocalFile *aProfileDir, + nsresult CreateCustomOfflineDevice(nsIFile *aProfileDir, PRInt32 aQuota, nsOfflineCacheDevice **aDevice); nsresult CreateMemoryDevice(); diff --git a/netwerk/cache/nsCacheSession.cpp b/netwerk/cache/nsCacheSession.cpp index b5905cedfe7..8ae2f414e5a 100644 --- a/netwerk/cache/nsCacheSession.cpp +++ b/netwerk/cache/nsCacheSession.cpp @@ -41,7 +41,7 @@ NS_IMETHODIMP nsCacheSession::GetDoomEntriesIfExpired(bool *result) } -NS_IMETHODIMP nsCacheSession::SetProfileDirectory(nsILocalFile *profileDir) +NS_IMETHODIMP nsCacheSession::SetProfileDirectory(nsIFile *profileDir) { if (StoragePolicy() != nsICache::STORE_OFFLINE && profileDir) { // Profile directory override is currently implemented only for @@ -55,7 +55,7 @@ NS_IMETHODIMP nsCacheSession::SetProfileDirectory(nsILocalFile *profileDir) return NS_OK; } -NS_IMETHODIMP nsCacheSession::GetProfileDirectory(nsILocalFile **profileDir) +NS_IMETHODIMP nsCacheSession::GetProfileDirectory(nsIFile **profileDir) { if (mProfileDir) NS_ADDREF(*profileDir = mProfileDir); diff --git a/netwerk/cache/nsCacheSession.h b/netwerk/cache/nsCacheSession.h index 25ed4cedddb..447765f0b7f 100644 --- a/netwerk/cache/nsCacheSession.h +++ b/netwerk/cache/nsCacheSession.h @@ -11,7 +11,7 @@ #include "nsError.h" #include "nsCOMPtr.h" #include "nsICacheSession.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsString.h" class nsCacheSession : public nsICacheSession @@ -55,12 +55,12 @@ public: mInfo |= policy; } - nsILocalFile* ProfileDir() { return mProfileDir; } + nsIFile* ProfileDir() { return mProfileDir; } private: nsCString mClientID; PRUint32 mInfo; - nsCOMPtr mProfileDir; + nsCOMPtr mProfileDir; }; #endif // _nsCacheSession_h_ diff --git a/netwerk/cache/nsDiskCacheBlockFile.cpp b/netwerk/cache/nsDiskCacheBlockFile.cpp index c97e60c9d5a..c97cf04f95d 100644 --- a/netwerk/cache/nsDiskCacheBlockFile.cpp +++ b/netwerk/cache/nsDiskCacheBlockFile.cpp @@ -19,9 +19,9 @@ using namespace mozilla; * Open *****************************************************************************/ nsresult -nsDiskCacheBlockFile::Open(nsILocalFile * blockFile, - PRUint32 blockSize, - PRUint32 bitMapSize) +nsDiskCacheBlockFile::Open(nsIFile * blockFile, + PRUint32 blockSize, + PRUint32 bitMapSize) { if (bitMapSize % 32) return NS_ERROR_INVALID_ARG; diff --git a/netwerk/cache/nsDiskCacheBlockFile.h b/netwerk/cache/nsDiskCacheBlockFile.h index a8c47b404b0..94ee8190aa4 100644 --- a/netwerk/cache/nsDiskCacheBlockFile.h +++ b/netwerk/cache/nsDiskCacheBlockFile.h @@ -7,7 +7,7 @@ #ifndef _nsDiskCacheBlockFile_h_ #define _nsDiskCacheBlockFile_h_ -#include "nsILocalFile.h" +#include "nsIFile.h" /****************************************************************************** * nsDiskCacheBlockFile @@ -29,7 +29,7 @@ public: {} ~nsDiskCacheBlockFile() { (void) Close(true); } - nsresult Open( nsILocalFile * blockFile, PRUint32 blockSize, + nsresult Open( nsIFile * blockFile, PRUint32 blockSize, PRUint32 bitMapSize); nsresult Close(bool flush); diff --git a/netwerk/cache/nsDiskCacheDevice.cpp b/netwerk/cache/nsDiskCacheDevice.cpp index 19b2e07a5ee..2ac4734ac33 100644 --- a/netwerk/cache/nsDiskCacheDevice.cpp +++ b/netwerk/cache/nsDiskCacheDevice.cpp @@ -213,8 +213,8 @@ NS_IMETHODIMP nsDiskCacheDeviceInfo::GetUsageReport(char ** usageReport) buffer.AssignLiteral(" \n" " Cache Directory:\n" " "); - nsCOMPtr cacheDir; - nsAutoString path; + nsCOMPtr cacheDir; + nsAutoString path; mDevice->getCacheDirectory(getter_AddRefs(cacheDir)); nsresult rv = cacheDir->GetPath(path); if (NS_SUCCEEDED(rv)) { @@ -1068,7 +1068,7 @@ nsDiskCacheDevice::EvictDiskCacheEntries(PRUint32 targetCapacity) */ void -nsDiskCacheDevice::SetCacheParentDirectory(nsILocalFile * parentDir) +nsDiskCacheDevice::SetCacheParentDirectory(nsIFile * parentDir) { nsresult rv; bool exists; @@ -1102,7 +1102,7 @@ nsDiskCacheDevice::SetCacheParentDirectory(nsILocalFile * parentDir) void -nsDiskCacheDevice::getCacheDirectory(nsILocalFile ** result) +nsDiskCacheDevice::getCacheDirectory(nsIFile ** result) { *result = mCacheDirectory; NS_IF_ADDREF(*result); diff --git a/netwerk/cache/nsDiskCacheDevice.h b/netwerk/cache/nsDiskCacheDevice.h index 2020e7c441f..f702ca4b0da 100644 --- a/netwerk/cache/nsDiskCacheDevice.h +++ b/netwerk/cache/nsDiskCacheDevice.h @@ -12,7 +12,7 @@ #include "nsDiskCacheBlockFile.h" #include "nsDiskCacheEntry.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIObserver.h" #include "nsCOMArray.h" @@ -57,13 +57,13 @@ public: /** * Preference accessors */ - void SetCacheParentDirectory(nsILocalFile * parentDir); + void SetCacheParentDirectory(nsIFile * parentDir); void SetCapacity(PRUint32 capacity); void SetMaxEntrySize(PRInt32 maxSizeInKilobytes); /* private: */ - void getCacheDirectory(nsILocalFile ** result); + void getCacheDirectory(nsIFile ** result); PRUint32 getCacheCapacity(); PRUint32 getCacheSize(); PRUint32 getEntryCount(); @@ -99,7 +99,7 @@ private: /** * Member variables */ - nsCOMPtr mCacheDirectory; + nsCOMPtr mCacheDirectory; nsDiskCacheBindery mBindery; PRUint32 mCacheCapacity; // Unit is KiB's PRInt32 mMaxEntrySize; // Unit is bytes internally diff --git a/netwerk/cache/nsDiskCacheDeviceSQL.cpp b/netwerk/cache/nsDiskCacheDeviceSQL.cpp index 5e899a777f7..14eeff91671 100644 --- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp +++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp @@ -253,7 +253,7 @@ nsOfflineCacheDeviceInfo::GetUsageReport(char ** usageReport) buffer.AssignLiteral(" \n" " Cache Directory:\n" " "); - nsILocalFile *cacheDir = mDevice->CacheDirectory(); + nsIFile *cacheDir = mDevice->CacheDirectory(); if (!cacheDir) return NS_OK; @@ -630,7 +630,7 @@ nsApplicationCache::GetClientID(nsACString &out) } NS_IMETHODIMP -nsApplicationCache::GetCacheDirectory(nsILocalFile **out) +nsApplicationCache::GetCacheDirectory(nsIFile **out) { if (mDevice->BaseDirectory()) NS_ADDREF(*out = mDevice->BaseDirectory()); @@ -2350,7 +2350,7 @@ nsOfflineCacheDevice::GetGroupForCache(const nsACString &clientID, */ void -nsOfflineCacheDevice::SetCacheParentDirectory(nsILocalFile *parentDir) +nsOfflineCacheDevice::SetCacheParentDirectory(nsIFile *parentDir) { if (Initialized()) { diff --git a/netwerk/cache/nsDiskCacheDeviceSQL.h b/netwerk/cache/nsDiskCacheDeviceSQL.h index 85c392eb1e5..7d1ceab223e 100644 --- a/netwerk/cache/nsDiskCacheDeviceSQL.h +++ b/netwerk/cache/nsDiskCacheDeviceSQL.h @@ -9,7 +9,6 @@ #include "nsCacheDevice.h" #include "nsIApplicationCache.h" #include "nsIApplicationCacheService.h" -#include "nsILocalFile.h" #include "nsIObserver.h" #include "mozIStorageConnection.h" #include "mozIStorageFunction.h" @@ -165,11 +164,11 @@ public: * Preference accessors */ - void SetCacheParentDirectory(nsILocalFile * parentDir); + void SetCacheParentDirectory(nsIFile * parentDir); void SetCapacity(PRUint32 capacity); - nsILocalFile * BaseDirectory() { return mBaseDirectory; } - nsILocalFile * CacheDirectory() { return mCacheDirectory; } + nsIFile * BaseDirectory() { return mBaseDirectory; } + nsIFile * CacheDirectory() { return mCacheDirectory; } PRUint32 CacheCapacity() { return mCacheCapacity; } PRUint32 CacheSize(); PRUint32 EntryCount(); @@ -253,8 +252,8 @@ private: nsCOMPtr mStatement_EnumerateGroups; nsCOMPtr mStatement_EnumerateGroupsTimeOrder; - nsCOMPtr mBaseDirectory; - nsCOMPtr mCacheDirectory; + nsCOMPtr mBaseDirectory; + nsCOMPtr mCacheDirectory; PRUint32 mCacheCapacity; // in bytes PRInt32 mDeltaCounter; diff --git a/netwerk/cache/nsDiskCacheMap.cpp b/netwerk/cache/nsDiskCacheMap.cpp index 7c3ada98f40..7f6aa8cdf1f 100644 --- a/netwerk/cache/nsDiskCacheMap.cpp +++ b/netwerk/cache/nsDiskCacheMap.cpp @@ -27,24 +27,22 @@ */ nsresult -nsDiskCacheMap::Open(nsILocalFile * cacheDirectory) +nsDiskCacheMap::Open(nsIFile * cacheDirectory) { NS_ENSURE_ARG_POINTER(cacheDirectory); if (mMapFD) return NS_ERROR_ALREADY_INITIALIZED; mCacheDirectory = cacheDirectory; // save a reference for ourselves - // create nsILocalFile for _CACHE_MAP_ + // create nsIFile for _CACHE_MAP_ nsresult rv; nsCOMPtr file; rv = cacheDirectory->Clone(getter_AddRefs(file)); - nsCOMPtr localFile(do_QueryInterface(file, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - rv = localFile->AppendNative(NS_LITERAL_CSTRING("_CACHE_MAP_")); + rv = file->AppendNative(NS_LITERAL_CSTRING("_CACHE_MAP_")); NS_ENSURE_SUCCESS(rv, rv); // open the file - restricted to user, the data could be confidential - rv = localFile->OpenNSPRFileDesc(PR_RDWR | PR_CREATE_FILE, 00600, &mMapFD); + rv = file->OpenNSPRFileDesc(PR_RDWR | PR_CREATE_FILE, 00600, &mMapFD); NS_ENSURE_SUCCESS(rv, NS_ERROR_FILE_CORRUPTED); bool cacheFilesExist = CacheFilesExist(); @@ -589,8 +587,8 @@ nsDiskCacheMap::EvictRecords( nsDiskCacheRecordVisitor * visitor) nsresult nsDiskCacheMap::OpenBlockFiles() { - // create nsILocalFile for block file - nsCOMPtr blockFile; + // create nsIFile for block file + nsCOMPtr blockFile; nsresult rv = NS_OK; for (int i = 0; i < kNumBlockFiles; ++i) { @@ -625,7 +623,7 @@ nsDiskCacheMap::CloseBlockFiles(bool flush) bool nsDiskCacheMap::CacheFilesExist() { - nsCOMPtr blockFile; + nsCOMPtr blockFile; nsresult rv; for (int i = 0; i < kNumBlockFiles; ++i) { @@ -657,8 +655,7 @@ nsDiskCacheMap::CreateCacheSubDirectories() if (NS_FAILED(rv)) return rv; - nsCOMPtr localFile = do_QueryInterface(file, &rv); - rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0700); + rv = file->Create(nsIFile::DIRECTORY_TYPE, 0700); if (NS_FAILED(rv)) return rv; } @@ -681,7 +678,7 @@ nsDiskCacheMap::ReadDiskCacheEntry(nsDiskCacheRecord * record) if (metaFile == 0) { // entry/metadata stored in separate file // open and read the file - nsCOMPtr file; + nsCOMPtr file; rv = GetLocalFileForDiskCacheRecord(record, nsDiskCache::kMetaData, false, @@ -871,7 +868,7 @@ nsDiskCacheMap::WriteDiskCacheEntry(nsDiskCacheBinding * binding) rv = UpdateRecord(&binding->mRecord); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr localFile; + nsCOMPtr localFile; rv = GetLocalFileForDiskCacheRecord(&binding->mRecord, nsDiskCache::kMetaData, true, @@ -1029,8 +1026,7 @@ nsDiskCacheMap::GetFileForDiskCacheRecord(nsDiskCacheRecord * record, bool exists; if (createPath && (NS_FAILED(file->Exists(&exists)) || !exists)) { - nsCOMPtr localFile = do_QueryInterface(file, &rv); - rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0700); + rv = file->Create(nsIFile::DIRECTORY_TYPE, 0700); if (NS_FAILED(rv)) return rv; } @@ -1051,7 +1047,7 @@ nsresult nsDiskCacheMap::GetLocalFileForDiskCacheRecord(nsDiskCacheRecord * record, bool meta, bool createPath, - nsILocalFile ** result) + nsIFile ** result) { nsCOMPtr file; nsresult rv = GetFileForDiskCacheRecord(record, @@ -1060,16 +1056,13 @@ nsDiskCacheMap::GetLocalFileForDiskCacheRecord(nsDiskCacheRecord * record, getter_AddRefs(file)); if (NS_FAILED(rv)) return rv; - nsCOMPtr localFile = do_QueryInterface(file, &rv); - if (NS_FAILED(rv)) return rv; - - NS_IF_ADDREF(*result = localFile); + NS_IF_ADDREF(*result = file); return rv; } nsresult -nsDiskCacheMap::GetBlockFileForIndex(PRUint32 index, nsILocalFile ** result) +nsDiskCacheMap::GetBlockFileForIndex(PRUint32 index, nsIFile ** result) { if (!mCacheDirectory) return NS_ERROR_NOT_AVAILABLE; @@ -1082,8 +1075,7 @@ nsDiskCacheMap::GetBlockFileForIndex(PRUint32 index, nsILocalFile ** result) rv = file->AppendNative(nsDependentCString(name)); if (NS_FAILED(rv)) return rv; - nsCOMPtr localFile = do_QueryInterface(file, &rv); - NS_IF_ADDREF(*result = localFile); + NS_IF_ADDREF(*result = file); return rv; } diff --git a/netwerk/cache/nsDiskCacheMap.h b/netwerk/cache/nsDiskCacheMap.h index 7874ba993bc..455eb8b668c 100644 --- a/netwerk/cache/nsDiskCacheMap.h +++ b/netwerk/cache/nsDiskCacheMap.h @@ -13,7 +13,7 @@ #include "prnetdb.h" #include "nsDebug.h" #include "nsError.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsDiskCache.h" #include "nsDiskCacheBlockFile.h" @@ -396,7 +396,7 @@ public: * Creates a new cache map file if one doesn't exist. * Returns error if it detects change in format or cache wasn't closed. */ - nsresult Open( nsILocalFile * cacheDirectory); + nsresult Open( nsIFile * cacheDirectory); nsresult Close(bool flush); nsresult Trim(); @@ -428,7 +428,7 @@ public: nsresult GetLocalFileForDiskCacheRecord( nsDiskCacheRecord * record, bool meta, bool createPath, - nsILocalFile ** result); + nsIFile ** result); // On success, this returns the buffer owned by nsDiskCacheMap, // so it must not be deleted by the caller. @@ -486,7 +486,7 @@ private: PRUint32 CalculateFileIndex(PRUint32 size); - nsresult GetBlockFileForIndex( PRUint32 index, nsILocalFile ** result); + nsresult GetBlockFileForIndex( PRUint32 index, nsIFile ** result); PRUint32 GetBlockSizeForIndex( PRUint32 index) const { return BLOCK_SIZE_FOR_INDEX(index); } @@ -529,7 +529,7 @@ private: * data members */ private: - nsCOMPtr mCacheDirectory; + nsCOMPtr mCacheDirectory; PRFileDesc * mMapFD; nsDiskCacheRecord * mRecordArray; nsDiskCacheBlockFile mBlockFile[kNumBlockFiles]; diff --git a/netwerk/cache/nsDiskCacheStreams.h b/netwerk/cache/nsDiskCacheStreams.h index 10ded5acee5..8b2bac14727 100644 --- a/netwerk/cache/nsDiskCacheStreams.h +++ b/netwerk/cache/nsDiskCacheStreams.h @@ -70,7 +70,7 @@ private: nsDiskCacheDevice * mDevice; nsDiskCacheOutputStream * mOutStream; // not an owning reference PRInt32 mInStreamCount; - nsCOMPtr mLocalFile; + nsCOMPtr mLocalFile; PRFileDesc * mFD; PRUint32 mStreamPos; // for Output Streams diff --git a/netwerk/cache/nsICacheSession.idl b/netwerk/cache/nsICacheSession.idl index f97994e6fb9..08bc43018df 100644 --- a/netwerk/cache/nsICacheSession.idl +++ b/netwerk/cache/nsICacheSession.idl @@ -9,7 +9,7 @@ interface nsICacheEntryDescriptor; interface nsICacheListener; -interface nsILocalFile; +interface nsIFile; [scriptable, uuid(1dd7708c-de48-4ffe-b5aa-cd218c762887)] interface nsICacheSession : nsISupports @@ -28,7 +28,7 @@ interface nsICacheSession : nsISupports * profile than the active profile of the the current running application * process. */ - attribute nsILocalFile profileDirectory; + attribute nsIFile profileDirectory; /** * A cache session can only give out one descriptor with WRITE access diff --git a/netwerk/protocol/about/nsAboutBloat.cpp b/netwerk/protocol/about/nsAboutBloat.cpp index ec3a7e824be..3bc1de85dc2 100644 --- a/netwerk/protocol/about/nsAboutBloat.cpp +++ b/netwerk/protocol/about/nsAboutBloat.cpp @@ -19,7 +19,7 @@ #include "nsIFileStreams.h" #include "nsNetUtil.h" #include "nsDirectoryServiceDefs.h" -#include "nsILocalFile.h" +#include "nsIFile.h" static void GC_gcollect() {} @@ -101,10 +101,7 @@ nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result) if (NS_FAILED(rv)) return rv; FILE* out; - nsCOMPtr lfile = do_QueryInterface(file); - if (lfile == nsnull) - return NS_ERROR_FAILURE; - rv = lfile->OpenANSIFileDesc("w", &out); + rv = file->OpenANSIFileDesc("w", &out); if (NS_FAILED(rv)) return rv; rv = nsTraceRefcntImpl::DumpStatistics(statType, out); diff --git a/netwerk/protocol/file/nsFileChannel.cpp b/netwerk/protocol/file/nsFileChannel.cpp index 1d17e42a7c1..568edb11c00 100644 --- a/netwerk/protocol/file/nsFileChannel.cpp +++ b/netwerk/protocol/file/nsFileChannel.cpp @@ -248,7 +248,7 @@ nsFileChannel::nsFileChannel(nsIURI *uri) nsCOMPtr file; nsCOMPtr targetURI; nsCAutoString fileTarget; - nsCOMPtr resolvedFile; + nsCOMPtr resolvedFile; bool symLink; nsCOMPtr fileURL = do_QueryInterface(uri); if (fileURL && diff --git a/netwerk/protocol/file/nsFileProtocolHandler.cpp b/netwerk/protocol/file/nsFileProtocolHandler.cpp index 9a1b8103640..f4d6874a04f 100644 --- a/netwerk/protocol/file/nsFileProtocolHandler.cpp +++ b/netwerk/protocol/file/nsFileProtocolHandler.cpp @@ -160,12 +160,8 @@ nsFileProtocolHandler::ReadURLFile(nsIFile* aFile, nsIURI** aURI) !StringEndsWith(leafName, NS_LITERAL_CSTRING(".desktop"))) return NS_ERROR_NOT_AVAILABLE; - nsCOMPtr file(do_QueryInterface(aFile, &rv)); - if (NS_FAILED(rv)) - return rv; - nsINIParser parser; - rv = parser.Init(file); + rv = parser.Init(aFile); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 64989ae7b6f..4227fb71d1e 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -5368,7 +5368,7 @@ nsHttpChannel::SetOfflineCacheClientID(const nsACString &value) } NS_IMETHODIMP -nsHttpChannel::GetProfileDirectory(nsILocalFile **_result) +nsHttpChannel::GetProfileDirectory(nsIFile **_result) { NS_ENSURE_ARG(_result); @@ -5377,7 +5377,7 @@ nsHttpChannel::GetProfileDirectory(nsILocalFile **_result) } NS_IMETHODIMP -nsHttpChannel::SetProfileDirectory(nsILocalFile *value) +nsHttpChannel::SetProfileDirectory(nsIFile *value) { mProfileDirectory = value; return NS_OK; diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index e79279650f6..5eb917c90df 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -27,7 +27,7 @@ #include "nsIHttpChannelAuthProvider.h" #include "nsIAsyncVerifyRedirectCallback.h" #include "nsITimedChannel.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsDNSPrefetch.h" #include "TimingStruct.h" #include "AutoClose.h" @@ -305,7 +305,7 @@ private: nsCacheAccessMode mOfflineCacheAccess; nsCString mOfflineCacheClientID; - nsCOMPtr mProfileDirectory; + nsCOMPtr mProfileDirectory; // auth specific data nsCOMPtr mAuthProvider; diff --git a/netwerk/protocol/res/nsResProtocolHandler.cpp b/netwerk/protocol/res/nsResProtocolHandler.cpp index 6594dfdc44b..b3f4a5263bb 100644 --- a/netwerk/protocol/res/nsResProtocolHandler.cpp +++ b/netwerk/protocol/res/nsResProtocolHandler.cpp @@ -9,7 +9,6 @@ #include "nsIURL.h" #include "nsIIOService.h" #include "nsIServiceManager.h" -#include "nsILocalFile.h" #include "prenv.h" #include "prmem.h" #include "prprf.h" diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp index 0a942509b6c..a1204145643 100644 --- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp +++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp @@ -205,9 +205,7 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext, nsCOMPtr file; rv = fileUrl->GetFile(getter_AddRefs(file)); if (NS_FAILED(rv)) return rv; - nsCOMPtr lfile = do_QueryInterface(file, &rv); - if (NS_FAILED(rv)) return rv; - lfile->SetFollowLinks(true); + file->SetFollowLinks(true); nsCAutoString url; rv = net_GetURLSpecFromFile(file, url); diff --git a/netwerk/test/TestBlockingSocket.cpp b/netwerk/test/TestBlockingSocket.cpp index 63c0806f4b0..aa65b8780ea 100644 --- a/netwerk/test/TestBlockingSocket.cpp +++ b/netwerk/test/TestBlockingSocket.cpp @@ -10,7 +10,7 @@ #include "nsIComponentManager.h" #include "nsCOMPtr.h" #include "nsStringAPI.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "prlog.h" #include "prenv.h" @@ -108,7 +108,7 @@ main(int argc, char* argv[]) gTestLog = PR_NewLogModule("Test"); #endif - nsCOMPtr file; + nsCOMPtr file; rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(file)); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/test/TestCacheBlockFiles.cpp b/netwerk/test/TestCacheBlockFiles.cpp index 4e6d7399539..afc14db53bf 100644 --- a/netwerk/test/TestCacheBlockFiles.cpp +++ b/netwerk/test/TestCacheBlockFiles.cpp @@ -20,7 +20,6 @@ #include "nsIComponentManager.h" #include "nsIComponentRegistrar.h" #include "nsIFile.h" -#include "nsILocalFile.h" #include "nsIFileStreams.h" #include "nsMemory.h" #include "nsIComponentRegistrar.h" @@ -39,7 +38,7 @@ typedef struct Allocation { } Allocation; nsresult -StressTest(nsILocalFile * localFile, PRInt32 testNumber, bool readWrite) +StressTest(nsIFile * localFile, PRInt32 testNumber, bool readWrite) { nsresult rv = NS_OK; @@ -191,7 +190,7 @@ main(void) srand(now); nsCOMPtr file; - nsCOMPtr localFile; + nsCOMPtr localFile; nsresult rv = NS_OK; { // Start up XPCOM @@ -227,7 +226,7 @@ main(void) rv = file->Delete(false); if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND) goto exit; - // Need nsILocalFile to open + // Need nsIFile to open localFile = do_QueryInterface(file, &rv); if (NS_FAILED(rv)) { printf("do_QueryInterface(file) failed : 0x%.8x\n", rv); diff --git a/netwerk/test/TestFileInput2.cpp b/netwerk/test/TestFileInput2.cpp index cd379ef54ca..7e16312a90b 100644 --- a/netwerk/test/TestFileInput2.cpp +++ b/netwerk/test/TestFileInput2.cpp @@ -14,7 +14,7 @@ #include "prinrval.h" #include "nsIFileStreams.h" #include "nsIFileChannel.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include @@ -424,11 +424,11 @@ main(int argc, char* argv[]) if (registrar) registrar->AutoRegister(nsnull); - nsCOMPtr inDirFile; + nsCOMPtr inDirFile; rv = NS_NewNativeLocalFile(nsDependentCString(inDir), false, getter_AddRefs(inDirFile)); if (NS_FAILED(rv)) return rv; - nsCOMPtr outDirFile; + nsCOMPtr outDirFile; rv = NS_NewNativeLocalFile(nsDependentCString(outDir), false, getter_AddRefs(outDirFile)); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/test/TestIncrementalDownload.cpp b/netwerk/test/TestIncrementalDownload.cpp index b52af7467cd..94017e6a03f 100644 --- a/netwerk/test/TestIncrementalDownload.cpp +++ b/netwerk/test/TestIncrementalDownload.cpp @@ -68,7 +68,7 @@ static nsresult DoIncrementalFetch(const char *uriSpec, const char *resultPath, PRInt32 chunkSize, PRInt32 interval) { - nsCOMPtr resultFile; + nsCOMPtr resultFile; nsresult rv = NS_NewNativeLocalFile(nsDependentCString(resultPath), false, getter_AddRefs(resultFile)); if (NS_FAILED(rv)) diff --git a/netwerk/test/TestSocketTransport.cpp b/netwerk/test/TestSocketTransport.cpp index a4093cf45df..f30aedb6b68 100644 --- a/netwerk/test/TestSocketTransport.cpp +++ b/netwerk/test/TestSocketTransport.cpp @@ -20,7 +20,7 @@ #include "nsIDNSService.h" #include "nsIFileStreams.h" #include "nsIStreamListener.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "nsAutoLock.h" #include "prlog.h" diff --git a/netwerk/test/TestStreamChannel.cpp b/netwerk/test/TestStreamChannel.cpp index a0afd7caee4..49ffb03df35 100644 --- a/netwerk/test/TestStreamChannel.cpp +++ b/netwerk/test/TestStreamChannel.cpp @@ -17,7 +17,7 @@ #include "nsStringAPI.h" #include "nsIFileStreams.h" #include "nsIStreamListener.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "nsAutoLock.h" #include "prlog.h" @@ -187,7 +187,7 @@ main(int argc, char* argv[]) gTestLog = PR_NewLogModule("Test"); #endif - nsCOMPtr file; + nsCOMPtr file; rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(file)); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/test/TestStreamPump.cpp b/netwerk/test/TestStreamPump.cpp index 2962a0e3eb5..5469e4876d7 100644 --- a/netwerk/test/TestStreamPump.cpp +++ b/netwerk/test/TestStreamPump.cpp @@ -18,7 +18,7 @@ #include "nsStringAPI.h" #include "nsIFileStreams.h" #include "nsIStreamListener.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "nsAutoLock.h" #include "prlog.h" @@ -158,7 +158,7 @@ main(int argc, char* argv[]) gTestLog = PR_NewLogModule("Test"); #endif - nsCOMPtr file; + nsCOMPtr file; rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(file)); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/test/TestStreamTransport.cpp b/netwerk/test/TestStreamTransport.cpp index 24c504acaaf..c31deb1f905 100644 --- a/netwerk/test/TestStreamTransport.cpp +++ b/netwerk/test/TestStreamTransport.cpp @@ -17,7 +17,7 @@ #include "nsStringAPI.h" #include "nsIFileStreams.h" #include "nsIStreamListener.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "nsAutoLock.h" #include "prlog.h" @@ -284,7 +284,7 @@ main(int argc, char* argv[]) gTestLog = PR_NewLogModule("Test"); #endif - nsCOMPtr srcFile; + nsCOMPtr srcFile; rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(srcFile)); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/test/httpserver/nsIHttpServer.idl b/netwerk/test/httpserver/nsIHttpServer.idl index a9a77909e8a..6a321f35a76 100644 --- a/netwerk/test/httpserver/nsIHttpServer.idl +++ b/netwerk/test/httpserver/nsIHttpServer.idl @@ -5,7 +5,7 @@ #include "nsISupports.idl" interface nsIInputStream; -interface nsILocalFile; +interface nsIFile; interface nsIOutputStream; interface nsISimpleEnumerator; @@ -66,7 +66,7 @@ interface nsIHttpServer : nsISupports * the file to serve for the given path, or null to remove any mapping that * might exist; this file must exist for the lifetime of the server */ - void registerFile(in string path, in nsILocalFile file); + void registerFile(in string path, in nsIFile file); /** * Registers a custom path handler. @@ -140,7 +140,7 @@ interface nsIHttpServer : nsISupports * if dir is non-null and does not exist or is not a directory, or if path * does not begin with and end with a forward slash */ - void registerDirectory(in string path, in nsILocalFile dir); + void registerDirectory(in string path, in nsIFile dir); /** * Associates files with the given extension with the given Content-Type when diff --git a/parser/htmlparser/src/nsScanner.cpp b/parser/htmlparser/src/nsScanner.cpp index af2441eed5c..f8e31543083 100644 --- a/parser/htmlparser/src/nsScanner.cpp +++ b/parser/htmlparser/src/nsScanner.cpp @@ -13,7 +13,7 @@ #include "nsCharsetAlias.h" #include "nsReadableUtils.h" #include "nsIInputStream.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "nsUTF8Utils.h" // for LossyConvertEncoding #include "nsCRT.h" diff --git a/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h b/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h index f662b524443..3e16ff705a2 100644 --- a/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h +++ b/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h @@ -5,7 +5,7 @@ // Interfaces Needed #include "nsIDirectoryService.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsCOMPtr.h" #include "nsDirectoryServiceUtils.h" diff --git a/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp b/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp index 9829cb04e35..1ae2c54317f 100644 --- a/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp +++ b/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp @@ -6,7 +6,7 @@ #include "nsProfileDirServiceProvider.h" #include "nsProfileStringTypes.h" #include "nsProfileLock.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h" #include "nsISupportsUtils.h" @@ -81,11 +81,11 @@ nsProfileDirServiceProvider::SetProfileDir(nsIFile* aProfileDir, #ifdef MOZ_PROFILELOCKING // Lock the non-shared sub-dir if we are sharing, // the whole profile dir if we are not. - nsCOMPtr dirToLock; + nsCOMPtr dirToLock; if (mSharingEnabled) - dirToLock = do_QueryInterface(mNonSharedProfileDir); + dirToLock = mNonSharedProfileDir; else - dirToLock = do_QueryInterface(mProfileDir); + dirToLock = mProfileDir; rv = mProfileDirLock->Lock(dirToLock, nsnull); if (NS_FAILED(rv)) return rv; diff --git a/profile/dirserviceprovider/src/nsProfileLock.cpp b/profile/dirserviceprovider/src/nsProfileLock.cpp index a6bb426d26d..6a58476d4fc 100644 --- a/profile/dirserviceprovider/src/nsProfileLock.cpp +++ b/profile/dirserviceprovider/src/nsProfileLock.cpp @@ -195,7 +195,7 @@ void nsProfileLock::FatalSignalHandler(int signo _exit(signo); } -nsresult nsProfileLock::LockWithFcntl(nsILocalFile *aLockFile) +nsresult nsProfileLock::LockWithFcntl(nsIFile *aLockFile) { nsresult rv = NS_OK; @@ -305,7 +305,7 @@ static bool IsSymlinkStaleLock(struct in_addr* aAddr, const char* aFileName, return true; } -nsresult nsProfileLock::LockWithSymlink(nsILocalFile *aLockFile, bool aHaveFcntlLock) +nsresult nsProfileLock::LockWithSymlink(nsIFile *aLockFile, bool aHaveFcntlLock) { nsresult rv; nsCAutoString lockFilePath; @@ -431,7 +431,7 @@ nsresult nsProfileLock::GetReplacedLockTime(PRInt64 *aResult) { return NS_OK; } -nsresult nsProfileLock::Lock(nsILocalFile* aProfileDir, +nsresult nsProfileLock::Lock(nsIFile* aProfileDir, nsIProfileUnlocker* *aUnlocker) { #if defined (XP_MACOSX) @@ -457,8 +457,8 @@ nsresult nsProfileLock::Lock(nsILocalFile* aProfileDir, if (!isDir) return NS_ERROR_FILE_NOT_DIRECTORY; - nsCOMPtr lockFile; - rv = aProfileDir->Clone((nsIFile **)((void **)getter_AddRefs(lockFile))); + nsCOMPtr lockFile; + rv = aProfileDir->Clone(getter_AddRefs(lockFile)); if (NS_FAILED(rv)) return rv; @@ -528,8 +528,8 @@ nsresult nsProfileLock::Lock(nsILocalFile* aProfileDir, } #elif defined(XP_UNIX) // Get the old lockfile name - nsCOMPtr oldLockFile; - rv = aProfileDir->Clone((nsIFile **)((void **)getter_AddRefs(oldLockFile))); + nsCOMPtr oldLockFile; + rv = aProfileDir->Clone(getter_AddRefs(oldLockFile)); if (NS_FAILED(rv)) return rv; rv = oldLockFile->Append(OLD_LOCKFILE_NAME); diff --git a/profile/dirserviceprovider/src/nsProfileLock.h b/profile/dirserviceprovider/src/nsProfileLock.h index a6a228087cb..750e5c301b3 100644 --- a/profile/dirserviceprovider/src/nsProfileLock.h +++ b/profile/dirserviceprovider/src/nsProfileLock.h @@ -6,7 +6,7 @@ #ifndef __nsProfileLock_h___ #define __nsProfileLock_h___ -#include "nsILocalFile.h" +#include "nsIFile.h" class nsIProfileUnlocker; @@ -47,7 +47,7 @@ public: * be returned at all. * @throws NS_ERROR_FILE_ACCESS_DENIED if the profile is locked. */ - nsresult Lock(nsILocalFile* aProfileDir, nsIProfileUnlocker* *aUnlocker); + nsresult Lock(nsIFile* aProfileDir, nsIProfileUnlocker* *aUnlocker); /** * Unlock a profile directory. If you're unlocking the directory because @@ -86,13 +86,13 @@ private: ); static PRCList mPidLockList; - nsresult LockWithFcntl(nsILocalFile *aLockFile); + nsresult LockWithFcntl(nsIFile *aLockFile); /** * @param aHaveFcntlLock if true, we've already acquired an fcntl lock so this * lock is merely an "obsolete" lock to keep out old Firefoxes */ - nsresult LockWithSymlink(nsILocalFile *aLockFile, bool aHaveFcntlLock); + nsresult LockWithSymlink(nsIFile *aLockFile, bool aHaveFcntlLock); char* mPidLockFileName; int mLockFileDesc; diff --git a/rdf/datasource/src/nsFileSystemDataSource.cpp b/rdf/datasource/src/nsFileSystemDataSource.cpp index b922559584b..df0aef09705 100644 --- a/rdf/datasource/src/nsFileSystemDataSource.cpp +++ b/rdf/datasource/src/nsFileSystemDataSource.cpp @@ -982,9 +982,7 @@ FileSystemDataSource::GetFolderList(nsIRDFResource *source, bool allowHidden, return(rv); // ensure that we DO NOT resolve aliases - nsCOMPtr aDirLocal = do_QueryInterface(aDir); - if (aDirLocal) - aDirLocal->SetFollowLinks(false); + aDir->SetFollowLinks(false); nsCOMPtr dirContents; if (NS_FAILED(rv = aDir->GetDirectoryEntries(getter_AddRefs(dirContents)))) @@ -1094,9 +1092,7 @@ FileSystemDataSource::GetLastMod(nsIRDFResource *source, nsIRDFDate **aResult) return(NS_ERROR_UNEXPECTED); // ensure that we DO NOT resolve aliases - nsCOMPtr aFileLocal = do_QueryInterface(aFile); - if (aFileLocal) - aFileLocal->SetFollowLinks(false); + aFile->SetFollowLinks(false); PRInt64 lastModDate; if (NS_FAILED(rv = aFile->GetLastModifiedTime(&lastModDate))) @@ -1143,9 +1139,7 @@ FileSystemDataSource::GetFileSize(nsIRDFResource *source, nsIRDFInt **aResult) return(NS_ERROR_UNEXPECTED); // ensure that we DO NOT resolve aliases - nsCOMPtr aFileLocal = do_QueryInterface(aFile); - if (aFileLocal) - aFileLocal->SetFollowLinks(false); + aFile->SetFollowLinks(false); // don't do anything with directories bool isDir = false; @@ -1196,9 +1190,7 @@ FileSystemDataSource::GetName(nsIRDFResource *source, nsIRDFLiteral **aResult) return(NS_ERROR_UNEXPECTED); // ensure that we DO NOT resolve aliases - nsCOMPtr aFileLocal = do_QueryInterface(aFile); - if (aFileLocal) - aFileLocal->SetFollowLinks(false); + aFile->SetFollowLinks(false); nsAutoString name; if (NS_FAILED(rv = aFile->GetLeafName(name))) diff --git a/security/manager/ssl/public/nsIX509CertDB.idl b/security/manager/ssl/public/nsIX509CertDB.idl index e866563b380..680a1d75086 100644 --- a/security/manager/ssl/public/nsIX509CertDB.idl +++ b/security/manager/ssl/public/nsIX509CertDB.idl @@ -8,7 +8,7 @@ interface nsIArray; interface nsIX509Cert; -interface nsILocalFile; +interface nsIFile; interface nsIInterfaceRequestor; %{C++ @@ -209,7 +209,7 @@ interface nsIX509CertDB : nsISupports { * be imported. See type constants in nsIX509Cert. */ void importCertsFromFile(in nsISupports aToken, - in nsILocalFile aFile, + in nsIFile aFile, in unsigned long aType); /** @@ -222,7 +222,7 @@ interface nsIX509CertDB : nsISupports { * to be imported. */ void importPKCS12File(in nsISupports aToken, - in nsILocalFile aFile); + in nsIFile aFile); /** * Export a set of certs and keys from the database to a PKCS#12 file. @@ -236,7 +236,7 @@ interface nsIX509CertDB : nsISupports { * @param aCerts The array of all certificates to be exported. */ void exportPKCS12File(in nsISupports aToken, - in nsILocalFile aFile, + in nsIFile aFile, in unsigned long count, [array, size_is(count)] in nsIX509Cert aCerts); diff --git a/security/manager/ssl/src/nsCrypto.cpp b/security/manager/ssl/src/nsCrypto.cpp index 8a29ebd5e07..3385f7504c7 100644 --- a/security/manager/ssl/src/nsCrypto.cpp +++ b/security/manager/ssl/src/nsCrypto.cpp @@ -2159,7 +2159,7 @@ nsP12Runnable::Run() return NS_OK; //User canceled. It'd be nice if they couldn't, //but oh well. - nsCOMPtr localFile; + nsCOMPtr localFile; rv = filePicker->GetFile(getter_AddRefs(localFile)); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; diff --git a/security/manager/ssl/src/nsNSSCertificateDB.cpp b/security/manager/ssl/src/nsNSSCertificateDB.cpp index fd595e47ddf..6d122d412b7 100644 --- a/security/manager/ssl/src/nsNSSCertificateDB.cpp +++ b/security/manager/ssl/src/nsNSSCertificateDB.cpp @@ -12,7 +12,7 @@ #include "nsCRT.h" #include "nsICertificateDialogs.h" #include "nsNSSCertTrust.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsPKCS12Blob.h" #include "nsPK11TokenDB.h" #include "nsOCSPResponder.h" @@ -1103,7 +1103,7 @@ nsNSSCertificateDB::IsCertTrusted(nsIX509Cert *cert, NS_IMETHODIMP nsNSSCertificateDB::ImportCertsFromFile(nsISupports *aToken, - nsILocalFile *aFile, + nsIFile *aFile, PRUint32 aType) { NS_ENSURE_ARG(aFile); @@ -1170,7 +1170,7 @@ nsNSSCertificateDB::ImportCertsFromFile(nsISupports *aToken, NS_IMETHODIMP nsNSSCertificateDB::ImportPKCS12File(nsISupports *aToken, - nsILocalFile *aFile) + nsIFile *aFile) { NS_ENSURE_ARG(aFile); nsPKCS12Blob blob; @@ -1183,7 +1183,7 @@ nsNSSCertificateDB::ImportPKCS12File(nsISupports *aToken, NS_IMETHODIMP nsNSSCertificateDB::ExportPKCS12File(nsISupports *aToken, - nsILocalFile *aFile, + nsIFile *aFile, PRUint32 count, nsIX509Cert **certs) //const PRUnichar **aCertNames) diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp index bc49de9b944..8413e65409a 100644 --- a/security/manager/ssl/src/nsNSSComponent.cpp +++ b/security/manager/ssl/src/nsNSSComponent.cpp @@ -50,7 +50,7 @@ #include "nsIEntropyCollector.h" #include "nsIBufEntropyCollector.h" #include "nsIServiceManager.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsITokenPasswordDialogs.h" #include "nsICRLManager.h" #include "nsNSSShutDown.h" @@ -801,7 +801,7 @@ nsNSSComponent::InstallLoadableRoots() }; for (size_t il = 0; il < sizeof(possible_ckbi_locations)/sizeof(const char*); ++il) { - nsCOMPtr mozFile; + nsCOMPtr mozFile; char *fullLibraryPath = nsnull; if (!possible_ckbi_locations[il]) @@ -818,7 +818,7 @@ nsNSSComponent::InstallLoadableRoots() continue; } // Get the directory containing the nss3 library. - nsCOMPtr nssLib(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); + nsCOMPtr nssLib(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); if (NS_SUCCEEDED(rv)) { rv = nssLib->InitWithNativePath(nsDependentCString(nss_path)); } @@ -831,7 +831,7 @@ nsNSSComponent::InstallLoadableRoots() } } else { directoryService->Get( possible_ckbi_locations[il], - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(mozFile)); } diff --git a/security/manager/ssl/src/nsPKCS12Blob.cpp b/security/manager/ssl/src/nsPKCS12Blob.cpp index 919c09fb091..c90d818d663 100644 --- a/security/manager/ssl/src/nsPKCS12Blob.cpp +++ b/security/manager/ssl/src/nsPKCS12Blob.cpp @@ -9,7 +9,6 @@ #include "nsISupportsArray.h" #include "nsIFile.h" #include "nsNetUtil.h" -#include "nsILocalFile.h" #include "nsIDirectoryService.h" #include "nsThreadUtils.h" @@ -96,7 +95,7 @@ nsPKCS12Blob::SetToken(nsIPK11Token *token) // Given a file handle, read a PKCS#12 blob from that file, decode it, // and import the results into the token. nsresult -nsPKCS12Blob::ImportFromFile(nsILocalFile *file) +nsPKCS12Blob::ImportFromFile(nsIFile *file) { nsNSSShutDownPreventionLock locker; nsresult rv = NS_OK; @@ -136,7 +135,7 @@ nsPKCS12Blob::ImportFromFile(nsILocalFile *file) } nsresult -nsPKCS12Blob::ImportFromFileHelper(nsILocalFile *file, +nsPKCS12Blob::ImportFromFileHelper(nsIFile *file, nsPKCS12Blob::ImportMode aImportMode, nsPKCS12Blob::RetryReason &aWantRetry) { @@ -309,7 +308,7 @@ isExtractable(SECKEYPrivateKey *privKey) // open output file as nsIFileStream object? // set appropriate error codes nsresult -nsPKCS12Blob::ExportToFile(nsILocalFile *file, +nsPKCS12Blob::ExportToFile(nsIFile *file, nsIX509Cert **certs, int numCerts) { nsNSSShutDownPreventionLock locker; @@ -320,7 +319,7 @@ nsPKCS12Blob::ExportToFile(nsILocalFile *file, SECItem unicodePw; nsAutoString filePath; int i; - nsCOMPtr localFileRef; + nsCOMPtr localFileRef; NS_ASSERTION(mToken, "Need to set the token before exporting"); // init slot @@ -423,11 +422,11 @@ nsPKCS12Blob::ExportToFile(nsILocalFile *file, this->mTmpFile = NULL; file->GetPath(filePath); // Use the nsCOMPtr var localFileRef so that - // the reference to the nsILocalFile we create gets released as soon as + // the reference to the nsIFile we create gets released as soon as // we're out of scope, ie when this function exits. if (filePath.RFind(".p12", true, -1, 4) < 0) { // We're going to add the .p12 extension to the file name just like - // Communicator used to. We create a new nsILocalFile and initialize + // Communicator used to. We create a new nsIFile and initialize // it with the new patch. filePath.AppendLiteral(".p12"); localFileRef = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv); @@ -546,7 +545,7 @@ nsPKCS12Blob::getPKCS12FilePassword(SECItem *unicodePw) // // Given a decoder, read bytes from file and input them to the decoder. nsresult -nsPKCS12Blob::inputToDecoder(SEC_PKCS12DecoderContext *dcx, nsILocalFile *file) +nsPKCS12Blob::inputToDecoder(SEC_PKCS12DecoderContext *dcx, nsIFile *file) { nsNSSShutDownPreventionLock locker; nsresult rv; diff --git a/security/manager/ssl/src/nsPKCS12Blob.h b/security/manager/ssl/src/nsPKCS12Blob.h index 89dd9e9bd8f..17ebb335120 100644 --- a/security/manager/ssl/src/nsPKCS12Blob.h +++ b/security/manager/ssl/src/nsPKCS12Blob.h @@ -7,7 +7,7 @@ #define _NS_PKCS12BLOB_H_ #include "nsCOMPtr.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIPK11TokenDB.h" #include "nsNSSHelper.h" #include "nsIPK11Token.h" @@ -37,14 +37,14 @@ public: nsresult SetToken(nsIPK11Token *token); // PKCS#12 Import - nsresult ImportFromFile(nsILocalFile *file); + nsresult ImportFromFile(nsIFile *file); // PKCS#12 Export #if 0 //nsresult LoadCerts(const PRUnichar **certNames, int numCerts); nsresult LoadCerts(nsIX509Cert **certs, int numCerts); #endif - nsresult ExportToFile(nsILocalFile *file, nsIX509Cert **certs, int numCerts); + nsresult ExportToFile(nsIFile *file, nsIX509Cert **certs, int numCerts); private: @@ -55,7 +55,7 @@ private: // local helper functions nsresult getPKCS12FilePassword(SECItem *); nsresult newPKCS12FilePassword(SECItem *); - nsresult inputToDecoder(SEC_PKCS12DecoderContext *, nsILocalFile *); + nsresult inputToDecoder(SEC_PKCS12DecoderContext *, nsIFile *); void unicodeToItem(const PRUnichar *, SECItem *); void handleError(int myerr = 0); @@ -74,7 +74,7 @@ private: enum RetryReason { rr_do_not_retry, rr_bad_password, rr_auto_retry_empty_password_flavors }; enum ImportMode { im_standard_prompt, im_try_zero_length_secitem }; - nsresult ImportFromFileHelper(nsILocalFile *file, ImportMode aImportMode, RetryReason &aWantRetry); + nsresult ImportFromFileHelper(nsIFile *file, ImportMode aImportMode, RetryReason &aWantRetry); // NSPR file I/O for export file PRFileDesc *mTmpFile; diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp index 49fcea11051..acc6de5fa36 100644 --- a/startupcache/StartupCache.cpp +++ b/startupcache/StartupCache.cpp @@ -15,7 +15,6 @@ #include "nsDirectoryServiceUtils.h" #include "nsIClassInfo.h" #include "nsIFile.h" -#include "nsILocalFile.h" #include "nsIMemoryReporter.h" #include "nsIObserver.h" #include "nsIObserverService.h" diff --git a/startupcache/StartupCache.h b/startupcache/StartupCache.h index dca354c4da0..db0fcc1f28a 100644 --- a/startupcache/StartupCache.h +++ b/startupcache/StartupCache.h @@ -156,7 +156,7 @@ private: nsClassHashtable mTable; nsRefPtr mArchive; - nsCOMPtr mFile; + nsCOMPtr mFile; nsCOMPtr mObserverService; nsRefPtr mListener; diff --git a/storage/src/FileSystemModule.cpp b/storage/src/FileSystemModule.cpp index e8f03648a38..71d8e5e2c05 100644 --- a/storage/src/FileSystemModule.cpp +++ b/storage/src/FileSystemModule.cpp @@ -10,7 +10,6 @@ #include "nsString.h" #include "nsISimpleEnumerator.h" #include "nsIFile.h" -#include "nsILocalFile.h" namespace { @@ -63,7 +62,7 @@ private: nsresult VirtualTableCursor::Init(const nsAString& aPath) { - nsCOMPtr directory = + nsCOMPtr directory = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID); NS_ENSURE_TRUE(directory, NS_ERROR_FAILURE); diff --git a/storage/src/mozStorageConnection.cpp b/storage/src/mozStorageConnection.cpp index df0901f1787..831ef922d68 100644 --- a/storage/src/mozStorageConnection.cpp +++ b/storage/src/mozStorageConnection.cpp @@ -11,7 +11,7 @@ #include "nsAutoPtr.h" #include "nsIMemoryReporter.h" #include "nsThreadUtils.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "mozilla/Telemetry.h" #include "mozilla/Mutex.h" #include "mozilla/CondVar.h" @@ -1494,10 +1494,8 @@ Connection::SetGrowthIncrement(PRInt32 aChunkSize, const nsACString &aDatabaseNa // on log structured file systems used by Android devices #if !defined(ANDROID) && !defined(MOZ_PLATFORM_MAEMO) // Don't preallocate if less than 500MiB is available. - nsCOMPtr localFile = do_QueryInterface(mDatabaseFile); - NS_ENSURE_STATE(localFile); PRInt64 bytesAvailable; - nsresult rv = localFile->GetDiskSpaceAvailable(&bytesAvailable); + nsresult rv = mDatabaseFile->GetDiskSpaceAvailable(&bytesAvailable); NS_ENSURE_SUCCESS(rv, rv); if (bytesAvailable < MIN_AVAILABLE_BYTES_PER_CHUNKED_GROWTH) { return NS_ERROR_FILE_TOO_BIG; diff --git a/storage/test/test_file_perms.cpp b/storage/test/test_file_perms.cpp index d682c20581d..68abcd631ad 100644 --- a/storage/test/test_file_perms.cpp +++ b/storage/test/test_file_perms.cpp @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "storage_test_harness.h" -#include "nsILocalFile.h" +#include "nsIFile.h" /** * This file tests that the file permissions of the sqlite files match what @@ -19,11 +19,8 @@ test_file_perms() nsCOMPtr dbFile; do_check_success(db->GetDatabaseFile(getter_AddRefs(dbFile))); - nsCOMPtr localFile = do_QueryInterface(dbFile); - do_check_true(localFile); - PRUint32 perms = 0; - do_check_success(localFile->GetPermissions(&perms)); + do_check_success(dbFile->GetPermissions(&perms)); // This reflexts the permissions defined by SQLITE_DEFAULT_FILE_PERMISSIONS in // db/sqlite3/src/Makefile.in and must be kept in sync with that diff --git a/toolkit/components/commandlines/nsCommandLine.cpp b/toolkit/components/commandlines/nsCommandLine.cpp index 0e609583f9c..816b710907b 100644 --- a/toolkit/components/commandlines/nsCommandLine.cpp +++ b/toolkit/components/commandlines/nsCommandLine.cpp @@ -64,7 +64,7 @@ protected: void *aClosure); void appendArg(const char* arg); - void resolveShortcutURL(nsILocalFile* aFile, nsACString& outURL); + void resolveShortcutURL(nsIFile* aFile, nsACString& outURL); nsresult EnumerateHandlers(EnumerateHandlersCallback aCallback, void *aClosure); nsresult EnumerateValidators(EnumerateValidatorsCallback aCallback, void *aClosure); @@ -245,7 +245,7 @@ nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult) { NS_ENSURE_TRUE(mWorkingDir, NS_ERROR_NOT_INITIALIZED); - // This is some seriously screwed-up code. nsILocalFile.appendRelativeNativePath + // This is some seriously screwed-up code. nsIFile.appendRelativeNativePath // explicitly does not accept .. or . path parts, but that is exactly what we // need here. So we hack around it. @@ -280,7 +280,7 @@ nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult) return NS_OK; #elif defined(XP_UNIX) - nsCOMPtr lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); + nsCOMPtr lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY); if (aArgument.First() == '/') { @@ -311,7 +311,7 @@ nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult) return NS_OK; #elif defined(XP_WIN32) - nsCOMPtr lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); + nsCOMPtr lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY); rv = lf->InitWithPath(aArgument); @@ -338,7 +338,7 @@ nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult) return NS_OK; #elif defined(XP_OS2) - nsCOMPtr lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); + nsCOMPtr lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY); rv = lf->InitWithPath(aArgument); @@ -384,7 +384,7 @@ nsCommandLine::ResolveURI(const nsAString& aArgument, nsIURI* *aResult) io->NewFileURI(mWorkingDir, getter_AddRefs(workingDirURI)); } - nsCOMPtr lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); + nsCOMPtr lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); rv = lf->InitWithPath(aArgument); if (NS_SUCCEEDED(rv)) { lf->Normalize(); @@ -425,7 +425,7 @@ nsCommandLine::appendArg(const char* arg) } void -nsCommandLine::resolveShortcutURL(nsILocalFile* aFile, nsACString& outURL) +nsCommandLine::resolveShortcutURL(nsIFile* aFile, nsACString& outURL) { nsCOMPtr fph; nsresult rv = NS_GetFileProtocolHandler(getter_AddRefs(fph)); diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp index 9d4d8242620..d0af1ff0121 100644 --- a/toolkit/components/downloads/nsDownloadManager.cpp +++ b/toolkit/components/downloads/nsDownloadManager.cpp @@ -1040,7 +1040,7 @@ nsDownloadManager::GetDownloadFromDB(PRUint32 aID, nsDownload **retVal) do_CreateInstance(NS_LOCALHANDLERAPP_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr localExecutable; + nsCOMPtr localExecutable; rv = NS_NewNativeLocalFile(EmptyCString(), false, getter_AddRefs(localExecutable)); NS_ENSURE_SUCCESS(rv, rv); @@ -1105,9 +1105,9 @@ nsDownloadManager::GetActiveDownloads(nsISimpleEnumerator **aResult) * this should be kept in sync with nsExternalHelperAppService.cpp */ NS_IMETHODIMP -nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult) +nsDownloadManager::GetDefaultDownloadsDirectory(nsIFile **aResult) { - nsCOMPtr downloadDir; + nsCOMPtr downloadDir; nsresult rv; nsCOMPtr dirService = @@ -1131,12 +1131,12 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult) #if defined (XP_MACOSX) rv = dirService->Get(NS_OSX_DEFAULT_DOWNLOAD_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(downloadDir)); NS_ENSURE_SUCCESS(rv, rv); #elif defined(XP_WIN) rv = dirService->Get(NS_WIN_DEFAULT_DOWNLOAD_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(downloadDir)); NS_ENSURE_SUCCESS(rv, rv); @@ -1152,7 +1152,7 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult) if (version < 6) { // XP/2K // First get "My Documents" rv = dirService->Get(NS_WIN_PERSONAL_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(downloadDir)); NS_ENSURE_SUCCESS(rv, rv); @@ -1177,7 +1177,7 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult) // we found most apropriate to be the default target folder for downloads // on the platform. rv = dirService->Get(NS_UNIX_XDG_DOCUMENTS_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(downloadDir)); #elif defined(MOZ_WIDGET_ANDROID) // Android doesn't have a $HOME directory, and by default we only have @@ -1193,12 +1193,12 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult) } #else rv = dirService->Get(NS_UNIX_DEFAULT_DOWNLOAD_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(downloadDir)); // fallback to Home/Downloads if (NS_FAILED(rv)) { rv = dirService->Get(NS_UNIX_HOME_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(downloadDir)); NS_ENSURE_SUCCESS(rv, rv); rv = downloadDir->Append(folderName); @@ -1207,7 +1207,7 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult) #endif #else rv = dirService->Get(NS_OS_HOME_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(downloadDir)); NS_ENSURE_SUCCESS(rv, rv); rv = downloadDir->Append(folderName); @@ -1224,7 +1224,7 @@ nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult) #define NS_PREF_DIR "dir" NS_IMETHODIMP -nsDownloadManager::GetUserDownloadsDirectory(nsILocalFile **aResult) +nsDownloadManager::GetUserDownloadsDirectory(nsIFile **aResult) { nsresult rv; nsCOMPtr dirService = @@ -1248,12 +1248,12 @@ nsDownloadManager::GetUserDownloadsDirectory(nsILocalFile **aResult) switch(val) { case 0: // Desktop { - nsCOMPtr downloadDir; + nsCOMPtr downloadDir; nsCOMPtr dirService = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); rv = dirService->Get(NS_OS_DESKTOP_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(downloadDir)); NS_ENSURE_SUCCESS(rv, rv); downloadDir.forget(aResult); @@ -1264,9 +1264,9 @@ nsDownloadManager::GetUserDownloadsDirectory(nsILocalFile **aResult) return GetDefaultDownloadsDirectory(aResult); case 2: // Custom { - nsCOMPtr customDirectory; + nsCOMPtr customDirectory; prefBranch->GetComplexValue(NS_PREF_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(customDirectory)); if (customDirectory) { bool exists = false; @@ -1296,7 +1296,7 @@ nsDownloadManager::GetUserDownloadsDirectory(nsILocalFile **aResult) rv = GetDefaultDownloadsDirectory(aResult); if (NS_SUCCEEDED(rv)) { (void)prefBranch->SetComplexValue(NS_PREF_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), *aResult); } return rv; @@ -1313,7 +1313,7 @@ nsDownloadManager::AddDownload(DownloadType aDownloadType, const nsAString& aDisplayName, nsIMIMEInfo *aMIMEInfo, PRTime aStartTime, - nsILocalFile *aTempFile, + nsIFile *aTempFile, nsICancelable *aCancelable, nsIDownload **aDownload) { @@ -1374,10 +1374,7 @@ nsDownloadManager::AddDownload(DownloadType aDownloadType, if (locHandlerApp) { nsCOMPtr executable; (void)locHandlerApp->GetExecutable(getter_AddRefs(executable)); - nsCOMPtr locExecutable = do_QueryInterface(executable); - - if (locExecutable) - (void)locExecutable->GetPersistentDescriptor(persistentDescriptor); + (void)executable->GetPersistentDescriptor(persistentDescriptor); } (void)aMIMEInfo->GetPreferredAction(&action); @@ -1513,7 +1510,7 @@ nsDownloadManager::CancelDownload(PRUint32 aID) dl->mTempFile->Remove(false); } - nsCOMPtr file; + nsCOMPtr file; if (NS_SUCCEEDED(dl->GetTargetFile(getter_AddRefs(file)))) { bool exists; @@ -2557,7 +2554,7 @@ nsDownload::OnStateChange(nsIWebProgress *aWebProgress, // Our best bet is the file itself, but if for some reason it's gone or // if we have multiple files, the next best is what we've calculated. PRInt64 fileSize; - nsCOMPtr file; + nsCOMPtr file; // We need a nsIFile clone to deal with file size caching issues. :( nsCOMPtr clone; if (!mHasMultipleFiles && @@ -2618,7 +2615,7 @@ nsDownload::Init(nsIURI *aSource, const nsAString& aDisplayName, nsIMIMEInfo *aMIMEInfo, PRTime aStartTime, - nsILocalFile *aTempFile, + nsIFile *aTempFile, nsICancelable *aCancelable) { NS_WARNING("Huh...how did we get here?!"); @@ -2700,7 +2697,7 @@ nsDownload::GetMIMEInfo(nsIMIMEInfo **aMIMEInfo) } NS_IMETHODIMP -nsDownload::GetTargetFile(nsILocalFile **aTargetFile) +nsDownload::GetTargetFile(nsIFile **aTargetFile) { nsresult rv; @@ -2804,7 +2801,7 @@ nsDownload::ExecuteDesiredAction() nsresult nsDownload::MoveTempToTarget() { - nsCOMPtr target; + nsCOMPtr target; nsresult rv = GetTargetFile(getter_AddRefs(target)); NS_ENSURE_SUCCESS(rv, rv); @@ -2833,7 +2830,7 @@ nsresult nsDownload::OpenWithApplication() { // First move the temporary file to the target location - nsCOMPtr target; + nsCOMPtr target; nsresult rv = GetTargetFile(getter_AddRefs(target)); NS_ENSURE_SUCCESS(rv, rv); @@ -2954,7 +2951,7 @@ nsDownload::Resume() // Make sure we can get a file, either the temporary or the real target, for // both purposes of file size and a target to write to - nsCOMPtr targetLocalFile(mTempFile); + nsCOMPtr targetLocalFile(mTempFile); if (!targetLocalFile) { rv = GetTargetFile(getter_AddRefs(targetLocalFile)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/toolkit/components/downloads/nsDownloadManager.h b/toolkit/components/downloads/nsDownloadManager.h index 5649eeb0d2d..2825a190e8f 100644 --- a/toolkit/components/downloads/nsDownloadManager.h +++ b/toolkit/components/downloads/nsDownloadManager.h @@ -13,7 +13,7 @@ #include "nsIDownload.h" #include "nsIDownloadManager.h" #include "nsIDownloadProgressListener.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIMIMEInfo.h" #include "nsINavHistoryService.h" #include "nsIObserver.h" @@ -378,7 +378,7 @@ private: nsCOMPtr mReferrer; nsCOMPtr mCancelable; nsCOMPtr mRequest; - nsCOMPtr mTempFile; + nsCOMPtr mTempFile; nsCOMPtr mMIMEInfo; DownloadState mDownloadState; diff --git a/toolkit/components/downloads/nsDownloadProxy.h b/toolkit/components/downloads/nsDownloadProxy.h index ae6b06b9fee..e839c901318 100644 --- a/toolkit/components/downloads/nsDownloadProxy.h +++ b/toolkit/components/downloads/nsDownloadProxy.h @@ -30,7 +30,7 @@ public: const nsAString& aDisplayName, nsIMIMEInfo *aMIMEInfo, PRTime aStartTime, - nsILocalFile* aTempFile, + nsIFile* aTempFile, nsICancelable* aCancelable) { nsresult rv; nsCOMPtr dm = do_GetService("@mozilla.org/download-manager;1", &rv); diff --git a/toolkit/components/downloads/nsDownloadScanner.cpp b/toolkit/components/downloads/nsDownloadScanner.cpp index 6191980157b..54aa2fe2d60 100644 --- a/toolkit/components/downloads/nsDownloadScanner.cpp +++ b/toolkit/components/downloads/nsDownloadScanner.cpp @@ -329,7 +329,7 @@ nsDownloadScanner::Scan::Start() nsresult rv = NS_OK; // Get the path to the file on disk - nsCOMPtr file; + nsCOMPtr file; rv = mDownload->GetTargetFile(getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv, rv); rv = file->GetPath(mPath); diff --git a/toolkit/components/downloads/nsIDownload.idl b/toolkit/components/downloads/nsIDownload.idl index 754dd3a92e4..10674a14cfa 100644 --- a/toolkit/components/downloads/nsIDownload.idl +++ b/toolkit/components/downloads/nsIDownload.idl @@ -6,7 +6,7 @@ #include "nsITransfer.idl" interface nsIURI; -interface nsILocalFile; +interface nsIFile; interface nsIObserver; interface nsICancelable; interface nsIWebProgressListener; @@ -30,7 +30,7 @@ interface nsIDownload : nsITransfer { /** * The target of a download is always a file on the local file system. */ - readonly attribute nsILocalFile targetFile; + readonly attribute nsIFile targetFile; /** * The percentage of transfer completed. diff --git a/toolkit/components/downloads/nsIDownloadManager.idl b/toolkit/components/downloads/nsIDownloadManager.idl index 79cb6b35e12..118f1fa6839 100644 --- a/toolkit/components/downloads/nsIDownloadManager.idl +++ b/toolkit/components/downloads/nsIDownloadManager.idl @@ -8,7 +8,7 @@ #include "nsISupports.idl" interface nsIURI; -interface nsILocalFile; +interface nsIFile; interface nsIDownload; interface nsICancelable; interface nsIMIMEInfo; @@ -120,7 +120,7 @@ interface nsIDownloadManager : nsISupports { in AString aDisplayName, in nsIMIMEInfo aMIMEInfo, in PRTime aStartTime, - in nsILocalFile aTempFile, + in nsIFile aTempFile, in nsICancelable aCancelable); /** @@ -239,7 +239,7 @@ interface nsIDownloadManager : nsISupports { /** * Returns the platform default downloads directory. */ - readonly attribute nsILocalFile defaultDownloadsDirectory; + readonly attribute nsIFile defaultDownloadsDirectory; /** * Returns the user configured downloads directory. @@ -261,7 +261,7 @@ interface nsIDownloadManager : nsISupports { * where downloaded files are saved. The use of which is * enabled when folderList equals 2. */ - readonly attribute nsILocalFile userDownloadsDirectory; + readonly attribute nsIFile userDownloadsDirectory; }; diff --git a/toolkit/components/filepicker/nsFileView.cpp b/toolkit/components/filepicker/nsFileView.cpp index 1b86e1b20c6..d833120d91e 100644 --- a/toolkit/components/filepicker/nsFileView.cpp +++ b/toolkit/components/filepicker/nsFileView.cpp @@ -9,7 +9,7 @@ #include "nsITreeSelection.h" #include "nsITreeColumns.h" #include "nsITreeBoxObject.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsString.h" #include "nsReadableUtils.h" #include "nsCRT.h" @@ -60,7 +60,7 @@ nsFileResult::nsFileResult(const nsAString& aSearchString, else { PRInt32 slashPos = mSearchString.RFindChar('/'); mSearchResult = RESULT_FAILURE; - nsCOMPtr directory; + nsCOMPtr directory; nsDependentSubstring parent(Substring(mSearchString, 0, slashPos + 1)); if (!parent.IsEmpty() && parent.First() == '/') NS_NewLocalFile(parent, true, getter_AddRefs(directory)); @@ -79,7 +79,7 @@ nsFileResult::nsFileResult(const nsAString& aSearchString, while (NS_SUCCEEDED(dirEntries->HasMoreElements(&hasMore)) && hasMore) { nsCOMPtr nextItem; dirEntries->GetNext(getter_AddRefs(nextItem)); - nsCOMPtr nextFile(do_QueryInterface(nextItem)); + nsCOMPtr nextFile(do_QueryInterface(nextItem)); nsAutoString fileName; nextFile->GetLeafName(fileName); if (StringBeginsWith(fileName, prefix)) { diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index 055b5f16064..ad84372493d 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -6,7 +6,7 @@ #include "nsINavBookmarksService.h" #include "nsIInterfaceRequestorUtils.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNavHistory.h" #include "nsPlacesTables.h" diff --git a/toolkit/components/places/nsIPlacesImportExportService.idl b/toolkit/components/places/nsIPlacesImportExportService.idl index b279b06901e..a3f0f36eee1 100644 --- a/toolkit/components/places/nsIPlacesImportExportService.idl +++ b/toolkit/components/places/nsIPlacesImportExportService.idl @@ -5,7 +5,7 @@ #include "nsISupports.idl" -interface nsILocalFile; +interface nsIFile; interface nsIURI; /** @@ -21,7 +21,7 @@ interface nsIPlacesImportExportService: nsISupports /** * Saves the current bookmarks hierarchy to a bookmarks.html file. */ - void exportHTMLToFile(in nsILocalFile aFile); + void exportHTMLToFile(in nsIFile aFile); /** * Backup the bookmarks.html file. diff --git a/toolkit/components/places/nsPlacesExportService.cpp b/toolkit/components/places/nsPlacesExportService.cpp index e69e6f109c2..34b4e5de8d1 100644 --- a/toolkit/components/places/nsPlacesExportService.cpp +++ b/toolkit/components/places/nsPlacesExportService.cpp @@ -946,7 +946,7 @@ nsPlacesExportService::WriteContainerContents(nsINavHistoryResultNode* aFolder, NS_IMETHODIMP -nsPlacesExportService::ExportHTMLToFile(nsILocalFile* aBookmarksFile) +nsPlacesExportService::ExportHTMLToFile(nsIFile* aBookmarksFile) { NS_ENSURE_ARG(aBookmarksFile); @@ -1105,14 +1105,12 @@ nsPlacesExportService::BackupBookmarksFile() getter_AddRefs(bookmarksFileDir)); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr bookmarksFile = do_QueryInterface(bookmarksFileDir); - NS_ENSURE_STATE(bookmarksFile); // Create the file if it doesn't exist. bool exists; - rv = bookmarksFile->Exists(&exists); + rv = bookmarksFileDir->Exists(&exists); if (NS_FAILED(rv) || !exists) { - rv = bookmarksFile->Create(nsIFile::NORMAL_FILE_TYPE, 0600); + rv = bookmarksFileDir->Create(nsIFile::NORMAL_FILE_TYPE, 0600); if (NS_FAILED(rv)) { NS_WARNING("Unable to create bookmarks.html!"); return rv; @@ -1120,7 +1118,7 @@ nsPlacesExportService::BackupBookmarksFile() } // export bookmarks.html - rv = ExportHTMLToFile(bookmarksFile); + rv = ExportHTMLToFile(bookmarksFileDir); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; diff --git a/toolkit/components/places/nsPlacesExportService.h b/toolkit/components/places/nsPlacesExportService.h index 0d96f4b3309..f4e5506cd24 100755 --- a/toolkit/components/places/nsPlacesExportService.h +++ b/toolkit/components/places/nsPlacesExportService.h @@ -8,7 +8,7 @@ #include "nsIPlacesImportExportService.h" #include "nsCOMPtr.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIOutputStream.h" #include "nsIFaviconService.h" #include "nsIAnnotationService.h" diff --git a/toolkit/components/remote/nsXRemoteService.cpp b/toolkit/components/remote/nsXRemoteService.cpp index bb329c8fd6c..2f7f62a3baf 100644 --- a/toolkit/components/remote/nsXRemoteService.cpp +++ b/toolkit/components/remote/nsXRemoteService.cpp @@ -16,7 +16,7 @@ #include "nsIBaseWindow.h" #include "nsIDocShell.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIServiceManager.h" #include "nsIWeakReference.h" #include "nsIWidget.h" @@ -318,7 +318,7 @@ nsXRemoteService::HandleCommandLine(char* aBuffer, nsIDOMWindow* aWindow, PRInt32 argc = TO_LITTLE_ENDIAN32(*reinterpret_cast(aBuffer)); char *wd = aBuffer + ((argc + 1) * sizeof(PRInt32)); - nsCOMPtr lf; + nsCOMPtr lf; rv = NS_NewNativeLocalFile(nsDependentCString(wd), true, getter_AddRefs(lf)); if (NS_FAILED(rv)) diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp index d164e79c9a3..1ed8ee181b8 100644 --- a/toolkit/components/startup/nsAppStartup.cpp +++ b/toolkit/components/startup/nsAppStartup.cpp @@ -8,7 +8,7 @@ #include "nsIAppShellService.h" #include "nsPIDOMWindow.h" #include "nsIInterfaceRequestor.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIObserverService.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index b3da80cc284..5163da38ec2 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -15,7 +15,6 @@ #include "nsStringGlue.h" #include "nsITelemetry.h" #include "nsIFile.h" -#include "nsILocalFile.h" #include "Telemetry.h" #include "nsTHashtable.h" #include "nsHashKeys.h" @@ -1340,13 +1339,9 @@ TelemetrySessionData::LoadFromDisk(nsIFile *file, TelemetrySessionData **ptr) { *ptr = nsnull; nsresult rv; - nsCOMPtr f(do_QueryInterface(file, &rv)); - if (NS_FAILED(rv)) { - return rv; - } AutoFDClose fd; - rv = f->OpenNSPRFileDesc(PR_RDONLY, 0, &fd.rwget()); + rv = file->OpenNSPRFileDesc(PR_RDONLY, 0, &fd.rwget()); if (NS_FAILED(rv)) { return NS_ERROR_FAILURE; } @@ -1432,13 +1427,9 @@ nsresult TelemetrySessionData::SaveToDisk(nsIFile *file, const nsACString &uuid) { nsresult rv; - nsCOMPtr f(do_QueryInterface(file, &rv)); - if (NS_FAILED(rv)) { - return rv; - } AutoFDClose fd; - rv = f->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd.rwget()); + rv = file->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd.rwget()); if (NS_FAILED(rv)) { return rv; } diff --git a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp index 9c75fc76a23..7d309619d0d 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp @@ -13,7 +13,6 @@ #include "nsIUrlClassifierPrefixSet.h" #include "nsIRandomGenerator.h" #include "nsIFile.h" -#include "nsILocalFile.h" #include "nsToolkitCompsCID.h" #include "nsTArray.h" #include "nsThreadUtils.h" @@ -450,12 +449,9 @@ NS_IMETHODIMP nsUrlClassifierPrefixSet::LoadFromFile(nsIFile * aFile) { nsresult rv; - nsCOMPtr file(do_QueryInterface(aFile, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - AutoFDClose fileFd; - rv = file->OpenNSPRFileDesc(PR_RDONLY | nsILocalFile::OS_READAHEAD, - 0, &fileFd.rwget()); + rv = aFile->OpenNSPRFileDesc(PR_RDONLY | nsIFile::OS_READAHEAD, + 0, &fileFd.rwget()); NS_ENSURE_SUCCESS(rv, rv); return LoadFromFd(fileFd); @@ -511,12 +507,10 @@ nsUrlClassifierPrefixSet::StoreToFile(nsIFile * aFile) } nsresult rv; - nsCOMPtr file(do_QueryInterface(aFile, &rv)); - NS_ENSURE_SUCCESS(rv, rv); AutoFDClose fileFd; - rv = file->OpenNSPRFileDesc(PR_RDWR | PR_TRUNCATE | PR_CREATE_FILE, - 0644, &fileFd.rwget()); + rv = aFile->OpenNSPRFileDesc(PR_RDWR | PR_TRUNCATE | PR_CREATE_FILE, + 0644, &fileFd.rwget()); NS_ENSURE_SUCCESS(rv, rv); MutexAutoLock lock(mPrefixSetLock); diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index f1f8b2c6b8f..b2ad4ca008d 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -70,7 +70,7 @@ #include "mozilla/Mutex.h" #include "nsDebug.h" #include "nsCRT.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIFileStreams.h" #include "nsInterfaceHashtable.h" #include "prprf.h" @@ -215,7 +215,7 @@ static const int kMagicChildCrashReportFd = 4; // |dumpMapLock| must protect all access to |pidToMinidump|. static Mutex* dumpMapLock; -typedef nsInterfaceHashtable ChildMinidumpMap; +typedef nsInterfaceHashtable ChildMinidumpMap; static ChildMinidumpMap* pidToMinidump; // Crashreporter annotations that we don't send along in subprocess @@ -315,13 +315,13 @@ my_inttostring(intmax_t t, char* buffer, size_t buffer_length) #ifdef XP_WIN static void -CreateFileFromPath(const xpstring& path, nsILocalFile** file) +CreateFileFromPath(const xpstring& path, nsIFile** file) { NS_NewLocalFile(nsDependentString(path.c_str()), false, file); } #else static void -CreateFileFromPath(const xpstring& path, nsILocalFile** file) +CreateFileFromPath(const xpstring& path, nsIFile** file) { NS_NewNativeLocalFile(nsDependentCString(path.c_str()), false, file); } @@ -634,7 +634,7 @@ static bool ShouldReport() return !(envvar && *envvar); } -nsresult SetExceptionHandler(nsILocalFile* aXREDirectory, +nsresult SetExceptionHandler(nsIFile* aXREDirectory, bool force/*=false*/) { nsresult rv; @@ -890,12 +890,8 @@ nsresult SetMinidumpPath(const nsAString& aPath) static nsresult WriteDataToFile(nsIFile* aFile, const nsACString& data) { - nsCOMPtr localFile = do_QueryInterface(aFile); - NS_ENSURE_TRUE(localFile, NS_ERROR_FAILURE); - PRFileDesc* fd; - nsresult rv = localFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE, 00600, - &fd); + nsresult rv = aFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE, 00600, &fd); NS_ENSURE_SUCCESS(rv, rv); rv = NS_OK; @@ -909,11 +905,8 @@ WriteDataToFile(nsIFile* aFile, const nsACString& data) static nsresult GetFileContents(nsIFile* aFile, nsACString& data) { - nsCOMPtr localFile = do_QueryInterface(aFile); - NS_ENSURE_TRUE(localFile, NS_ERROR_FAILURE); - PRFileDesc* fd; - nsresult rv = localFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fd); + nsresult rv = aFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fd); NS_ENSURE_SUCCESS(rv, rv); rv = NS_OK; @@ -992,7 +985,7 @@ InitInstallTime(nsACString& aInstallTime) // time since last crash, which must be calculated at // crash time. // If any piece of data doesn't exist, initialize it first. -nsresult SetupExtraData(nsILocalFile* aAppDataDirectory, +nsresult SetupExtraData(nsIFile* aAppDataDirectory, const nsACString& aBuildID) { nsCOMPtr dataDirectory; @@ -1572,10 +1565,8 @@ static nsresult PrefSubmitReports(bool* aSubmitReports, bool writePref) do_GetService("@mozilla.org/xpcom/ini-processor-factory;1", &rv); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr localFile = do_QueryInterface(reporterINI); - NS_ENSURE_TRUE(localFile, NS_ERROR_FAILURE); nsCOMPtr iniParser; - rv = iniFactory->CreateINIParser(localFile, + rv = iniFactory->CreateINIParser(reporterINI, getter_AddRefs(iniParser)); NS_ENSURE_SUCCESS(rv, rv); @@ -1639,15 +1630,15 @@ nsresult SetSubmitReports(bool aSubmitReports) // The "pending" dir is Crash Reports/pending, from which minidumps // can be submitted static bool -GetPendingDir(nsILocalFile** dir) +GetPendingDir(nsIFile** dir) { nsCOMPtr dirSvc = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID); if (!dirSvc) return false; - nsCOMPtr pendingDir; + nsCOMPtr pendingDir; if (NS_FAILED(dirSvc->Get("UAppData", - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(pendingDir))) || NS_FAILED(pendingDir->Append(NS_LITERAL_STRING("Crash Reports"))) || NS_FAILED(pendingDir->Append(NS_LITERAL_STRING("pending")))) @@ -1664,7 +1655,7 @@ GetPendingDir(nsILocalFile** dir) // "somthing else" is, but the minidumps stay in [profile]/minidumps/ // limbo. static bool -GetMinidumpLimboDir(nsILocalFile** dir) +GetMinidumpLimboDir(nsIFile** dir) { if (ShouldReport()) { return GetPendingDir(dir); @@ -1676,7 +1667,7 @@ GetMinidumpLimboDir(nsILocalFile** dir) } bool -GetMinidumpForID(const nsAString& id, nsILocalFile** minidump) +GetMinidumpForID(const nsAString& id, nsIFile** minidump) { if (!GetMinidumpLimboDir(minidump)) return false; @@ -1685,7 +1676,7 @@ GetMinidumpForID(const nsAString& id, nsILocalFile** minidump) } bool -GetIDFromMinidump(nsILocalFile* minidump, nsAString& id) +GetIDFromMinidump(nsIFile* minidump, nsAString& id) { if (NS_SUCCEEDED(minidump->GetLeafName(id))) { id.Replace(id.Length() - 4, 4, NS_LITERAL_STRING("")); @@ -1695,7 +1686,7 @@ GetIDFromMinidump(nsILocalFile* minidump, nsAString& id) } bool -GetExtraFileForID(const nsAString& id, nsILocalFile** extraFile) +GetExtraFileForID(const nsAString& id, nsIFile** extraFile) { if (!GetMinidumpLimboDir(extraFile)) return false; @@ -1704,7 +1695,7 @@ GetExtraFileForID(const nsAString& id, nsILocalFile** extraFile) } bool -GetExtraFileForMinidump(nsILocalFile* minidump, nsILocalFile** extraFile) +GetExtraFileForMinidump(nsIFile* minidump, nsIFile** extraFile) { nsAutoString leafName; nsresult rv = minidump->GetLeafName(leafName); @@ -1716,25 +1707,21 @@ GetExtraFileForMinidump(nsILocalFile* minidump, nsILocalFile** extraFile) if (NS_FAILED(rv)) return false; - nsCOMPtr extra = do_QueryInterface(extraF); - if (!extra) - return false; - leafName.Replace(leafName.Length() - 3, 3, NS_LITERAL_STRING("extra")); - rv = extra->SetLeafName(leafName); + rv = extraF->SetLeafName(leafName); if (NS_FAILED(rv)) return false; *extraFile = NULL; - extra.swap(*extraFile); + extraF.swap(*extraFile); return true; } bool AppendExtraData(const nsAString& id, const AnnotationTable& data) { - nsCOMPtr extraFile; + nsCOMPtr extraFile; if (!GetExtraFileForID(id, getter_AddRefs(extraFile))) return false; return AppendExtraData(extraFile, data); @@ -1791,7 +1778,7 @@ EnumerateAnnotations(const nsACString& key, } static bool -WriteExtraData(nsILocalFile* extraFile, +WriteExtraData(nsIFile* extraFile, const AnnotationTable& data, const Blacklist& blacklist, bool writeCrashTime=false, @@ -1823,18 +1810,18 @@ WriteExtraData(nsILocalFile* extraFile, } bool -AppendExtraData(nsILocalFile* extraFile, const AnnotationTable& data) +AppendExtraData(nsIFile* extraFile, const AnnotationTable& data) { return WriteExtraData(extraFile, data, Blacklist()); } static bool -WriteExtraForMinidump(nsILocalFile* minidump, +WriteExtraForMinidump(nsIFile* minidump, const Blacklist& blacklist, - nsILocalFile** extraFile) + nsIFile** extraFile) { - nsCOMPtr extra; + nsCOMPtr extra; if (!GetExtraFileForMinidump(minidump, getter_AddRefs(extra))) return false; @@ -1855,7 +1842,7 @@ WriteExtraForMinidump(nsILocalFile* minidump, static bool MoveToPending(nsIFile* dumpFile, nsIFile* extraFile) { - nsCOMPtr pendingDir; + nsCOMPtr pendingDir; if (!GetPendingDir(getter_AddRefs(pendingDir))) return false; @@ -1874,8 +1861,8 @@ OnChildProcessDumpRequested(void* aContext, #endif ) { - nsCOMPtr minidump; - nsCOMPtr extraFile; + nsCOMPtr minidump; + nsCOMPtr extraFile; CreateFileFromPath( #ifdef XP_MACOSX @@ -2138,14 +2125,14 @@ SetRemoteExceptionHandler(const nsACString& crashPipe) bool -TakeMinidumpForChild(PRUint32 childPid, nsILocalFile** dump) +TakeMinidumpForChild(PRUint32 childPid, nsIFile** dump) { if (!GetEnabled()) return false; MutexAutoLock lock(*dumpMapLock); - nsCOMPtr d; + nsCOMPtr d; bool found = pidToMinidump->Get(childPid, getter_AddRefs(d)); if (found) pidToMinidump->Remove(childPid); @@ -2160,8 +2147,8 @@ TakeMinidumpForChild(PRUint32 childPid, nsILocalFile** dump) // CreatePairedMinidumps() and helpers // struct PairedDumpContext { - nsCOMPtr* minidump; - nsCOMPtr* extra; + nsCOMPtr* minidump; + nsCOMPtr* extra; const Blacklist& blacklist; }; @@ -2176,8 +2163,8 @@ PairedDumpCallback(const XP_CHAR* dump_path, bool succeeded) { PairedDumpContext* ctx = static_cast(context); - nsCOMPtr& minidump = *ctx->minidump; - nsCOMPtr& extra = *ctx->extra; + nsCOMPtr& minidump = *ctx->minidump; + nsCOMPtr& extra = *ctx->extra; const Blacklist& blacklist = ctx->blacklist; xpstring dump(dump_path); @@ -2218,8 +2205,8 @@ bool CreatePairedMinidumps(ProcessHandle childPid, ThreadId childBlamedThread, nsAString* pairGUID, - nsILocalFile** childDump, - nsILocalFile** parentDump) + nsIFile** childDump, + nsIFile** parentDump) { if (!GetEnabled()) return false; @@ -2256,8 +2243,8 @@ CreatePairedMinidumps(ProcessHandle childPid, #endif // dump the child - nsCOMPtr childMinidump; - nsCOMPtr childExtra; + nsCOMPtr childMinidump; + nsCOMPtr childExtra; Blacklist childBlacklist(kSubprocessBlacklist, ArrayLength(kSubprocessBlacklist)); PairedDumpContext childCtx = @@ -2271,8 +2258,8 @@ CreatePairedMinidumps(ProcessHandle childPid, return false; // dump the parent - nsCOMPtr parentMinidump; - nsCOMPtr parentExtra; + nsCOMPtr parentMinidump; + nsCOMPtr parentExtra; // nothing's blacklisted for this process Blacklist parentBlacklist; PairedDumpContext parentCtx = diff --git a/toolkit/crashreporter/nsExceptionHandler.h b/toolkit/crashreporter/nsExceptionHandler.h index 8ab8babcb59..00a5b158802 100644 --- a/toolkit/crashreporter/nsExceptionHandler.h +++ b/toolkit/crashreporter/nsExceptionHandler.h @@ -25,7 +25,7 @@ #endif namespace CrashReporter { -nsresult SetExceptionHandler(nsILocalFile* aXREDirectory, bool force=false); +nsresult SetExceptionHandler(nsIFile* aXREDirectory, bool force=false); nsresult UnsetExceptionHandler(); bool GetEnabled(); bool GetServerURL(nsACString& aServerURL); @@ -41,7 +41,7 @@ nsresult AnnotateCrashReport(const nsACString& key, const nsACString& data); nsresult AppendAppNotesToCrashReport(const nsACString& data); nsresult SetRestartArgs(int argc, char** argv); -nsresult SetupExtraData(nsILocalFile* aAppDataDirectory, +nsresult SetupExtraData(nsIFile* aAppDataDirectory, const nsACString& aBuildID); // Registers an additional memory region to be included in the minidump @@ -51,12 +51,12 @@ nsresult UnregisterAppMemory(void* ptr); // Functions for working with minidumps and .extras typedef nsDataHashtable AnnotationTable; -bool GetMinidumpForID(const nsAString& id, nsILocalFile** minidump); -bool GetIDFromMinidump(nsILocalFile* minidump, nsAString& id); -bool GetExtraFileForID(const nsAString& id, nsILocalFile** extraFile); -bool GetExtraFileForMinidump(nsILocalFile* minidump, nsILocalFile** extraFile); +bool GetMinidumpForID(const nsAString& id, nsIFile** minidump); +bool GetIDFromMinidump(nsIFile* minidump, nsAString& id); +bool GetExtraFileForID(const nsAString& id, nsIFile** extraFile); +bool GetExtraFileForMinidump(nsIFile* minidump, nsIFile** extraFile); bool AppendExtraData(const nsAString& id, const AnnotationTable& data); -bool AppendExtraData(nsILocalFile* extraFile, const AnnotationTable& data); +bool AppendExtraData(nsIFile* extraFile, const AnnotationTable& data); #ifdef XP_WIN32 nsresult WriteMinidumpForException(EXCEPTION_POINTERS* aExceptionInfo); @@ -73,7 +73,7 @@ nsresult SetSubmitReports(bool aSubmitReport); // path in |dump|. The caller owns the last reference to |dump| if it // is non-NULL. bool TakeMinidumpForChild(PRUint32 childPid, - nsILocalFile** dump NS_OUTPARAM); + nsIFile** dump NS_OUTPARAM); #if defined(XP_WIN) typedef HANDLE ProcessHandle; @@ -104,8 +104,8 @@ ThreadId CurrentThreadId(); bool CreatePairedMinidumps(ProcessHandle childPid, ThreadId childBlamedThread, nsAString* pairGUID NS_OUTPARAM, - nsILocalFile** childDump NS_OUTPARAM, - nsILocalFile** parentDump NS_OUTPARAM); + nsIFile** childDump NS_OUTPARAM, + nsIFile** parentDump NS_OUTPARAM); # if defined(XP_WIN32) || defined(XP_MACOSX) // Parent-side API for children diff --git a/toolkit/crashreporter/test/nsTestCrasher.cpp b/toolkit/crashreporter/test/nsTestCrasher.cpp index 552e27730e3..9e1699e7e81 100644 --- a/toolkit/crashreporter/test/nsTestCrasher.cpp +++ b/toolkit/crashreporter/test/nsTestCrasher.cpp @@ -74,7 +74,7 @@ void Crash(PRInt16 how) } extern "C" NS_EXPORT -nsISupports* LockDir(nsILocalFile *directory) +nsISupports* LockDir(nsIFile *directory) { nsISupports* lockfile = nsnull; XRE_LockProfileDirectory(directory, &lockfile); diff --git a/toolkit/profile/nsIToolkitProfile.idl b/toolkit/profile/nsIToolkitProfile.idl index 3470bb332ae..9ee4d35b05d 100644 --- a/toolkit/profile/nsIToolkitProfile.idl +++ b/toolkit/profile/nsIToolkitProfile.idl @@ -5,7 +5,7 @@ #include "nsISupports.idl" -interface nsILocalFile; +interface nsIFile; interface nsIToolkitProfile; interface nsIProfileUnlocker; @@ -19,7 +19,7 @@ interface nsIProfileLock : nsISupports /** * The main profile directory. */ - readonly attribute nsILocalFile directory; + readonly attribute nsIFile directory; /** * A directory corresponding to the main profile directory that exists for @@ -29,7 +29,7 @@ interface nsIProfileLock : nsISupports * * In some cases, this directory may just be the main profile directory. */ - readonly attribute nsILocalFile localDirectory; + readonly attribute nsIFile localDirectory; /** * The timestamp of an existing profile lock at lock time. @@ -53,13 +53,13 @@ interface nsIToolkitProfile : nsISupports /** * The location of the profile directory. */ - readonly attribute nsILocalFile rootDir; + readonly attribute nsIFile rootDir; /** * The location of the profile local directory, which may be the same as * the root directory. See nsIProfileLock::localDirectory. */ - readonly attribute nsILocalFile localDir; + readonly attribute nsIFile localDir; /** * The name of the profile. diff --git a/toolkit/profile/nsIToolkitProfileService.idl b/toolkit/profile/nsIToolkitProfileService.idl index 98cbc0a5682..0a2dc64cd8f 100644 --- a/toolkit/profile/nsIToolkitProfileService.idl +++ b/toolkit/profile/nsIToolkitProfileService.idl @@ -7,7 +7,6 @@ interface nsISimpleEnumerator; interface nsIFile; -interface nsILocalFile; interface nsIToolkitProfile; interface nsIProfileLock; @@ -33,8 +32,8 @@ interface nsIToolkitProfileService : nsISupports * Lock an arbitrary path as a profile. If the path does not exist, it * will be created and the defaults copied from the application directory. */ - nsIProfileLock lockProfilePath(in nsILocalFile aDirectory, - in nsILocalFile aTempDirectory); + nsIProfileLock lockProfilePath(in nsIFile aDirectory, + in nsIFile aTempDirectory); /** * Create a new profile. @@ -49,8 +48,8 @@ interface nsIToolkitProfileService : nsISupports * @param aName * The profile name. */ - nsIToolkitProfile createProfile(in nsILocalFile aRootDir, - in nsILocalFile aTempDir, + nsIToolkitProfile createProfile(in nsIFile aRootDir, + in nsIFile aTempDir, in AUTF8String aName); /** diff --git a/toolkit/profile/nsToolkitProfileService.cpp b/toolkit/profile/nsToolkitProfileService.cpp index 5ca3b3b54ce..0d0268ee090 100644 --- a/toolkit/profile/nsToolkitProfileService.cpp +++ b/toolkit/profile/nsToolkitProfileService.cpp @@ -20,7 +20,7 @@ #include "nsIToolkitProfileService.h" #include "nsIToolkitProfile.h" #include "nsIFactory.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsISimpleEnumerator.h" #ifdef XP_MACOSX @@ -54,16 +54,16 @@ public: private: nsToolkitProfile(const nsACString& aName, - nsILocalFile* aRootDir, - nsILocalFile* aLocalDir, + nsIFile* aRootDir, + nsIFile* aLocalDir, nsToolkitProfile* aPrev, bool aForExternalApp); friend class nsToolkitProfileLock; nsCString mName; - nsCOMPtr mRootDir; - nsCOMPtr mLocalDir; + nsCOMPtr mRootDir; + nsCOMPtr mLocalDir; nsIProfileLock* mLock; bool mForExternalApp; }; @@ -75,7 +75,7 @@ public: NS_DECL_NSIPROFILELOCK nsresult Init(nsToolkitProfile* aProfile, nsIProfileUnlocker* *aUnlocker); - nsresult Init(nsILocalFile* aDirectory, nsILocalFile* aLocalDirectory, + nsresult Init(nsIFile* aDirectory, nsIFile* aLocalDirectory, nsIProfileUnlocker* *aUnlocker); nsToolkitProfileLock() { } @@ -83,8 +83,8 @@ public: private: nsCOMPtr mProfile; - nsCOMPtr mDirectory; - nsCOMPtr mLocalDirectory; + nsCOMPtr mDirectory; + nsCOMPtr mLocalDirectory; nsProfileLock mLock; }; @@ -121,8 +121,8 @@ private: NS_HIDDEN_(nsresult) Init(); - nsresult CreateProfileInternal(nsILocalFile* aRootDir, - nsILocalFile* aLocalDir, + nsresult CreateProfileInternal(nsIFile* aRootDir, + nsIFile* aLocalDir, const nsACString& aName, const nsACString* aProfileName, const nsACString* aAppName, @@ -133,9 +133,9 @@ private: nsRefPtr mFirst; nsCOMPtr mChosen; - nsCOMPtr mAppData; - nsCOMPtr mTempData; - nsCOMPtr mListFile; + nsCOMPtr mAppData; + nsCOMPtr mTempData; + nsCOMPtr mListFile; bool mDirty; bool mStartWithLast; bool mStartOffline; @@ -157,8 +157,8 @@ private: }; nsToolkitProfile::nsToolkitProfile(const nsACString& aName, - nsILocalFile* aRootDir, - nsILocalFile* aLocalDir, + nsIFile* aRootDir, + nsIFile* aLocalDir, nsToolkitProfile* aPrev, bool aForExternalApp) : mPrev(aPrev), @@ -182,14 +182,14 @@ nsToolkitProfile::nsToolkitProfile(const nsACString& aName, NS_IMPL_ISUPPORTS1(nsToolkitProfile, nsIToolkitProfile) NS_IMETHODIMP -nsToolkitProfile::GetRootDir(nsILocalFile* *aResult) +nsToolkitProfile::GetRootDir(nsIFile* *aResult) { NS_ADDREF(*aResult = mRootDir); return NS_OK; } NS_IMETHODIMP -nsToolkitProfile::GetLocalDir(nsILocalFile* *aResult) +nsToolkitProfile::GetLocalDir(nsIFile* *aResult) { NS_ADDREF(*aResult = mLocalDir); return NS_OK; @@ -291,7 +291,7 @@ nsToolkitProfileLock::Init(nsToolkitProfile* aProfile, nsIProfileUnlocker* *aUnl } nsresult -nsToolkitProfileLock::Init(nsILocalFile* aDirectory, nsILocalFile* aLocalDirectory, +nsToolkitProfileLock::Init(nsIFile* aDirectory, nsIFile* aLocalDirectory, nsIProfileUnlocker* *aUnlocker) { nsresult rv; @@ -307,7 +307,7 @@ nsToolkitProfileLock::Init(nsILocalFile* aDirectory, nsILocalFile* aLocalDirecto } NS_IMETHODIMP -nsToolkitProfileLock::GetDirectory(nsILocalFile* *aResult) +nsToolkitProfileLock::GetDirectory(nsIFile* *aResult) { if (!mDirectory) { NS_ERROR("Not initialized, or unlocked!"); @@ -319,7 +319,7 @@ nsToolkitProfileLock::GetDirectory(nsILocalFile* *aResult) } NS_IMETHODIMP -nsToolkitProfileLock::GetLocalDirectory(nsILocalFile* *aResult) +nsToolkitProfileLock::GetLocalDirectory(nsIFile* *aResult) { if (!mLocalDirectory) { NS_ERROR("Not initialized, or unlocked!"); @@ -442,7 +442,7 @@ nsToolkitProfileService::Init() continue; } - nsCOMPtr rootDir; + nsCOMPtr rootDir; rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(rootDir)); NS_ENSURE_SUCCESS(rv, rv); @@ -454,7 +454,7 @@ nsToolkitProfileService::Init() } if (NS_FAILED(rv)) continue; - nsCOMPtr localDir; + nsCOMPtr localDir; if (isRelative) { rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(localDir)); @@ -581,15 +581,15 @@ nsToolkitProfileService::GetProfileByName(const nsACString& aName, } NS_IMETHODIMP -nsToolkitProfileService::LockProfilePath(nsILocalFile* aDirectory, - nsILocalFile* aLocalDirectory, +nsToolkitProfileService::LockProfilePath(nsIFile* aDirectory, + nsIFile* aLocalDirectory, nsIProfileLock* *aResult) { return NS_LockProfilePath(aDirectory, aLocalDirectory, nsnull, aResult); } nsresult -NS_LockProfilePath(nsILocalFile* aPath, nsILocalFile* aTempPath, +NS_LockProfilePath(nsIFile* aPath, nsIFile* aTempPath, nsIProfileUnlocker* *aUnlocker, nsIProfileLock* *aResult) { nsCOMPtr lock = new nsToolkitProfileLock(); @@ -634,7 +634,7 @@ nsToolkitProfileService::CreateDefaultProfileForApp(const nsACString& aProfileNa nsIToolkitProfile** aResult) { NS_ENSURE_STATE(!aProfileName.IsEmpty() || !aAppName.IsEmpty()); - nsCOMPtr appData; + nsCOMPtr appData; nsresult rv = gDirServiceProvider->GetUserDataDirectory(getter_AddRefs(appData), false, @@ -660,7 +660,7 @@ nsToolkitProfileService::CreateDefaultProfileForApp(const nsACString& aProfileNa NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_STATE(*aResult); - nsCOMPtr rootDir; + nsCOMPtr rootDir; (*aResult)->GetRootDir(getter_AddRefs(rootDir)); NS_ENSURE_SUCCESS(rv, rv); @@ -694,8 +694,8 @@ nsToolkitProfileService::CreateDefaultProfileForApp(const nsACString& aProfileNa } NS_IMETHODIMP -nsToolkitProfileService::CreateProfile(nsILocalFile* aRootDir, - nsILocalFile* aLocalDir, +nsToolkitProfileService::CreateProfile(nsIFile* aRootDir, + nsIFile* aLocalDir, const nsACString& aName, nsIToolkitProfile** aResult) { @@ -704,8 +704,8 @@ nsToolkitProfileService::CreateProfile(nsILocalFile* aRootDir, } nsresult -nsToolkitProfileService::CreateProfileInternal(nsILocalFile* aRootDir, - nsILocalFile* aLocalDir, +nsToolkitProfileService::CreateProfileInternal(nsIFile* aRootDir, + nsIFile* aLocalDir, const nsACString& aName, const nsACString* aProfileName, const nsACString* aAppName, @@ -723,7 +723,7 @@ nsToolkitProfileService::CreateProfileInternal(nsILocalFile* aRootDir, } } - nsCOMPtr rootDir (aRootDir); + nsCOMPtr rootDir (aRootDir); nsCAutoString dirName; if (!rootDir) { @@ -746,7 +746,7 @@ nsToolkitProfileService::CreateProfileInternal(nsILocalFile* aRootDir, } } - nsCOMPtr localDir (aLocalDir); + nsCOMPtr localDir (aLocalDir); if (!localDir) { if (aRootDir) { @@ -985,7 +985,7 @@ NS_NewToolkitProfileService(nsIToolkitProfileService* *aResult) } nsresult -XRE_GetFileFromPath(const char *aPath, nsILocalFile* *aResult) +XRE_GetFileFromPath(const char *aPath, nsIFile* *aResult) { #if defined(XP_MACOSX) PRInt32 pathLen = strlen(aPath); @@ -998,7 +998,7 @@ XRE_GetFileFromPath(const char *aPath, nsILocalFile* *aResult) if (!fullPath) return NS_ERROR_FAILURE; - nsCOMPtr lf; + nsCOMPtr lf; nsresult rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(lf)); if (NS_SUCCEEDED(rv)) { diff --git a/toolkit/xre/ProfileReset.cpp b/toolkit/xre/ProfileReset.cpp index c9940986c6c..f05e9047231 100644 --- a/toolkit/xre/ProfileReset.cpp +++ b/toolkit/xre/ProfileReset.cpp @@ -5,7 +5,7 @@ #include "nsIAppStartup.h" #include "nsIDOMWindow.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIStringBundle.h" #include "nsIToolkitProfile.h" #include "nsIWindowWatcher.h" @@ -59,11 +59,11 @@ nsresult ProfileResetCleanup(nsIToolkitProfile* aOldProfile) { nsresult rv; - nsCOMPtr profileDir; + nsCOMPtr profileDir; rv = aOldProfile->GetRootDir(getter_AddRefs(profileDir)); if (NS_FAILED(rv)) return rv; - nsCOMPtr profileLocalDir; + nsCOMPtr profileLocalDir; rv = aOldProfile->GetLocalDir(getter_AddRefs(profileLocalDir)); if (NS_FAILED(rv)) return rv; diff --git a/toolkit/xre/ProfileReset.h b/toolkit/xre/ProfileReset.h index 8c10a5d3670..1c47a03ce3b 100644 --- a/toolkit/xre/ProfileReset.h +++ b/toolkit/xre/ProfileReset.h @@ -37,7 +37,7 @@ private: class ProfileResetCleanupAsyncTask : public nsRunnable { public: - ProfileResetCleanupAsyncTask(nsILocalFile* aProfileDir, nsILocalFile* aProfileLocalDir, + ProfileResetCleanupAsyncTask(nsIFile* aProfileDir, nsIFile* aProfileLocalDir, nsIFile* aDesktop, const nsAString &aLeafName) : mProfileDir(aProfileDir) , mProfileLocalDir(aProfileLocalDir) @@ -73,8 +73,8 @@ public: } private: - nsCOMPtr mProfileDir; - nsCOMPtr mProfileLocalDir; + nsCOMPtr mProfileDir; + nsCOMPtr mProfileLocalDir; nsCOMPtr mDesktop; nsAutoString mLeafName; }; diff --git a/toolkit/xre/nsAndroidStartup.cpp b/toolkit/xre/nsAndroidStartup.cpp index 5987059f5d3..ae989c49a0d 100644 --- a/toolkit/xre/nsAndroidStartup.cpp +++ b/toolkit/xre/nsAndroidStartup.cpp @@ -13,7 +13,7 @@ #include "nsTArray.h" #include "nsString.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsAppRunner.h" #include "AndroidBridge.h" #include "APKOpen.h" diff --git a/toolkit/xre/nsAppData.cpp b/toolkit/xre/nsAppData.cpp index 7ba57bccb0a..437079c8da8 100644 --- a/toolkit/xre/nsAppData.cpp +++ b/toolkit/xre/nsAppData.cpp @@ -4,7 +4,7 @@ #include "nsXULAppAPI.h" #include "nsINIParser.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsAppRunner.h" #include "nsCRTGlue.h" #include "nsAutoPtr.h" @@ -76,7 +76,7 @@ ScopedAppData::~ScopedAppData() NS_IF_RELEASE(this->directory); - SetStrongPtr(this->xreDirectory, (nsILocalFile*) nsnull); + SetStrongPtr(this->xreDirectory, (nsIFile*) nsnull); SetAllocatedString(this->minVersion, nsnull); SetAllocatedString(this->maxVersion, nsnull); @@ -85,7 +85,7 @@ ScopedAppData::~ScopedAppData() } nsresult -XRE_CreateAppData(nsILocalFile* aINIFile, nsXREAppData **aAppData) +XRE_CreateAppData(nsIFile* aINIFile, nsXREAppData **aAppData) { NS_ENSURE_ARG(aINIFile && aAppData); @@ -162,7 +162,7 @@ ReadFlags(nsINIParser &parser, const ReadFlag *reads, PRUint32 *buffer) } nsresult -XRE_ParseAppData(nsILocalFile* aINIFile, nsXREAppData *aAppData) +XRE_ParseAppData(nsIFile* aINIFile, nsXREAppData *aAppData) { NS_ENSURE_ARG(aINIFile && aAppData); diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 565f4e0407b..9bb6715b15c 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -273,11 +273,11 @@ SaveFileToEnv(const char *name, nsIFile *file) } // Load the path of a file saved with SaveFileToEnv -static already_AddRefed +static already_AddRefed GetFileFromEnv(const char *name) { nsresult rv; - nsILocalFile *file = nsnull; + nsIFile *file = nsnull; #ifdef XP_WIN WCHAR path[_MAX_PATH]; @@ -782,9 +782,8 @@ nsXULAppInfo::InvalidateCachesOnRestart() file->AppendNative(FILE_COMPATIBILITY_INFO); - nsCOMPtr localFile(do_QueryInterface(file)); nsINIParser parser; - rv = parser.Init(localFile); + rv = parser.Init(file); if (NS_FAILED(rv)) { // This fails if compatibility.ini is not there, so we'll // flush the caches on the next restart anyways. @@ -796,7 +795,7 @@ nsXULAppInfo::InvalidateCachesOnRestart() if (NS_FAILED(rv)) { PRFileDesc *fd = nsnull; - localFile->OpenNSPRFileDesc(PR_RDWR | PR_APPEND, 0600, &fd); + file->OpenNSPRFileDesc(PR_RDWR | PR_APPEND, 0600, &fd); if (!fd) { NS_ERROR("could not create output stream"); return NS_ERROR_NOT_AVAILABLE; @@ -883,7 +882,7 @@ nsXULAppInfo::SetEnabled(bool aEnabled) // no point in erroring for double-enabling return NS_OK; - nsCOMPtr xreDirectory; + nsCOMPtr xreDirectory; if (gAppData) { xreDirectory = gAppData->xreDirectory; } @@ -953,7 +952,7 @@ nsXULAppInfo::SetServerURL(nsIURL* aServerURL) } NS_IMETHODIMP -nsXULAppInfo::GetMinidumpPath(nsILocalFile** aMinidumpPath) +nsXULAppInfo::GetMinidumpPath(nsIFile** aMinidumpPath) { if (!CrashReporter::GetEnabled()) return NS_ERROR_NOT_INITIALIZED; @@ -968,7 +967,7 @@ nsXULAppInfo::GetMinidumpPath(nsILocalFile** aMinidumpPath) } NS_IMETHODIMP -nsXULAppInfo::SetMinidumpPath(nsILocalFile* aMinidumpPath) +nsXULAppInfo::SetMinidumpPath(nsIFile* aMinidumpPath) { nsAutoString path; nsresult rv = aMinidumpPath->GetPath(path); @@ -1464,13 +1463,13 @@ RemoteCommandLine(const char* aDesktopStartupID) #endif // MOZ_ENABLE_XREMOTE void -XRE_InitOmnijar(nsILocalFile* greOmni, nsILocalFile* appOmni) +XRE_InitOmnijar(nsIFile* greOmni, nsIFile* appOmni) { mozilla::Omnijar::Init(greOmni, appOmni); } nsresult -XRE_GetBinaryPath(const char* argv0, nsILocalFile* *aResult) +XRE_GetBinaryPath(const char* argv0, nsIFile* *aResult) { return mozilla::BinaryPath::GetFile(argv0, aResult); } @@ -1608,7 +1607,7 @@ static nsresult LaunchChild(nsINativeAppSupport* aNative, restartMode = gRestartMode; LaunchChildMac(gRestartArgc, gRestartArgv, restartMode); #else - nsCOMPtr lf; + nsCOMPtr lf; nsresult rv = XRE_GetBinaryPath(gArgv[0], getter_AddRefs(lf)); if (NS_FAILED(rv)) return rv; @@ -1659,7 +1658,7 @@ static const char kProfileProperties[] = "chrome://mozapps/locale/profile/profileSelection.properties"; static nsresult -ProfileLockedDialog(nsILocalFile* aProfileDir, nsILocalFile* aProfileLocalDir, +ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir, nsIProfileUnlocker* aUnlocker, nsINativeAppSupport* aNative, nsIProfileLock* *aResult) { @@ -1792,11 +1791,11 @@ static nsresult ProfileLockedDialog(nsIToolkitProfile* aProfile, nsIProfileUnlocker* aUnlocker, nsINativeAppSupport* aNative, nsIProfileLock* *aResult) { - nsCOMPtr profileDir; + nsCOMPtr profileDir; nsresult rv = aProfile->GetRootDir(getter_AddRefs(profileDir)); if (NS_FAILED(rv)) return rv; - nsCOMPtr profileLocalDir; + nsCOMPtr profileLocalDir; rv = aProfile->GetLocalDir(getter_AddRefs(profileLocalDir)); if (NS_FAILED(rv)) return rv; @@ -1819,7 +1818,7 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc, { nsresult rv; - nsCOMPtr profD, profLD; + nsCOMPtr profD, profLD; PRUnichar* profileNamePtr; nsCAutoString profileName; @@ -1907,13 +1906,13 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc, static nsresult GetCurrentProfileIsDefault(nsIToolkitProfileService* aProfileSvc, - nsILocalFile* aCurrentProfileRoot, bool *aResult) + nsIFile* aCurrentProfileRoot, bool *aResult) { nsresult rv; // Check that the profile to reset is the default since reset and the associated migration are // only supported in that case. nsCOMPtr selectedProfile; - nsCOMPtr selectedProfileRoot; + nsCOMPtr selectedProfileRoot; rv = aProfileSvc->GetSelectedProfile(getter_AddRefs(selectedProfile)); NS_ENSURE_SUCCESS(rv, rv); @@ -1936,7 +1935,7 @@ GetCurrentProfileIsDefault(nsIToolkitProfileService* aProfileSvc, */ static nsresult SetCurrentProfileAsDefault(nsIToolkitProfileService* aProfileSvc, - nsILocalFile* aCurrentProfileRoot) + nsIFile* aCurrentProfileRoot) { NS_ENSURE_ARG_POINTER(aProfileSvc); @@ -1949,7 +1948,7 @@ SetCurrentProfileAsDefault(nsIToolkitProfileService* aProfileSvc, nsCOMPtr profile; rv = profiles->GetNext(getter_AddRefs(profile)); while (NS_SUCCEEDED(rv)) { - nsCOMPtr profileRoot; + nsCOMPtr profileRoot; profile->GetRootDir(getter_AddRefs(profileRoot)); profileRoot->Equals(aCurrentProfileRoot, &foundMatchingProfile); if (foundMatchingProfile && profile) { @@ -2016,9 +2015,9 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n gDoMigration = true; } - nsCOMPtr lf = GetFileFromEnv("XRE_PROFILE_PATH"); + nsCOMPtr lf = GetFileFromEnv("XRE_PROFILE_PATH"); if (lf) { - nsCOMPtr localDir = + nsCOMPtr localDir = GetFileFromEnv("XRE_PROFILE_LOCAL_PATH"); if (!localDir) { localDir = lf; @@ -2080,7 +2079,7 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n gDoProfileReset = false; } - nsCOMPtr lf; + nsCOMPtr lf; rv = XRE_GetFileFromPath(arg, getter_AddRefs(lf)); NS_ENSURE_SUCCESS(rv, rv); @@ -2113,7 +2112,7 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n const char* delim = strchr(arg, ' '); if (delim) { - nsCOMPtr lf; + nsCOMPtr lf; rv = NS_NewNativeLocalFile(nsDependentCString(delim + 1), true, getter_AddRefs(lf)); if (NS_FAILED(rv)) { @@ -2139,7 +2138,7 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n // XXXben need to ensure prefs.js exists here so the tinderboxes will // not go orange. - nsCOMPtr prefsJSFile; + nsCOMPtr prefsJSFile; profile->GetRootDir(getter_AddRefs(prefsJSFile)); prefsJSFile->AppendNative(NS_LITERAL_CSTRING("prefs.js")); nsCAutoString pathStr; @@ -2281,7 +2280,7 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n static bool CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion, const nsCString& aOSABI, nsIFile* aXULRunnerDir, - nsIFile* aAppDir, nsILocalFile* aFlagFile, + nsIFile* aAppDir, nsIFile* aFlagFile, bool* aCachesOK) { *aCachesOK = false; @@ -2292,8 +2291,7 @@ CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion, file->AppendNative(FILE_COMPATIBILITY_INFO); nsINIParser parser; - nsCOMPtr localFile(do_QueryInterface(file)); - nsresult rv = parser.Init(localFile); + nsresult rv = parser.Init(file); if (NS_FAILED(rv)) return false; @@ -2310,7 +2308,7 @@ CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion, if (NS_FAILED(rv)) return false; - nsCOMPtr lf; + nsCOMPtr lf; rv = NS_NewNativeLocalFile(buf, false, getter_AddRefs(lf)); if (NS_FAILED(rv)) @@ -2369,8 +2367,6 @@ WriteVersion(nsIFile* aProfileDir, const nsCString& aVersion, return; file->AppendNative(FILE_COMPATIBILITY_INFO); - nsCOMPtr lf = do_QueryInterface(file); - nsCAutoString platformDir; aXULRunnerDir->GetNativePath(platformDir); @@ -2379,7 +2375,7 @@ WriteVersion(nsIFile* aProfileDir, const nsCString& aVersion, aAppDir->GetNativePath(appDir); PRFileDesc *fd = nsnull; - lf->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd); + file->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd); if (!fd) { NS_ERROR("could not create output stream"); return; @@ -2732,8 +2728,8 @@ public: nsCOMPtr mNativeApp; nsCOMPtr mProfileSvc; - nsCOMPtr mProfD; - nsCOMPtr mProfLD; + nsCOMPtr mProfD; + nsCOMPtr mProfLD; nsCOMPtr mProfileLock; #ifdef MOZ_ENABLE_XREMOTE nsCOMPtr mRemoteService; @@ -2862,7 +2858,7 @@ XREMain::XRE_mainInit(const nsXREAppData* aAppData, bool* aExitFlag) return 1; } else if (ar == ARG_FOUND) { - nsCOMPtr overrideLF; + nsCOMPtr overrideLF; rv = XRE_GetFileFromPath(override, getter_AddRefs(overrideLF)); if (NS_FAILED(rv)) { Output(true, "Error: unrecognized override.ini path.\n"); @@ -2892,7 +2888,7 @@ XREMain::XRE_mainInit(const nsXREAppData* aAppData, bool* aExitFlag) // XRE_mainInit. if (!mAppData->xreDirectory) { - nsCOMPtr lf; + nsCOMPtr lf; rv = XRE_GetBinaryPath(gArgv[0], getter_AddRefs(lf)); if (NS_FAILED(rv)) return 2; @@ -2971,7 +2967,7 @@ XREMain::XRE_mainInit(const nsXREAppData* aAppData, bool* aExitFlag) CrashReporter::SetRestartArgs(gArgc, gArgv); // annotate other data (user id etc) - nsCOMPtr userAppDataDir; + nsCOMPtr userAppDataDir; if (NS_SUCCEEDED(mDirProvider.GetUserAppDataDirectory( getter_AddRefs(userAppDataDir)))) { CrashReporter::SetupExtraData(userAppDataDir, @@ -3452,7 +3448,7 @@ XREMain::XRE_mainStartup(bool* aExitFlag) // If we see .purgecaches, that means someone did a make. // Re-register components to catch potential changes. // We only offer this in debug builds, though. - nsCOMPtr flagFile; + nsCOMPtr flagFile; rv = NS_ERROR_FILE_NOT_FOUND; nsCOMPtr fFlagFile; @@ -3610,8 +3606,7 @@ XREMain::XRE_mainRun() mDirProvider.GetAppDir()->Clone(getter_AddRefs(file)); file->AppendNative(NS_LITERAL_CSTRING("override.ini")); nsINIParser parser; - nsCOMPtr localFile(do_QueryInterface(file)); - nsresult rv = parser.Init(localFile); + nsresult rv = parser.Init(file); if (NS_SUCCEEDED(rv)) { nsCAutoString buf; rv = parser.GetString("XRE", "EnableProfileMigrator", buf); @@ -3952,7 +3947,7 @@ XRE_InitCommandLine(int aArgc, char* aArgv[]) char** canonArgs = new char*[aArgc]; // get the canonical version of the binary's path - nsCOMPtr binFile; + nsCOMPtr binFile; rv = XRE_GetBinaryPath(aArgv[0], getter_AddRefs(binFile)); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; @@ -3988,7 +3983,7 @@ XRE_InitCommandLine(int aArgc, char* aArgv[]) if (!path) return rv; - nsCOMPtr greOmni; + nsCOMPtr greOmni; rv = XRE_GetFileFromPath(path, getter_AddRefs(greOmni)); if (NS_FAILED(rv)) { PR_fprintf(PR_STDERR, "Error: argument -greomni requires a valid path\n"); @@ -4001,7 +3996,7 @@ XRE_InitCommandLine(int aArgc, char* aArgv[]) return NS_ERROR_FAILURE; } - nsCOMPtr appOmni; + nsCOMPtr appOmni; if (path) { rv = XRE_GetFileFromPath(path, getter_AddRefs(appOmni)); if (NS_FAILED(rv)) { diff --git a/toolkit/xre/nsAppRunner.h b/toolkit/xre/nsAppRunner.h index 256b674da9d..a969da251a5 100644 --- a/toolkit/xre/nsAppRunner.h +++ b/toolkit/xre/nsAppRunner.h @@ -39,7 +39,7 @@ class nsINativeAppSupport; class nsICmdLineService; class nsXREDirProvider; class nsIToolkitProfileService; -class nsILocalFile; +class nsIFile; class nsIProfileLock; class nsIProfileUnlocker; class nsIFactory; @@ -89,7 +89,7 @@ NS_NewToolkitProfileFactory(nsIFactory* *aResult); * directory cannot be unlocked. */ NS_HIDDEN_(nsresult) -NS_LockProfilePath(nsILocalFile* aPath, nsILocalFile* aTempPath, +NS_LockProfilePath(nsIFile* aPath, nsIFile* aTempPath, nsIProfileUnlocker* *aUnlocker, nsIProfileLock* *aResult); NS_HIDDEN_(void) diff --git a/toolkit/xre/nsConsoleWriter.cpp b/toolkit/xre/nsConsoleWriter.cpp index 944a3ad7d19..6b36f0b86bb 100644 --- a/toolkit/xre/nsConsoleWriter.cpp +++ b/toolkit/xre/nsConsoleWriter.cpp @@ -27,7 +27,7 @@ WriteConsoleLog() { nsresult rv; - nsCOMPtr lfile; + nsCOMPtr lfile; char* logFileEnv = PR_GetEnv("XRE_CONSOLE_LOG"); if (logFileEnv && *logFileEnv) { diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 2ca9f9597b9..e0bc47abbf8 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -20,7 +20,7 @@ #include "nsIAppShell.h" #include "nsIAppStartupNotifier.h" #include "nsIDirectoryService.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIToolkitChromeRegistry.h" #include "nsIToolkitProfile.h" @@ -110,7 +110,7 @@ static const PRUnichar kShellLibraryName[] = L"shell32.dll"; #endif nsresult -XRE_LockProfileDirectory(nsILocalFile* aDirectory, +XRE_LockProfileDirectory(nsIFile* aDirectory, nsISupports* *aLockObject) { nsCOMPtr lock; @@ -126,8 +126,8 @@ XRE_LockProfileDirectory(nsILocalFile* aDirectory, static PRInt32 sInitCounter; nsresult -XRE_InitEmbedding2(nsILocalFile *aLibXULDirectory, - nsILocalFile *aAppDirectory, +XRE_InitEmbedding2(nsIFile *aLibXULDirectory, + nsIFile *aAppDirectory, nsIDirectoryServiceProvider *aAppDirProvider) { // Initialize some globals to make nsXREDirProvider happy @@ -226,7 +226,7 @@ GeckoProcessType sChildProcessType = GeckoProcessType_Default; // IPDL wants access to this crashreporter interface, and // crashreporter is built in such a way to make that awkward bool -XRE_TakeMinidumpForChild(PRUint32 aChildPid, nsILocalFile** aDump) +XRE_TakeMinidumpForChild(PRUint32 aChildPid, nsIFile** aDump) { return CrashReporter::TakeMinidumpForChild(aChildPid, aDump); } diff --git a/toolkit/xre/nsNativeAppSupportOS2.cpp b/toolkit/xre/nsNativeAppSupportOS2.cpp index 02885444299..ab899f0ca52 100644 --- a/toolkit/xre/nsNativeAppSupportOS2.cpp +++ b/toolkit/xre/nsNativeAppSupportOS2.cpp @@ -699,7 +699,7 @@ struct MessageWindow { COPYDATASTRUCT *cds = (COPYDATASTRUCT*)lp; DosGetSharedMem( (PVOID)cds, PAG_READ|PAG_WRITE ); - nsCOMPtr workingDir; + nsCOMPtr workingDir; // a "1" or greater indicates that the other process's working // directory follows the commandline string - locate & convert it diff --git a/toolkit/xre/nsNativeAppSupportWin.cpp b/toolkit/xre/nsNativeAppSupportWin.cpp index cdd8735c563..761de1b9499 100644 --- a/toolkit/xre/nsNativeAppSupportWin.cpp +++ b/toolkit/xre/nsNativeAppSupportWin.cpp @@ -577,7 +577,7 @@ struct MessageWindow { #if MOZ_DEBUG_DDE printf( "Incoming request: %s\n", (const char*)cds->lpData ); #endif - nsCOMPtr workingDir; + nsCOMPtr workingDir; if (1 >= cds->dwData) { char* wdpath = (char*) cds->lpData; diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index 13911a159cd..d738a98779e 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -9,7 +9,7 @@ #include "nsUpdateDriver.h" #include "nsXULAppAPI.h" #include "nsAppRunner.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsCOMPtr.h" #include "nsString.h" #include "prproces.h" @@ -113,7 +113,7 @@ GetCurrentWorkingDir(char *buf, size_t size) // gBinaryPath check removed so that the updater can reload the stub executable // instead of xulrunner-bin. See bug 349737. static nsresult -GetXULRunnerStubPath(const char* argv0, nsILocalFile* *aResult) +GetXULRunnerStubPath(const char* argv0, nsIFile* *aResult) { // Works even if we're not bundled. CFBundleRef appBundle = ::CFBundleGetMainBundle(); @@ -132,13 +132,13 @@ GetXULRunnerStubPath(const char* argv0, nsILocalFile* *aResult) if (NS_FAILED(rv)) return rv; - NS_ADDREF(*aResult = static_cast(lfm.get())); + NS_ADDREF(*aResult = static_cast(lfm.get())); return NS_OK; } #endif /* XP_MACOSX */ static bool -GetFile(nsIFile *dir, const nsCSubstring &name, nsCOMPtr &result) +GetFile(nsIFile *dir, const nsCSubstring &name, nsCOMPtr &result) { nsresult rv; @@ -156,7 +156,7 @@ GetFile(nsIFile *dir, const nsCSubstring &name, nsCOMPtr &result) } static bool -GetStatusFile(nsIFile *dir, nsCOMPtr &result) +GetStatusFile(nsIFile *dir, nsCOMPtr &result) { return GetFile(dir, NS_LITERAL_CSTRING("update.status"), result); } @@ -171,7 +171,7 @@ GetStatusFile(nsIFile *dir, nsCOMPtr &result) */ template static bool -GetStatusFileContents(nsILocalFile *statusFile, char (&buf)[Size]) +GetStatusFileContents(nsIFile *statusFile, char (&buf)[Size]) { // The buffer needs to be large enough to hold the known status codes PR_STATIC_ASSERT(Size > 16); @@ -204,7 +204,7 @@ typedef enum { * @return the update action to be performed. */ static UpdateStatus -GetUpdateStatus(nsIFile* dir, nsCOMPtr &statusFile) +GetUpdateStatus(nsIFile* dir, nsCOMPtr &statusFile) { if (GetStatusFile(dir, statusFile)) { char buf[32]; @@ -231,7 +231,7 @@ GetUpdateStatus(nsIFile* dir, nsCOMPtr &statusFile) } static bool -GetVersionFile(nsIFile *dir, nsCOMPtr &result) +GetVersionFile(nsIFile *dir, nsCOMPtr &result) { return GetFile(dir, NS_LITERAL_CSTRING("update.version"), result); } @@ -239,7 +239,7 @@ GetVersionFile(nsIFile *dir, nsCOMPtr &result) // Compares the current application version with the update's application // version. static bool -IsOlderVersion(nsILocalFile *versionFile, const char *appVersion) +IsOlderVersion(nsIFile *versionFile, const char *appVersion) { PRFileDesc *fd = nsnull; nsresult rv = versionFile->OpenNSPRFileDesc(PR_RDONLY, 0660, &fd); @@ -345,7 +345,7 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir, * @param appArgv the args to the application, used for restarting if needed */ static void -SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, nsILocalFile *statusFile, +SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile, nsIFile *appDir, int appArgc, char **appArgv) { nsresult rv; @@ -354,7 +354,7 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, nsILocalFile *statusFile // - copy updater into temp dir // - run updater with the correct arguments - nsCOMPtr tmpDir; + nsCOMPtr tmpDir; GetSpecialSystemDirectory(OS_TemporaryDirectory, getter_AddRefs(tmpDir)); if (!tmpDir) { @@ -377,7 +377,7 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, nsILocalFile *statusFile // We need to use the value returned from XRE_GetBinaryPath when attempting // to restart the running application. - nsCOMPtr appFile; + nsCOMPtr appFile; #if defined(XP_MACOSX) // On OS X we need to pass the location of the xulrunner-stub executable @@ -421,7 +421,7 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, nsILocalFile *statusFile // to apply the update to the Updated.app directory under the Foo.app // directory which is the parent of the parent of the appDir. On other // platforms we will just apply to the appDir/updated. - nsCOMPtr updatedDir; + nsCOMPtr updatedDir; #if defined(XP_MACOSX) nsCAutoString applyToDir; { @@ -554,7 +554,7 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, nsILocalFile *statusFile * background updates. */ static void -ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsILocalFile *statusFile, +ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile, nsIFile *appDir, int appArgc, char **appArgv, bool restart, ProcessType *outpid) { @@ -573,7 +573,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsILocalFile *statusFile, // We need to use the value returned from XRE_GetBinaryPath when attempting // to restart the running application. - nsCOMPtr appFile; + nsCOMPtr appFile; #if defined(XP_MACOSX) // On OS X we need to pass the location of the xulrunner-stub executable @@ -617,7 +617,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsILocalFile *statusFile, // to apply the update to the Updated.app directory under the Foo.app // directory which is the parent of the parent of the appDir. On other // platforms we will just apply to the appDir/updated. - nsCOMPtr updatedDir; + nsCOMPtr updatedDir; #if defined(XP_MACOSX) nsCAutoString applyToDir; { @@ -802,7 +802,7 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir, // Enable the tests to request us to use a different update root directory const char *updRootOverride = PR_GetEnv("MOZ_UPDATE_ROOT_OVERRIDE"); if (updRootOverride && *updRootOverride) { - nsCOMPtr overrideDir; + nsCOMPtr overrideDir; nsCAutoString path(updRootOverride); rv = NS_NewNativeLocalFile(path, false, getter_AddRefs(overrideDir)); if (NS_FAILED(rv)) { @@ -813,7 +813,7 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir, // Enable the tests to request us to use a different app directory const char *appDirOverride = PR_GetEnv("MOZ_UPDATE_APPDIR_OVERRIDE"); if (appDirOverride && *appDirOverride) { - nsCOMPtr overrideDir; + nsCOMPtr overrideDir; nsCAutoString path(appDirOverride); rv = NS_NewNativeLocalFile(path, false, getter_AddRefs(overrideDir)); if (NS_FAILED(rv)) { @@ -829,12 +829,12 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir, } } - nsCOMPtr statusFile; + nsCOMPtr statusFile; UpdateStatus status = GetUpdateStatus(updatesDir, statusFile); switch (status) { case ePendingUpdate: case ePendingService: { - nsCOMPtr versionFile; + nsCOMPtr versionFile; // Remove the update if the update application version file doesn't exist // or if the update's application version is less than the current // application version. diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index 2e21b1efa5d..2279efb692b 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -12,7 +12,7 @@ #include "nsIJSRuntimeService.h" #include "nsIAppStartup.h" #include "nsIDirectoryEnumerator.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIObserver.h" #include "nsIObserverService.h" #include "nsIProfileChangeStatus.h" @@ -63,14 +63,13 @@ #define PREF_OVERRIDE_DIRNAME "preferences" -static already_AddRefed +static already_AddRefed CloneAndAppend(nsIFile* aFile, const char* name) { nsCOMPtr file; aFile->Clone(getter_AddRefs(file)); - nsCOMPtr lfile = do_QueryInterface(file); - lfile->AppendNative(nsDependentCString(name)); - return lfile.forget(); + file->AppendNative(nsDependentCString(name)); + return file.forget(); } nsXREDirProvider* gDirServiceProvider = nsnull; @@ -94,7 +93,7 @@ nsXREDirProvider::GetSingleton() nsresult nsXREDirProvider::Initialize(nsIFile *aXULAppDir, - nsILocalFile *aGREDir, + nsIFile *aGREDir, nsIDirectoryServiceProvider* aAppProvider) { NS_ENSURE_ARG(aXULAppDir); @@ -162,8 +161,7 @@ nsXREDirProvider::GetUserProfilesRootDir(nsIFile** aResult, const nsACString* aVendorName) { nsCOMPtr file; - nsresult rv = GetUserDataDirectory((nsILocalFile**)(nsIFile**) - getter_AddRefs(file), + nsresult rv = GetUserDataDirectory(getter_AddRefs(file), false, aProfileName, aAppName, aVendorName); @@ -185,8 +183,7 @@ nsXREDirProvider::GetUserProfilesLocalDir(nsIFile** aResult, const nsACString* aVendorName) { nsCOMPtr file; - nsresult rv = GetUserDataDirectory((nsILocalFile**)(nsIFile**) - getter_AddRefs(file), + nsresult rv = GetUserDataDirectory(getter_AddRefs(file), true, aProfileName, aAppName, aVendorName); @@ -275,7 +272,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, } else if (!strcmp(aProperty, NS_APP_APPLICATION_REGISTRY_DIR) || !strcmp(aProperty, XRE_USER_APP_DATA_DIR)) { - rv = GetUserAppDataDirectory((nsILocalFile**)(nsIFile**) getter_AddRefs(file)); + rv = GetUserAppDataDirectory(getter_AddRefs(file)); } else if (!strcmp(aProperty, XRE_UPDATE_ROOT_DIR)) { #if defined(XP_WIN) @@ -286,7 +283,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, #endif } else if (!strcmp(aProperty, NS_APP_APPLICATION_REGISTRY_FILE)) { - rv = GetUserAppDataDirectory((nsILocalFile**)(nsIFile**) getter_AddRefs(file)); + rv = GetUserAppDataDirectory(getter_AddRefs(file)); if (NS_SUCCEEDED(rv)) rv = file->AppendNative(NS_LITERAL_CSTRING(APP_REGISTRY_NAME)); } @@ -297,7 +294,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, rv = GetUserProfilesLocalDir(getter_AddRefs(file), nsnull, nsnull, nsnull); } else if (!strcmp(aProperty, XRE_EXECUTABLE_FILE) && gArgv[0]) { - nsCOMPtr lf; + nsCOMPtr lf; rv = XRE_GetBinaryPath(gArgv[0], getter_AddRefs(lf)); if (NS_SUCCEEDED(rv)) file = lf; @@ -320,7 +317,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, #if defined(XP_UNIX) || defined(XP_MACOSX) else if (!strcmp(aProperty, XRE_SYS_LOCAL_EXTENSION_PARENT_DIR)) { #ifdef ENABLE_SYSTEM_EXTENSION_DIRS - return GetSystemExtensionsDirectory((nsILocalFile**)(nsIFile**) aFile); + return GetSystemExtensionsDirectory(aFile); #else return NS_ERROR_FAILURE; #endif @@ -331,7 +328,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, #ifdef ENABLE_SYSTEM_EXTENSION_DIRS static const char *const sysLExtDir = "/usr/share/mozilla/extensions"; return NS_NewNativeLocalFile(nsDependentCString(sysLExtDir), - false, (nsILocalFile**)(nsIFile**) aFile); + false, aFile); #else return NS_ERROR_FAILURE; #endif @@ -339,7 +336,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, #endif else if (!strcmp(aProperty, XRE_USER_SYS_EXTENSION_DIR)) { #ifdef ENABLE_SYSTEM_EXTENSION_DIRS - return GetSysUserExtensionsDirectory((nsILocalFile**)(nsIFile**) aFile); + return GetSysUserExtensionsDirectory(aFile); #else return NS_ERROR_FAILURE; #endif @@ -524,7 +521,7 @@ LoadExtensionDirectories(nsINIParser &parser, if (NS_FAILED(rv)) return; - nsCOMPtr dir = do_CreateInstance("@mozilla.org/file/local;1", &rv); + nsCOMPtr dir = do_CreateInstance("@mozilla.org/file/local;1", &rv); if (NS_FAILED(rv)) continue; @@ -537,7 +534,7 @@ LoadExtensionDirectories(nsINIParser &parser, XRE_AddJarManifestLocation(aType, dir); } else { - nsCOMPtr manifest = + nsCOMPtr manifest = CloneAndAppend(dir, "chrome.manifest"); XRE_AddManifestLocation(aType, manifest); } @@ -556,7 +553,7 @@ nsXREDirProvider::LoadExtensionBundleDirectories() extensionsINI->AppendNative(NS_LITERAL_CSTRING("extensions.ini")); - nsCOMPtr extensionsINILF = + nsCOMPtr extensionsINILF = do_QueryInterface(extensionsINI); if (!extensionsINILF) return; @@ -597,7 +594,7 @@ nsXREDirProvider::LoadAppBundleDirs() while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(subdir))) && subdir) { mAppBundleDirectories.AppendObject(subdir); - nsCOMPtr manifest = + nsCOMPtr manifest = CloneAndAppend(subdir, "chrome.manifest"); XRE_AddManifestLocation(NS_COMPONENT_LOCATION, manifest); } @@ -984,7 +981,7 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult) programName.AssignASCII(MOZ_APP_NAME); } - nsCOMPtr updRoot; + nsCOMPtr updRoot; rv = GetUserLocalDataDirectory(getter_AddRefs(updRoot)); NS_ENSURE_SUCCESS(rv, rv); @@ -1039,11 +1036,11 @@ nsXREDirProvider::GetProfileDir(nsIFile* *aResult) } nsresult -nsXREDirProvider::GetUserDataDirectoryHome(nsILocalFile** aFile, bool aLocal) +nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal) { // Copied from nsAppFileLocationProvider (more or less) nsresult rv; - nsCOMPtr localDir; + nsCOMPtr localDir; #if defined(XP_MACOSX) FSRef fsRef; @@ -1130,9 +1127,9 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsILocalFile** aFile, bool aLocal) } nsresult -nsXREDirProvider::GetSysUserExtensionsDirectory(nsILocalFile** aFile) +nsXREDirProvider::GetSysUserExtensionsDirectory(nsIFile** aFile) { - nsCOMPtr localDir; + nsCOMPtr localDir; nsresult rv = GetUserDataDirectoryHome(getter_AddRefs(localDir), false); NS_ENSURE_SUCCESS(rv, rv); @@ -1148,10 +1145,10 @@ nsXREDirProvider::GetSysUserExtensionsDirectory(nsILocalFile** aFile) #if defined(XP_UNIX) || defined(XP_MACOSX) nsresult -nsXREDirProvider::GetSystemExtensionsDirectory(nsILocalFile** aFile) +nsXREDirProvider::GetSystemExtensionsDirectory(nsIFile** aFile) { nsresult rv; - nsCOMPtr localDir; + nsCOMPtr localDir; #if defined(XP_MACOSX) FSRef fsRef; OSErr err = ::FSFindFolder(kOnSystemDisk, kApplicationSupportFolderType, kCreateFolder, &fsRef); @@ -1194,12 +1191,12 @@ nsXREDirProvider::GetSystemExtensionsDirectory(nsILocalFile** aFile) #endif nsresult -nsXREDirProvider::GetUserDataDirectory(nsILocalFile** aFile, bool aLocal, +nsXREDirProvider::GetUserDataDirectory(nsIFile** aFile, bool aLocal, const nsACString* aProfileName, const nsACString* aAppName, const nsACString* aVendorName) { - nsCOMPtr localDir; + nsCOMPtr localDir; nsresult rv = GetUserDataDirectoryHome(getter_AddRefs(localDir), aLocal); NS_ENSURE_SUCCESS(rv, rv); diff --git a/toolkit/xre/nsXREDirProvider.h b/toolkit/xre/nsXREDirProvider.h index 062941bb7e1..98006708f63 100644 --- a/toolkit/xre/nsXREDirProvider.h +++ b/toolkit/xre/nsXREDirProvider.h @@ -8,7 +8,7 @@ #include "nsIDirectoryService.h" #include "nsIProfileMigrator.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsCOMPtr.h" #include "nsCOMArray.h" @@ -30,7 +30,7 @@ public: // if aXULAppDir is null, use gArgv[0] nsresult Initialize(nsIFile *aXULAppDir, - nsILocalFile *aGREDir, + nsIFile *aGREDir, nsIDirectoryServiceProvider* aAppProvider = nsnull); ~nsXREDirProvider(); @@ -55,16 +55,16 @@ public: nsresult GetProfileDefaultsDir(nsIFile* *aResult); - static nsresult GetUserAppDataDirectory(nsILocalFile* *aFile) { + static nsresult GetUserAppDataDirectory(nsIFile* *aFile) { return GetUserDataDirectory(aFile, false, nsnull, nsnull, nsnull); } - static nsresult GetUserLocalDataDirectory(nsILocalFile* *aFile) { + static nsresult GetUserLocalDataDirectory(nsIFile* *aFile) { return GetUserDataDirectory(aFile, true, nsnull, nsnull, nsnull); } // By default GetUserDataDirectory gets profile path from gAppData, // but that can be overridden by using aProfileName/aAppName/aVendorName. - static nsresult GetUserDataDirectory(nsILocalFile** aFile, bool aLocal, + static nsresult GetUserDataDirectory(nsIFile** aFile, bool aLocal, const nsACString* aProfileName, const nsACString* aAppName, const nsACString* aVendorName); @@ -100,10 +100,10 @@ public: protected: nsresult GetFilesInternal(const char* aProperty, nsISimpleEnumerator** aResult); - static nsresult GetUserDataDirectoryHome(nsILocalFile* *aFile, bool aLocal); - static nsresult GetSysUserExtensionsDirectory(nsILocalFile* *aFile); + static nsresult GetUserDataDirectoryHome(nsIFile* *aFile, bool aLocal); + static nsresult GetSysUserExtensionsDirectory(nsIFile* *aFile); #if defined(XP_UNIX) || defined(XP_MACOSX) - static nsresult GetSystemExtensionsDirectory(nsILocalFile** aFile); + static nsresult GetSystemExtensionsDirectory(nsIFile** aFile); #endif static nsresult EnsureDirectoryExists(nsIFile* aDirectory); void EnsureProfileFileExists(nsIFile* aFile); @@ -130,7 +130,7 @@ protected: void Append(nsIFile* aDirectory); nsCOMPtr mAppProvider; - nsCOMPtr mGREDir; + nsCOMPtr mGREDir; nsCOMPtr mXULAppDir; nsCOMPtr mProfileDir; nsCOMPtr mProfileLocalDir; diff --git a/uriloader/base/nsITransfer.idl b/uriloader/base/nsITransfer.idl index 29ea3abbc1a..e949d5e19ba 100644 --- a/uriloader/base/nsITransfer.idl +++ b/uriloader/base/nsITransfer.idl @@ -8,7 +8,7 @@ interface nsIURI; interface nsICancelable; interface nsIMIMEInfo; -interface nsILocalFile; +interface nsIFile; [scriptable, uuid(3a982955-dc44-422e-8734-8462bf8d2121)] interface nsITransfer : nsIWebProgressListener2 { @@ -50,7 +50,7 @@ interface nsITransfer : nsIWebProgressListener2 { in AString aDisplayName, in nsIMIMEInfo aMIMEInfo, in PRTime startTime, - in nsILocalFile aTempFile, + in nsIFile aTempFile, in nsICancelable aCancelable); }; diff --git a/uriloader/exthandler/mac/nsMIMEInfoMac.mm b/uriloader/exthandler/mac/nsMIMEInfoMac.mm index 7e8f840913d..718f584cb34 100644 --- a/uriloader/exthandler/mac/nsMIMEInfoMac.mm +++ b/uriloader/exthandler/mac/nsMIMEInfoMac.mm @@ -78,8 +78,7 @@ nsMIMEInfoMac::LaunchWithFile(nsIFile *aFile) return NS_ERROR_FAILURE; } } - nsCOMPtr localFile = do_QueryInterface(aFile); - return app->LaunchWithDoc(localFile, false); + return app->LaunchWithDoc(aFile, false); NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; } diff --git a/uriloader/exthandler/mac/nsOSHelperAppService.h b/uriloader/exthandler/mac/nsOSHelperAppService.h index f31c9d673bb..62d36e6e6d5 100644 --- a/uriloader/exthandler/mac/nsOSHelperAppService.h +++ b/uriloader/exthandler/mac/nsOSHelperAppService.h @@ -42,7 +42,7 @@ public: bool * aHandlerExists); protected: - virtual void FixFilePermissions(nsILocalFile* aFile); + virtual void FixFilePermissions(nsIFile* aFile); private: PRUint32 mPermissions; diff --git a/uriloader/exthandler/mac/nsOSHelperAppService.mm b/uriloader/exthandler/mac/nsOSHelperAppService.mm index 602cce58dfb..ec5f498da20 100644 --- a/uriloader/exthandler/mac/nsOSHelperAppService.mm +++ b/uriloader/exthandler/mac/nsOSHelperAppService.mm @@ -13,7 +13,7 @@ #include "nsTArray.h" #include "nsXPIDLString.h" #include "nsIURL.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsILocalFileMac.h" #include "nsMimeTypes.h" #include "nsIStringBundle.h" @@ -567,7 +567,7 @@ nsOSHelperAppService::GetProtocolHandlerInfoFromOS(const nsACString &aScheme, } void -nsOSHelperAppService::FixFilePermissions(nsILocalFile* aFile) +nsOSHelperAppService::FixFilePermissions(nsIFile* aFile) { aFile->SetPermissions(mPermissions); } diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 660ff7b426b..c1b35205402 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -299,7 +299,7 @@ static nsresult GetDownloadDirectory(nsIFile **_directory) case NS_FOLDER_VALUE_CUSTOM: { Preferences::GetComplex(NS_PREF_DOWNLOAD_DIR, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(dir)); if (!dir) break; @@ -334,7 +334,7 @@ static nsresult GetDownloadDirectory(nsIFile **_directory) char* downloadDir = getenv("DOWNLOADS_DIRECTORY"); nsresult rv; if (downloadDir) { - nsCOMPtr ldir; + nsCOMPtr ldir; rv = NS_NewNativeLocalFile(nsDependentCString(downloadDir), true, getter_AddRefs(ldir)); NS_ENSURE_SUCCESS(rv, rv); @@ -756,7 +756,7 @@ nsresult nsExternalHelperAppService::GetFileTokenForPath(const PRUnichar * aPlat { nsDependentString platformAppPath(aPlatformAppPath); // First, check if we have an absolute path - nsILocalFile* localFile = nsnull; + nsIFile* localFile = nsnull; nsresult rv = NS_NewLocalFile(platformAppPath, true, &localFile); if (NS_SUCCEEDED(rv)) { *aFile = localFile; @@ -927,30 +927,28 @@ NS_IMETHODIMP nsExternalHelperAppService::DeleteTemporaryFileOnExit(nsIFile * aT { nsresult rv = NS_OK; bool isFile = false; - nsCOMPtr localFile (do_QueryInterface(aTemporaryFile, &rv)); - NS_ENSURE_SUCCESS(rv, rv); // as a safety measure, make sure the nsIFile is really a file and not a directory object. - localFile->IsFile(&isFile); + aTemporaryFile->IsFile(&isFile); if (!isFile) return NS_OK; if (mInPrivateBrowsing) - mTemporaryPrivateFilesList.AppendObject(localFile); + mTemporaryPrivateFilesList.AppendObject(aTemporaryFile); else - mTemporaryFilesList.AppendObject(localFile); + mTemporaryFilesList.AppendObject(aTemporaryFile); return NS_OK; } -void nsExternalHelperAppService::FixFilePermissions(nsILocalFile* aFile) +void nsExternalHelperAppService::FixFilePermissions(nsIFile* aFile) { // This space intentionally left blank } -void nsExternalHelperAppService::ExpungeTemporaryFilesHelper(nsCOMArray &fileList) +void nsExternalHelperAppService::ExpungeTemporaryFilesHelper(nsCOMArray &fileList) { PRInt32 numEntries = fileList.Count(); - nsILocalFile* localFile; + nsIFile* localFile; for (PRInt32 index = 0; index < numEntries; index++) { localFile = fileList[index]; @@ -1874,8 +1872,7 @@ nsresult nsExternalAppHandler::ExecuteDesiredAction() } else if(action == nsIMIMEInfo::saveToDisk) { - nsCOMPtr destfile(do_QueryInterface(mFinalFileDestination)); - mExtProtSvc->FixFilePermissions(destfile); + mExtProtSvc->FixFilePermissions(mFinalFileDestination); } } @@ -1927,9 +1924,8 @@ nsresult nsExternalAppHandler::InitializeDownload(nsITransfer* aTransfer) rv = NS_NewFileURI(getter_AddRefs(target), mFinalFileDestination); if (NS_FAILED(rv)) return rv; - nsCOMPtr lf(do_QueryInterface(mTempFile)); rv = aTransfer->Init(mSourceUrl, target, EmptyString(), - mMimeInfo, mTimeDownloadStarted, lf, this); + mMimeInfo, mTimeDownloadStarted, mTempFile, this); if (NS_FAILED(rv)) return rv; // Now let's add the download to history @@ -1978,7 +1974,7 @@ nsresult nsExternalAppHandler::CreateProgressListener() return rv; } -nsresult nsExternalAppHandler::PromptForSaveToFile(nsILocalFile ** aNewFile, const nsAFlatString &aDefaultFile, const nsAFlatString &aFileExtension) +nsresult nsExternalAppHandler::PromptForSaveToFile(nsIFile ** aNewFile, const nsAFlatString &aDefaultFile, const nsAFlatString &aFileExtension) { // invoke the dialog!!!!! use mWindowContext as the window context parameter for the dialog request // Convert to use file picker? No, then embeddors could not do any sort of @@ -2014,10 +2010,8 @@ nsresult nsExternalAppHandler::MoveFile(nsIFile * aNewFileLocation) nsresult rv = NS_OK; NS_ASSERTION(mStopRequestIssued, "uhoh, how did we get here if we aren't done getting data?"); - nsCOMPtr fileToUse = do_QueryInterface(aNewFileLocation); - // if the on stop request was actually issued then it's now time to actually perform the file move.... - if (mStopRequestIssued && fileToUse) + if (mStopRequestIssued && aNewFileLocation) { // Unfortunately, MoveTo will fail if a file already exists at the user specified location.... // but the user has told us, this is where they want the file! (when we threw up the save to file dialog, @@ -2025,16 +2019,16 @@ nsresult nsExternalAppHandler::MoveFile(nsIFile * aNewFileLocation) // fileToUse if it already exists. bool equalToTempFile = false; bool filetoUseAlreadyExists = false; - fileToUse->Equals(mTempFile, &equalToTempFile); - fileToUse->Exists(&filetoUseAlreadyExists); + aNewFileLocation->Equals(mTempFile, &equalToTempFile); + aNewFileLocation->Exists(&filetoUseAlreadyExists); if (filetoUseAlreadyExists && !equalToTempFile) - fileToUse->Remove(false); + aNewFileLocation->Remove(false); // extract the new leaf name from the file location nsAutoString fileName; - fileToUse->GetLeafName(fileName); + aNewFileLocation->GetLeafName(fileName); nsCOMPtr directoryLocation; - rv = fileToUse->GetParent(getter_AddRefs(directoryLocation)); + rv = aNewFileLocation->GetParent(getter_AddRefs(directoryLocation)); if (directoryLocation) { rv = mTempFile->MoveTo(directoryLocation, fileName); @@ -2043,7 +2037,7 @@ nsresult nsExternalAppHandler::MoveFile(nsIFile * aNewFileLocation) { // Send error notification. nsAutoString path; - fileToUse->GetPath(path); + aNewFileLocation->GetPath(path); SendStatusChange(kWriteError, rv, nsnull, path); Cancel(rv); // Cancel (and clean up temp file). } @@ -2051,7 +2045,7 @@ nsresult nsExternalAppHandler::MoveFile(nsIFile * aNewFileLocation) else { // tag the file with its source URI - nsCOMPtr localFileOS2 = do_QueryInterface(fileToUse); + nsCOMPtr localFileOS2 = do_QueryInterface(aNewFileLocation); if (localFileOS2) { nsCAutoString url; @@ -2084,7 +2078,7 @@ NS_IMETHODIMP nsExternalAppHandler::SaveToDisk(nsIFile * aNewFileLocation, bool // The helper app dialog has told us what to do. mReceivedDispositionInfo = true; - nsCOMPtr fileToUse = do_QueryInterface(aNewFileLocation); + nsCOMPtr fileToUse = do_QueryInterface(aNewFileLocation); if (!fileToUse) { nsAutoString leafName; diff --git a/uriloader/exthandler/nsExternalHelperAppService.h b/uriloader/exthandler/nsExternalHelperAppService.h index 9c69480d325..6fb43776502 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.h +++ b/uriloader/exthandler/nsExternalHelperAppService.h @@ -26,7 +26,6 @@ #include "nsString.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" -#include "nsILocalFile.h" #include "nsIChannel.h" #include "nsITimer.h" @@ -153,7 +152,7 @@ protected: * implementation, subclasses can use this to correctly inherit ACLs from the * parent directory, to make the permissions obey the umask, etc. */ - virtual void FixFilePermissions(nsILocalFile* aFile); + virtual void FixFilePermissions(nsIFile* aFile); #ifdef PR_LOGGING /** @@ -171,7 +170,7 @@ protected: /** * Helper function for ExpungeTemporaryFiles and ExpungeTemporaryPrivateFiles */ - static void ExpungeTemporaryFilesHelper(nsCOMArray &fileList); + static void ExpungeTemporaryFilesHelper(nsCOMArray &fileList); /** * Functions related to the tempory file cleanup service provided by * nsExternalHelperAppService @@ -186,12 +185,12 @@ protected: /** * Array for the files that should be deleted */ - nsCOMArray mTemporaryFilesList; + nsCOMArray mTemporaryFilesList; /** * Array for the files that should be deleted (for the temporary files * added during the private browsing mode) */ - nsCOMArray mTemporaryPrivateFilesList; + nsCOMArray mTemporaryPrivateFilesList; /** * Whether we are in private browsing mode */ @@ -337,7 +336,7 @@ protected: * what's going on... */ nsresult CreateProgressListener(); - nsresult PromptForSaveToFile(nsILocalFile ** aNewFile, + nsresult PromptForSaveToFile(nsIFile ** aNewFile, const nsAFlatString &aDefaultFile, const nsAFlatString &aDefaultFileExt); diff --git a/uriloader/exthandler/nsIHelperAppLauncherDialog.idl b/uriloader/exthandler/nsIHelperAppLauncherDialog.idl index 92e9606c269..d896facae6d 100644 --- a/uriloader/exthandler/nsIHelperAppLauncherDialog.idl +++ b/uriloader/exthandler/nsIHelperAppLauncherDialog.idl @@ -6,7 +6,7 @@ #include "nsISupports.idl" interface nsIHelperAppLauncher; -interface nsILocalFile; +interface nsIFile; /** * This interface is used to display a confirmation dialog before @@ -59,7 +59,7 @@ interface nsIHelperAppLauncherDialog : nsISupports { /** * Invoke a save-to-file dialog instead of the full fledged helper app dialog. - * Returns the a nsILocalFile for the file name/location selected. + * Returns the a nsIFile for the file name/location selected. * * @param aLauncher * A nsIHelperAppLauncher to be invoked when a file is selected. @@ -74,11 +74,11 @@ interface nsIHelperAppLauncherDialog : nsISupports { * name/location, otherwise perferences may control if the user is * prompted. */ - nsILocalFile promptForSaveToFile(in nsIHelperAppLauncher aLauncher, - in nsISupports aWindowContext, - in wstring aDefaultFileName, - in wstring aSuggestedFileExtension, - in boolean aForcePrompt); + nsIFile promptForSaveToFile(in nsIHelperAppLauncher aLauncher, + in nsISupports aWindowContext, + in wstring aDefaultFileName, + in wstring aSuggestedFileExtension, + in boolean aForcePrompt); }; diff --git a/uriloader/exthandler/nsMIMEInfoImpl.cpp b/uriloader/exthandler/nsMIMEInfoImpl.cpp index 57c6de2a7b1..2113fcfd9bc 100644 --- a/uriloader/exthandler/nsMIMEInfoImpl.cpp +++ b/uriloader/exthandler/nsMIMEInfoImpl.cpp @@ -8,7 +8,7 @@ #include "nsXPIDLString.h" #include "nsReadableUtils.h" #include "nsStringEnumerator.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIFileURL.h" #include "nsEscape.h" #include "nsNetUtil.h" @@ -260,7 +260,7 @@ nsMIMEInfoBase::SetAlwaysAskBeforeHandling(bool aAlwaysAsk) /* static */ nsresult -nsMIMEInfoBase::GetLocalFileFromURI(nsIURI *aURI, nsILocalFile **aFile) +nsMIMEInfoBase::GetLocalFileFromURI(nsIURI *aURI, nsIFile **aFile) { nsresult rv; diff --git a/uriloader/exthandler/nsMIMEInfoImpl.h b/uriloader/exthandler/nsMIMEInfoImpl.h index 49260b2d584..0a8e152b76d 100644 --- a/uriloader/exthandler/nsMIMEInfoImpl.h +++ b/uriloader/exthandler/nsMIMEInfoImpl.h @@ -126,13 +126,13 @@ class nsMIMEInfoBase : public nsIMIMEInfo { const nsString &aArg); /** - * Given a file: nsIURI, return the associated nsILocalFile + * Given a file: nsIURI, return the associated nsIFile * * @param aURI the file: URI in question - * @param aFile the associated nsILocalFile (out param) + * @param aFile the associated nsIFile (out param) */ static NS_HIDDEN_(nsresult) GetLocalFileFromURI(nsIURI *aURI, - nsILocalFile **aFile); + nsIFile **aFile); // member variables nsTArray mExtensions; ///< array of file extensions associated w/ this MIME obj diff --git a/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp b/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp index 985dfb2d2e3..764bbb2b4c3 100644 --- a/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp +++ b/uriloader/exthandler/os2/nsMIMEInfoOS2.cpp @@ -471,7 +471,7 @@ nsresult nsMIMEInfoOS2::LoadUriInternal(nsIURI *aURL) #endif PRInt32 numParams = 1; - nsCOMPtr application; + nsCOMPtr application; rv = NS_NewNativeLocalFile(nsDependentCString(applicationName.get()), false, getter_AddRefs(application)); if (NS_FAILED(rv)) { /* Maybe they didn't qualify the name - search path */ diff --git a/uriloader/exthandler/os2/nsOSHelperAppService.cpp b/uriloader/exthandler/os2/nsOSHelperAppService.cpp index 96e041de303..47f9ded638f 100644 --- a/uriloader/exthandler/os2/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/os2/nsOSHelperAppService.cpp @@ -13,7 +13,7 @@ #include "nsIURL.h" #include "nsIFileStreams.h" #include "nsILineInputStream.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIProcess.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" @@ -192,7 +192,7 @@ nsOSHelperAppService::GetFileLocation(const char* aPrefName, // natural way to do the charset conversion is by just initing // an nsIFile with the native path and asking it for the Unicode // version. - nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); + nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); NS_ENSURE_SUCCESS(rv, rv); rv = file->InitWithNativePath(nsDependentCString(prefValue)); @@ -270,7 +270,7 @@ nsOSHelperAppService::CreateInputStream(const nsAString& aFilename, LOG(("-- CreateInputStream")); nsresult rv = NS_OK; - nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); + nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; rv = file->InitWithPath(aFilename); @@ -900,7 +900,7 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a nsresult rv = NS_OK; bool more = false; - nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); + nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; rv = file->InitWithPath(aFilename); @@ -1594,7 +1594,7 @@ nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsASt } - nsCOMPtr application; + nsCOMPtr application; rv = NS_NewNativeLocalFile(nsDependentCString(applicationName.get()), false, getter_AddRefs(application)); diff --git a/uriloader/exthandler/unix/nsGNOMERegistry.cpp b/uriloader/exthandler/unix/nsGNOMERegistry.cpp index 2e67e8d6ac2..dfaf9439da8 100644 --- a/uriloader/exthandler/unix/nsGNOMERegistry.cpp +++ b/uriloader/exthandler/unix/nsGNOMERegistry.cpp @@ -8,7 +8,7 @@ #include "prmem.h" #include "nsString.h" #include "nsIComponentManager.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsMIMEInfoUnix.h" #include "nsAutoPtr.h" #include "nsIGConfService.h" diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp index bdacccbeeea..e5b6124d211 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp @@ -25,7 +25,7 @@ #include "nsIURL.h" #include "nsIFileStreams.h" #include "nsILineInputStream.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIProcess.h" #include "nsNetCID.h" #include "nsXPCOM.h" @@ -201,7 +201,7 @@ nsOSHelperAppService::GetFileLocation(const char* aPrefName, // an nsIFile with the native path and asking it for the Unicode // version. nsresult rv; - nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); + nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); NS_ENSURE_SUCCESS(rv, rv); rv = file->InitWithNativePath(nsDependentCString(prefValue)); @@ -271,7 +271,7 @@ nsOSHelperAppService::CreateInputStream(const nsAString& aFilename, LOG(("-- CreateInputStream")); nsresult rv = NS_OK; - nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); + nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; rv = file->InitWithPath(aFilename); @@ -947,7 +947,7 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a nsresult rv = NS_OK; bool more = false; - nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); + nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; rv = file->InitWithPath(aFilename); @@ -1088,7 +1088,7 @@ nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a nsCOMPtr process = do_CreateInstance(NS_PROCESS_CONTRACTID, &rv); if (NS_FAILED(rv)) continue; - nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); + nsCOMPtr file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); if (NS_FAILED(rv)) continue; rv = file->InitWithNativePath(NS_LITERAL_CSTRING("/bin/sh")); @@ -1203,7 +1203,7 @@ nsresult nsOSHelperAppService::GetFileTokenForPath(const PRUnichar * platformApp // If we get here, we really should have a relative path. NS_ASSERTION(*platformAppPath != PRUnichar('/'), "Unexpected absolute path"); - nsCOMPtr localFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); + nsCOMPtr localFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); if (!localFile) return NS_ERROR_NOT_INITIALIZED; @@ -1579,7 +1579,7 @@ nsOSHelperAppService::GetProtocolHandlerInfoFromOS(const nsACString &aScheme, } void -nsOSHelperAppService::FixFilePermissions(nsILocalFile* aFile) +nsOSHelperAppService::FixFilePermissions(nsIFile* aFile) { aFile->SetPermissions(mPermissions); } diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.h b/uriloader/exthandler/unix/nsOSHelperAppService.h index f96b121867e..657f53529ab 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.h +++ b/uriloader/exthandler/unix/nsOSHelperAppService.h @@ -47,7 +47,7 @@ protected: already_AddRefed GetFromType(const nsCString& aMimeType); already_AddRefed GetFromExtension(const nsCString& aFileExt); - virtual void FixFilePermissions(nsILocalFile* aFile); + virtual void FixFilePermissions(nsIFile* aFile); private: PRUint32 mPermissions; diff --git a/uriloader/exthandler/win/nsMIMEInfoWin.cpp b/uriloader/exthandler/win/nsMIMEInfoWin.cpp index 513ea9f699f..1c36e0a1a7d 100644 --- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp +++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp @@ -6,7 +6,7 @@ #include "nsArrayEnumerator.h" #include "nsCOMArray.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIVariant.h" #include "nsMIMEInfoWin.h" #include "nsNetUtil.h" @@ -36,16 +36,12 @@ nsresult nsMIMEInfoWin::LaunchDefaultWithFile(nsIFile* aFile) { // Launch the file, unless it is an executable. - nsCOMPtr local(do_QueryInterface(aFile)); - if (!local) - return NS_ERROR_FAILURE; - bool executable = true; - local->IsExecutable(&executable); + aFile->IsExecutable(&executable); if (executable) return NS_ERROR_FAILURE; - return local->Launch(); + return aFile->Launch(); } NS_IMETHODIMP @@ -88,9 +84,7 @@ nsMIMEInfoWin::LaunchWithFile(nsIFile* aFile) // executable is rundll32, everything else is a list of parameters, // including the dll handler. - nsCOMPtr locFile(do_QueryInterface(aFile)); - - if (!GetDllLaunchInfo(executable, locFile, args, false)) + if (!GetDllLaunchInfo(executable, aFile, args, false)) return NS_ERROR_INVALID_ARG; WCHAR rundll32Path[MAX_PATH + sizeof(RUNDLL32_EXE) / sizeof(WCHAR) + 1] = {L'\0'}; @@ -284,7 +278,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) bool nsMIMEInfoWin::GetLocalHandlerApp(const nsAString& aCommandHandler, nsCOMPtr& aApp) { - nsCOMPtr locfile; + nsCOMPtr locfile; nsresult rv = NS_NewLocalFile(aCommandHandler, true, getter_AddRefs(locfile)); if (NS_FAILED(rv)) @@ -368,19 +362,15 @@ bool nsMIMEInfoWin::GetAppsVerbCommandHandler(const nsAString& appExeName, // back to the full handler path based on the dll. // (dll, targetfile, return args, open/edit) bool nsMIMEInfoWin::GetDllLaunchInfo(nsIFile * aDll, - nsILocalFile * aFile, + nsIFile * aFile, nsAString& args, bool edit) { if (!aDll || !aFile) return false; - nsCOMPtr localDll(do_QueryInterface(aDll)); - if (!localDll) - return false; - nsString appExeName; - localDll->GetLeafName(appExeName); + aDll->GetLeafName(appExeName); nsCOMPtr appKey = do_CreateInstance("@mozilla.org/windows-registry-key;1"); diff --git a/uriloader/exthandler/win/nsMIMEInfoWin.h b/uriloader/exthandler/win/nsMIMEInfoWin.h index 7f7d6c6fc0e..525e06d5b55 100644 --- a/uriloader/exthandler/win/nsMIMEInfoWin.h +++ b/uriloader/exthandler/win/nsMIMEInfoWin.h @@ -57,7 +57,7 @@ class nsMIMEInfoWin : public nsMIMEInfoBase, public nsIPropertyBag { // Lookup a rundll command handler and return // a populated command template for use with rundll32.exe. bool GetDllLaunchInfo(nsIFile * aDll, - nsILocalFile * aFile, + nsIFile * aFile, nsAString& args, bool bEdit); // Helper routine used in tracking app lists diff --git a/uriloader/exthandler/win/nsOSHelperAppService.cpp b/uriloader/exthandler/win/nsOSHelperAppService.cpp index ab7c77f818b..702495c31e5 100644 --- a/uriloader/exthandler/win/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/win/nsOSHelperAppService.cpp @@ -440,7 +440,7 @@ nsOSHelperAppService::GetDefaultAppInfo(const nsAString& aAppInfo, // There are some rare cases this can happen - ["url.dll" -foo] // for example won't resolve correctly to the system dir. The // subsequent launch of the helper app will work though. - nsCOMPtr lf; + nsCOMPtr lf; NS_NewLocalFile(handlerCommand, true, getter_AddRefs(lf)); if (!lf) return NS_ERROR_FILE_NOT_FOUND; diff --git a/uriloader/prefetch/OfflineCacheUpdateChild.cpp b/uriloader/prefetch/OfflineCacheUpdateChild.cpp index e3e670a152d..c68b2f37c4c 100644 --- a/uriloader/prefetch/OfflineCacheUpdateChild.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateChild.cpp @@ -179,7 +179,7 @@ NS_IMETHODIMP OfflineCacheUpdateChild::Init(nsIURI *aManifestURI, nsIURI *aDocumentURI, nsIDOMDocument *aDocument, - nsILocalFile *aCustomProfileDir) + nsIFile *aCustomProfileDir) { nsresult rv; diff --git a/uriloader/prefetch/OfflineCacheUpdateGlue.cpp b/uriloader/prefetch/OfflineCacheUpdateGlue.cpp index 49becdf2351..eeb51d2855b 100644 --- a/uriloader/prefetch/OfflineCacheUpdateGlue.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateGlue.cpp @@ -92,7 +92,7 @@ NS_IMETHODIMP OfflineCacheUpdateGlue::Init(nsIURI *aManifestURI, nsIURI *aDocumentURI, nsIDOMDocument *aDocument, - nsILocalFile *aCustomProfileDir) + nsIFile *aCustomProfileDir) { if (!EnsureUpdate()) return NS_ERROR_NULL_POINTER; diff --git a/uriloader/prefetch/OfflineCacheUpdateGlue.h b/uriloader/prefetch/OfflineCacheUpdateGlue.h index 5a5a045563e..079df2c60c5 100644 --- a/uriloader/prefetch/OfflineCacheUpdateGlue.h +++ b/uriloader/prefetch/OfflineCacheUpdateGlue.h @@ -50,7 +50,7 @@ public: NS_SCRIPTABLE NS_IMETHOD Init(nsIURI *aManifestURI, nsIURI *aDocumentURI, nsIDOMDocument *aDocument, - nsILocalFile *aCustomProfileDir); + nsIFile *aCustomProfileDir); NS_DECL_NSIOFFLINECACHEUPDATEOBSERVER diff --git a/uriloader/prefetch/nsIOfflineCacheUpdate.idl b/uriloader/prefetch/nsIOfflineCacheUpdate.idl index efa43b4b10b..35690501e60 100644 --- a/uriloader/prefetch/nsIOfflineCacheUpdate.idl +++ b/uriloader/prefetch/nsIOfflineCacheUpdate.idl @@ -14,7 +14,7 @@ interface nsIOfflineCacheUpdate; interface nsIPrincipal; interface nsIPrefBranch; interface nsIApplicationCache; -interface nsILocalFile; +interface nsIFile; [scriptable, uuid(47360d57-8ef4-4a5d-8865-1a27a739ad1a)] interface nsIOfflineCacheUpdateObserver : nsISupports { @@ -107,7 +107,7 @@ interface nsIOfflineCacheUpdate : nsISupports { * The page that is requesting the update. */ void init(in nsIURI aManifestURI, in nsIURI aDocumentURI, in nsIDOMDocument aDocument, - [optional] in nsILocalFile aCustomProfileDir); + [optional] in nsIFile aCustomProfileDir); /** * Initialize the update for partial processing. @@ -201,7 +201,7 @@ interface nsIOfflineCacheUpdateService : nsISupports { */ nsIOfflineCacheUpdate scheduleCustomProfileUpdate(in nsIURI aManifestURI, in nsIURI aDocumentURI, - in nsILocalFile aProfileDir); + in nsIFile aProfileDir); /** * Schedule a cache update for a manifest when the document finishes diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.cpp b/uriloader/prefetch/nsOfflineCacheUpdate.cpp index 006ee402b7e..6e7473046ad 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp @@ -355,7 +355,7 @@ nsOfflineCacheUpdateItem::OpenChannel(nsOfflineCacheUpdate *aUpdate) rv = cachingChannel->SetCacheForOfflineUse(true); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr cacheDirectory; + nsCOMPtr cacheDirectory; rv = mApplicationCache->GetCacheDirectory(getter_AddRefs(cacheDirectory)); NS_ENSURE_SUCCESS(rv, rv); @@ -515,7 +515,7 @@ nsOfflineCacheUpdateItem::AsyncOnChannelRedirect(nsIChannel *aOldChannel, NS_ENSURE_SUCCESS(rv, rv); } - nsCOMPtr cacheDirectory; + nsCOMPtr cacheDirectory; rv = mApplicationCache->GetCacheDirectory(getter_AddRefs(cacheDirectory)); NS_ENSURE_SUCCESS(rv, rv); @@ -1194,7 +1194,7 @@ nsresult nsOfflineCacheUpdate::Init(nsIURI *aManifestURI, nsIURI *aDocumentURI, nsIDOMDocument *aDocument, - nsILocalFile *aCustomProfileDir) + nsIFile *aCustomProfileDir) { nsresult rv; diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.h b/uriloader/prefetch/nsOfflineCacheUpdate.h index 3efe9690436..3e20dc4b5d2 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.h +++ b/uriloader/prefetch/nsOfflineCacheUpdate.h @@ -257,7 +257,7 @@ private: nsCString mUpdateDomain; nsCOMPtr mManifestURI; nsCOMPtr mDocumentURI; - nsCOMPtr mCustomProfileDir; + nsCOMPtr mCustomProfileDir; nsCString mClientID; nsCOMPtr mApplicationCache; @@ -317,7 +317,7 @@ public: nsIURI *aDocumentURI, nsIDOMDocument *aDocument, nsIDOMWindow* aWindow, - nsILocalFile* aCustomProfileDir, + nsIFile* aCustomProfileDir, nsIOfflineCacheUpdate **aUpdate); virtual nsresult UpdateFinished(nsOfflineCacheUpdate *aUpdate); diff --git a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp index 06cdb372741..6ee50c4df17 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp @@ -436,7 +436,7 @@ nsOfflineCacheUpdateService::Schedule(nsIURI *aManifestURI, nsIURI *aDocumentURI, nsIDOMDocument *aDocument, nsIDOMWindow* aWindow, - nsILocalFile* aCustomProfileDir, + nsIFile* aCustomProfileDir, nsIOfflineCacheUpdate **aUpdate) { nsCOMPtr update; @@ -472,7 +472,7 @@ nsOfflineCacheUpdateService::ScheduleUpdate(nsIURI *aManifestURI, NS_IMETHODIMP nsOfflineCacheUpdateService::ScheduleCustomProfileUpdate(nsIURI *aManifestURI, nsIURI *aDocumentURI, - nsILocalFile *aProfileDir, + nsIFile *aProfileDir, nsIOfflineCacheUpdate **aUpdate) { // The profile directory is mandatory diff --git a/webapprt/linux/webapprt.cpp b/webapprt/linux/webapprt.cpp index 5405a1c872d..78773bd5980 100644 --- a/webapprt/linux/webapprt.cpp +++ b/webapprt/linux/webapprt.cpp @@ -12,7 +12,7 @@ #include // Mozilla headers -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsINIParser.h" #include "nsXPCOMGlue.h" #include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL @@ -147,7 +147,7 @@ bool GRELoadAndLaunch(const char* firefoxDir, const char* profile) snprintf(rtIniPath, MAXPATHLEN, "%s/%s", rtPath, kWEBAPPRT_INI); // Load the runtime's INI from its path - nsCOMPtr rtINI; + nsCOMPtr rtINI; if (NS_FAILED(XRE_GetFileFromPath(rtIniPath, getter_AddRefs(rtINI)))) { ErrorDialog("Couldn't load the runtime INI"); return false; @@ -168,13 +168,13 @@ bool GRELoadAndLaunch(const char* firefoxDir, const char* profile) SetAllocatedString(webShellAppData->profile, profile); - nsCOMPtr directory; + nsCOMPtr directory; if (NS_FAILED(XRE_GetFileFromPath(rtPath, getter_AddRefs(directory)))) { ErrorDialog("Couldn't open runtime directory"); return false; } - nsCOMPtr xreDir; + nsCOMPtr xreDir; if (NS_FAILED(XRE_GetFileFromPath(firefoxDir, getter_AddRefs(xreDir)))) { ErrorDialog("Couldn't open XRE directory"); return false; diff --git a/webapprt/mac/webapprt.mm b/webapprt/mac/webapprt.mm index ed4b3865bb4..ce90f83b973 100644 --- a/webapprt/mac/webapprt.mm +++ b/webapprt/mac/webapprt.mm @@ -26,7 +26,7 @@ #include "nsXULAppAPI.h" #include "nsComponentManagerUtils.h" #include "nsCOMPtr.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsStringGlue.h" const char WEBAPPRT_EXECUTABLE[] = "webapprt-stub"; @@ -229,7 +229,7 @@ main(int argc, char **argv) } // Load the runtime's INI from its path. - nsCOMPtr rtINI; + nsCOMPtr rtINI; if (NS_FAILED(XRE_GetFileFromPath(rtINIPath, getter_AddRefs(rtINI)))) { NSLog(@"Runtime INI path not recognized: '%s'\n", rtINIPath); @throw MakeException(@"Error", @"Incorrect path to base INI file."); @@ -254,13 +254,13 @@ main(int argc, char **argv) NSLog(@"setting app profile: %s", profile); SetAllocatedString(webShellAppData->profile, profile); - nsCOMPtr directory; + nsCOMPtr directory; if (NS_FAILED(XRE_GetFileFromPath(rtDir, getter_AddRefs(directory)))) { NSLog(@"Unable to open app dir"); @throw MakeException(@"Error", @"Unable to open application directory."); } - nsCOMPtr xreDir; + nsCOMPtr xreDir; if (NS_FAILED(XRE_GetFileFromPath(greDir, getter_AddRefs(xreDir)))) { NSLog(@"Unable to open XRE dir"); @throw MakeException(@"Error", @"Unable to open application XRE directory."); diff --git a/webapprt/win/webapprt.cpp b/webapprt/win/webapprt.cpp index b45e62d40b8..6860a5a688d 100644 --- a/webapprt/win/webapprt.cpp +++ b/webapprt/win/webapprt.cpp @@ -12,7 +12,7 @@ #include // Mozilla headers (alphabetical) -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsINIParser.h" #include "nsWindowsWMain.cpp" // we want a wmain entry point #include "nsXPCOMGlue.h" @@ -101,7 +101,7 @@ namespace { : mAppData(NULL) { } nsresult - create(nsILocalFile* aINIFile) + create(nsIFile* aINIFile) { return XRE_CreateAppData(aINIFile, &mAppData); } @@ -274,7 +274,7 @@ namespace { NS_ENSURE_SUCCESS(rv, false); // Load the runtime's INI from its path. - nsCOMPtr rtINI; + nsCOMPtr rtINI; rv = XRE_GetFileFromPath(rtIniPath, getter_AddRefs(rtINI)); NS_ENSURE_SUCCESS(rv, false); @@ -289,11 +289,11 @@ namespace { SetAllocatedString(webShellAppData->profile, profile); SetAllocatedString(webShellAppData->name, profile); - nsCOMPtr directory; + nsCOMPtr directory; rv = XRE_GetFileFromPath(rtPath, getter_AddRefs(directory)); NS_ENSURE_SUCCESS(rv, false); - nsCOMPtr xreDir; + nsCOMPtr xreDir; rv = XRE_GetFileFromPath(greDir, getter_AddRefs(xreDir)); NS_ENSURE_SUCCESS(rv, false); diff --git a/widget/android/AndroidJNI.cpp b/widget/android/AndroidJNI.cpp index 6e9da9573b2..5f236c7bcdc 100644 --- a/widget/android/AndroidJNI.cpp +++ b/widget/android/AndroidJNI.cpp @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/Hal.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsString.h" #include "AndroidBridge.h" diff --git a/widget/android/nsDeviceContextAndroid.cpp b/widget/android/nsDeviceContextAndroid.cpp index 7b79244864f..3c86e1de248 100644 --- a/widget/android/nsDeviceContextAndroid.cpp +++ b/widget/android/nsDeviceContextAndroid.cpp @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsDeviceContextAndroid.h" #include "nsString.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIFileStreams.h" #include "nsAutoPtr.h" #include "gfxPDFSurface.h" @@ -64,7 +64,7 @@ NS_IMETHODIMP nsDeviceContextSpecAndroid::EndDocument() { nsXPIDLString targetPath; - nsCOMPtr destFile; + nsCOMPtr destFile; mPrintSettings->GetToFileName(getter_Copies(targetPath)); nsresult rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(targetPath), diff --git a/widget/android/nsFilePicker.cpp b/widget/android/nsFilePicker.cpp index 65f7b017f60..2b9b10a2bc1 100644 --- a/widget/android/nsFilePicker.cpp +++ b/widget/android/nsFilePicker.cpp @@ -71,16 +71,16 @@ NS_IMETHODIMP nsFilePicker::SetDefaultExtension(const nsAString & aDefaultExtens return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP nsFilePicker::GetDisplayDirectory(nsILocalFile **aDisplayDirectory) +NS_IMETHODIMP nsFilePicker::GetDisplayDirectory(nsIFile **aDisplayDirectory) { return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP nsFilePicker::SetDisplayDirectory(nsILocalFile *aDisplayDirectory) +NS_IMETHODIMP nsFilePicker::SetDisplayDirectory(nsIFile *aDisplayDirectory) { return NS_ERROR_NOT_IMPLEMENTED; } -NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile) +NS_IMETHODIMP nsFilePicker::GetFile(nsIFile **aFile) { NS_ENSURE_ARG_POINTER(aFile); @@ -89,7 +89,7 @@ NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile) return NS_OK; } - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); file->InitWithPath(mFilePath); @@ -103,7 +103,7 @@ NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile) NS_IMETHODIMP nsFilePicker::GetFileURL(nsIURI **aFileURL) { - nsCOMPtr file; + nsCOMPtr file; GetFile(getter_AddRefs(file)); nsCOMPtr uri; diff --git a/widget/android/nsFilePicker.h b/widget/android/nsFilePicker.h index 696134864cc..a210c715825 100644 --- a/widget/android/nsFilePicker.h +++ b/widget/android/nsFilePicker.h @@ -23,10 +23,10 @@ public: NS_IMETHOD SetDefaultString(const nsAString & aDefaultString); NS_IMETHOD GetDefaultExtension(nsAString & aDefaultExtension); NS_IMETHOD SetDefaultExtension(const nsAString & aDefaultExtension); - NS_IMETHOD GetFile(nsILocalFile * *aFile); + NS_IMETHOD GetFile(nsIFile * *aFile); NS_IMETHOD GetFileURL(nsIURI * *aFileURL); - NS_IMETHOD SetDisplayDirectory(nsILocalFile *aDisplayDirectory); - NS_IMETHOD GetDisplayDirectory(nsILocalFile **aDisplayDirectory); + NS_IMETHOD SetDisplayDirectory(nsIFile *aDisplayDirectory); + NS_IMETHOD GetDisplayDirectory(nsIFile **aDisplayDirectory); NS_IMETHOD Show(PRInt16 *aReturn); private: void InitNative(nsIWidget*, const nsAString&, PRInt16) {}; diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 9cbc1e352ca..e7381444969 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -25,7 +25,7 @@ #include "nsIRollupListener.h" #include "nsIViewManager.h" #include "nsIInterfaceRequestor.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsILocalFileMac.h" #include "nsGfxCIID.h" #include "nsIDOMSimpleGestureEvent.h" @@ -4590,7 +4590,7 @@ NSEvent* gLastDragMouseDownEvent = nil; PR_LOG(sCocoaLog, PR_LOG_ALWAYS, ("ChildView namesOfPromisedFilesDroppedAtDestination: entering callback for promised files\n")); - nsCOMPtr targFile; + nsCOMPtr targFile; NS_NewLocalFile(EmptyString(), true, getter_AddRefs(targFile)); nsCOMPtr macLocalFile = do_QueryInterface(targFile); if (!macLocalFile) { @@ -4620,7 +4620,7 @@ NSEvent* gLastDragMouseDownEvent = nil; return nil; } - item->SetTransferData(kFilePromiseDirectoryMime, macLocalFile, sizeof(nsILocalFile*)); + item->SetTransferData(kFilePromiseDirectoryMime, macLocalFile, sizeof(nsIFile*)); // now request the kFilePromiseMime data, which will invoke the data provider // If successful, the returned data is a reference to the resulting file. diff --git a/widget/cocoa/nsClipboard.mm b/widget/cocoa/nsClipboard.mm index dc2d0d68fa5..f681177b24f 100644 --- a/widget/cocoa/nsClipboard.mm +++ b/widget/cocoa/nsClipboard.mm @@ -15,7 +15,7 @@ #include "nsXPIDLString.h" #include "nsPrimitiveHelpers.h" #include "nsMemory.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsStringStream.h" #include "nsDragService.h" #include "nsEscape.h" diff --git a/widget/cocoa/nsDragService.mm b/widget/cocoa/nsDragService.mm index fa36dc6fcff..24e75931c0b 100644 --- a/widget/cocoa/nsDragService.mm +++ b/widget/cocoa/nsDragService.mm @@ -370,7 +370,7 @@ nsDragService::GetData(nsITransferable* aTransferable, PRUint32 aItemIndex) [filePath getCharacters:clipboardDataPtr]; clipboardDataPtr[stringLength] = 0; // null terminate - nsCOMPtr file; + nsCOMPtr file; nsresult rv = NS_NewLocalFile(nsDependentString(clipboardDataPtr), true, getter_AddRefs(file)); free(clipboardDataPtr); if (NS_FAILED(rv)) diff --git a/widget/cocoa/nsFilePicker.h b/widget/cocoa/nsFilePicker.h index 516620645a9..30bfed90fc4 100644 --- a/widget/cocoa/nsFilePicker.h +++ b/widget/cocoa/nsFilePicker.h @@ -10,7 +10,7 @@ #include "nsBaseFilePicker.h" #include "nsString.h" #include "nsIFileChannel.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsCOMArray.h" #include "nsTArray.h" @@ -32,7 +32,7 @@ public: NS_IMETHOD GetFilterIndex(PRInt32 *aFilterIndex); NS_IMETHOD SetFilterIndex(PRInt32 aFilterIndex); NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension); - NS_IMETHOD GetFile(nsILocalFile * *aFile); + NS_IMETHOD GetFile(nsIFile * *aFile); NS_IMETHOD GetFileURL(nsIURI * *aFileURL); NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles); NS_IMETHOD Show(PRInt16 *_retval); @@ -53,9 +53,9 @@ protected: // aFile is an existing but unspecified file. These functions must specify it. // // will return |returnCancel| or |returnOK| as result. - PRInt16 GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, nsCOMArray& outFiles); - PRInt16 GetLocalFolder(const nsString& inTitle, nsILocalFile** outFile); - PRInt16 PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsILocalFile** outFile); + PRInt16 GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, nsCOMArray& outFiles); + PRInt16 GetLocalFolder(const nsString& inTitle, nsIFile** outFile); + PRInt16 PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsIFile** outFile); void SetDialogTitle(const nsString& inTitle, id aDialog); NSString *PanelDefaultDirectory(); @@ -63,7 +63,7 @@ protected: nsString mTitle; PRInt16 mMode; - nsCOMArray mFiles; + nsCOMArray mFiles; nsString mDefault; nsTArray mFilters; diff --git a/widget/cocoa/nsFilePicker.mm b/widget/cocoa/nsFilePicker.mm index cce4020169c..acb35fda6b6 100644 --- a/widget/cocoa/nsFilePicker.mm +++ b/widget/cocoa/nsFilePicker.mm @@ -11,7 +11,7 @@ #include "nsReadableUtils.h" #include "nsNetUtil.h" #include "nsIComponentManager.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsILocalFileMac.h" #include "nsIURL.h" #include "nsArrayEnumerator.h" @@ -210,7 +210,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval) // make this look as much like Carbon nsFilePicker as possible. mFiles.Clear(); - nsCOMPtr theFile; + nsCOMPtr theFile; switch (mMode) { @@ -284,7 +284,7 @@ void UpdatePanelFileTypes(NSOpenPanel* aPanel, NSArray* aFilters) // Use OpenPanel to do a GetFile. Returns |returnOK| if the user presses OK in the dialog. PRInt16 -nsFilePicker::GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, nsCOMArray& outFiles) +nsFilePicker::GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, nsCOMArray& outFiles) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; @@ -367,7 +367,7 @@ nsFilePicker::GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, nsCOM continue; } - nsCOMPtr localFile; + nsCOMPtr localFile; NS_NewLocalFile(EmptyString(), true, getter_AddRefs(localFile)); nsCOMPtr macLocalFile = do_QueryInterface(localFile); if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithCFURL((CFURLRef)url))) { @@ -385,7 +385,7 @@ nsFilePicker::GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, nsCOM // Use OpenPanel to do a GetFolder. Returns |returnOK| if the user presses OK in the dialog. PRInt16 -nsFilePicker::GetLocalFolder(const nsString& inTitle, nsILocalFile** outFile) +nsFilePicker::GetLocalFolder(const nsString& inTitle, nsIFile** outFile) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; NS_ASSERTION(outFile, "this protected member function expects a null initialized out pointer"); @@ -419,7 +419,7 @@ nsFilePicker::GetLocalFolder(const nsString& inTitle, nsILocalFile** outFile) // get the path for the folder (we allow just 1, so that's all we get) NSURL *theURL = [[thePanel URLs] objectAtIndex:0]; if (theURL) { - nsCOMPtr localFile; + nsCOMPtr localFile; NS_NewLocalFile(EmptyString(), true, getter_AddRefs(localFile)); nsCOMPtr macLocalFile = do_QueryInterface(localFile); if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithCFURL((CFURLRef)theURL))) { @@ -436,7 +436,7 @@ nsFilePicker::GetLocalFolder(const nsString& inTitle, nsILocalFile** outFile) // Returns |returnOK| if the user presses OK in the dialog. PRInt16 -nsFilePicker::PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsILocalFile** outFile) +nsFilePicker::PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsIFile** outFile) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; NS_ASSERTION(outFile, "this protected member function expects a null initialized out pointer"); @@ -473,7 +473,7 @@ nsFilePicker::PutLocalFile(const nsString& inTitle, const nsString& inDefaultNam NSURL* fileURL = [thePanel URL]; if (fileURL) { - nsCOMPtr localFile; + nsCOMPtr localFile; NS_NewLocalFile(EmptyString(), true, getter_AddRefs(localFile)); nsCOMPtr macLocalFile = do_QueryInterface(localFile); if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithCFURL((CFURLRef)fileURL))) { @@ -547,7 +547,7 @@ nsFilePicker::SetDialogTitle(const nsString& inTitle, id aPanel) NS_OBJC_END_TRY_ABORT_BLOCK; } -// Converts path from an nsILocalFile into a NSString path +// Converts path from an nsIFile into a NSString path // If it fails, returns an empty string. NSString * nsFilePicker::PanelDefaultDirectory() @@ -565,7 +565,7 @@ nsFilePicker::PanelDefaultDirectory() NS_OBJC_END_TRY_ABORT_BLOCK_NIL; } -NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile) +NS_IMETHODIMP nsFilePicker::GetFile(nsIFile **aFile) { NS_ENSURE_ARG_POINTER(aFile); *aFile = nsnull; diff --git a/widget/gtk2/nsDeviceContextSpecG.cpp b/widget/gtk2/nsDeviceContextSpecG.cpp index 15b9e5adcb3..e53d0435b12 100644 --- a/widget/gtk2/nsDeviceContextSpecG.cpp +++ b/widget/gtk2/nsDeviceContextSpecG.cpp @@ -30,7 +30,7 @@ #include "nsPrintSettingsGTK.h" #include "nsIFileStreams.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsTArray.h" #include "mozilla/Preferences.h" @@ -535,12 +535,12 @@ nsresult nsDeviceContextSpecGTK::GetPrintMethod(const char *aPrinter, PrintMetho static void print_callback(GtkPrintJob *aJob, gpointer aData, GError *aError) { g_object_unref(aJob); - ((nsILocalFile*) aData)->Remove(false); + ((nsIFile*) aData)->Remove(false); } static void ns_release_macro(gpointer aData) { - nsILocalFile* spoolFile = (nsILocalFile*) aData; + nsIFile* spoolFile = (nsIFile*) aData; NS_RELEASE(spoolFile); } @@ -572,7 +572,7 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::EndDocument() } else { // Handle print-to-file ourselves for the benefit of embedders nsXPIDLString targetPath; - nsCOMPtr destFile; + nsCOMPtr destFile; mPrintSettings->GetToFileName(getter_Copies(targetPath)); nsresult rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(targetPath), diff --git a/widget/gtk2/nsDeviceContextSpecG.h b/widget/gtk2/nsDeviceContextSpecG.h index 9ecffe0e4b3..78d3cc9a29f 100644 --- a/widget/gtk2/nsDeviceContextSpecG.h +++ b/widget/gtk2/nsDeviceContextSpecG.h @@ -57,8 +57,8 @@ protected: GtkPrintSettings* mGtkPrintSettings; GtkPageSetup* mGtkPageSetup; - nsCString mSpoolName; - nsCOMPtr mSpoolFile; + nsCString mSpoolName; + nsCOMPtr mSpoolFile; }; diff --git a/widget/gtk2/nsDragService.cpp b/widget/gtk2/nsDragService.cpp index e0ff5d617e2..90ea959566d 100644 --- a/widget/gtk2/nsDragService.cpp +++ b/widget/gtk2/nsDragService.cpp @@ -708,7 +708,7 @@ nsDragService::GetData(nsITransferable * aTransferable, PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = false\n")); // Dragging and dropping from the file manager would cause us - // to parse the source text as a nsILocalFile URL. + // to parse the source text as a nsIFile URL. if ( strcmp(flavorStr, kFileMime) == 0 ) { gdkFlavor = gdk_atom_intern(kTextMime, FALSE); GetTargetDragData(gdkFlavor); @@ -734,7 +734,7 @@ nsDragService::GetData(nsITransferable * aTransferable, // The common wrapping code at the end of // this function assumes the data is text // and calls text-specific operations. - // Make a secret hideout here for nsILocalFile + // Make a secret hideout here for nsIFile // objects and return early. aTransferable->SetTransferData(flavorStr, file, convertedTextLen); diff --git a/widget/gtk2/nsFilePicker.cpp b/widget/gtk2/nsFilePicker.cpp index 371a2866c12..a2ee4030cc1 100644 --- a/widget/gtk2/nsFilePicker.cpp +++ b/widget/gtk2/nsFilePicker.cpp @@ -10,7 +10,7 @@ #include "nsIFileURL.h" #include "nsIURI.h" #include "nsIWidget.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIStringBundle.h" #include "nsArrayEnumerator.h" @@ -33,7 +33,7 @@ using namespace mozilla; #define MAX_PREVIEW_SIZE 180 -nsILocalFile *nsFilePicker::mPrevDisplayDirectory = nsnull; +nsIFile *nsFilePicker::mPrevDisplayDirectory = nsnull; // XXXdholbert -- this function is duplicated in nsPrintDialogGTK.cpp // and needs to be unified in some generic utility class. @@ -188,12 +188,12 @@ nsFilePicker::~nsFilePicker() void ReadMultipleFiles(gpointer filename, gpointer array) { - nsCOMPtr localfile; + nsCOMPtr localfile; nsresult rv = NS_NewNativeLocalFile(nsDependentCString(static_cast(filename)), false, getter_AddRefs(localfile)); if (NS_SUCCEEDED(rv)) { - nsCOMArray& files = *static_cast*>(array); + nsCOMArray& files = *static_cast*>(array); files.AppendObject(localfile); } @@ -224,14 +224,13 @@ nsFilePicker::ReadValuesFromFileChooser(GtkWidget *file_chooser) g_slist_free(filter_list); // Remember last used directory. - nsCOMPtr file; + nsCOMPtr file; GetFile(getter_AddRefs(file)); if (file) { nsCOMPtr dir; file->GetParent(getter_AddRefs(dir)); - nsCOMPtr localDir(do_QueryInterface(dir)); - if (localDir) { - localDir.swap(mPrevDisplayDirectory); + if (dir) { + dir.swap(mPrevDisplayDirectory); } } } @@ -319,7 +318,7 @@ nsFilePicker::SetFilterIndex(PRInt32 aFilterIndex) } NS_IMETHODIMP -nsFilePicker::GetFile(nsILocalFile **aFile) +nsFilePicker::GetFile(nsIFile **aFile) { NS_ENSURE_ARG_POINTER(aFile); @@ -484,7 +483,7 @@ nsFilePicker::Show(PRInt16 *aReturn) ReadValuesFromFileChooser(file_chooser); *aReturn = nsIFilePicker::returnOK; if (mMode == nsIFilePicker::modeSave) { - nsCOMPtr file; + nsCOMPtr file; GetFile(getter_AddRefs(file)); if (file) { bool exists = false; diff --git a/widget/gtk2/nsFilePicker.h b/widget/gtk2/nsFilePicker.h index 96f12b1993d..3348f8c8199 100644 --- a/widget/gtk2/nsFilePicker.h +++ b/widget/gtk2/nsFilePicker.h @@ -14,7 +14,7 @@ #include "nsCOMArray.h" class nsIWidget; -class nsILocalFile; +class nsIFile; class nsFilePicker : public nsBaseFilePicker { @@ -33,7 +33,7 @@ public: NS_IMETHODIMP GetDefaultExtension(nsAString& aExtension); NS_IMETHODIMP GetFilterIndex(PRInt32 *aFilterIndex); NS_IMETHODIMP SetFilterIndex(PRInt32 aFilterIndex); - NS_IMETHODIMP GetFile(nsILocalFile **aFile); + NS_IMETHODIMP GetFile(nsIFile **aFile); NS_IMETHODIMP GetFileURL(nsIURI **aFileURL); NS_IMETHODIMP GetFiles(nsISimpleEnumerator **aFiles); NS_IMETHODIMP Show(PRInt16 *aReturn); @@ -47,7 +47,7 @@ protected: void ReadValuesFromFileChooser(GtkWidget *file_chooser); nsCOMPtr mParentWidget; - nsCOMArray mFiles; + nsCOMArray mFiles; PRInt16 mMode; PRInt16 mSelectedType; @@ -61,7 +61,7 @@ protected: nsTArray mFilterNames; private: - static nsILocalFile *mPrevDisplayDirectory; + static nsIFile *mPrevDisplayDirectory; }; #endif diff --git a/widget/gtk2/nsPrintDialogGTK.cpp b/widget/gtk2/nsPrintDialogGTK.cpp index 2786fd5a6b5..1758801ab90 100644 --- a/widget/gtk2/nsPrintDialogGTK.cpp +++ b/widget/gtk2/nsPrintDialogGTK.cpp @@ -16,7 +16,7 @@ #include "nsPrintSettingsGTK.h" #include "nsString.h" #include "nsReadableUtils.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "nsIStringBundle.h" #include "nsIPrintSettingsService.h" diff --git a/widget/gtk2/nsPrintSettingsGTK.cpp b/widget/gtk2/nsPrintSettingsGTK.cpp index 734298b285c..35680f2982f 100644 --- a/widget/gtk2/nsPrintSettingsGTK.cpp +++ b/widget/gtk2/nsPrintSettingsGTK.cpp @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsPrintSettingsGTK.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include @@ -415,7 +415,7 @@ nsPrintSettingsGTK::SetToFileName(const PRUnichar * aToFileName) gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf"); } - nsCOMPtr file; + nsCOMPtr file; nsresult rv = NS_NewLocalFile(nsDependentString(aToFileName), true, getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/widget/gtk2/nsSound.cpp b/widget/gtk2/nsSound.cpp index 152dd4f2a73..3394690bb12 100644 --- a/widget/gtk2/nsSound.cpp +++ b/widget/gtk2/nsSound.cpp @@ -69,7 +69,7 @@ static ca_proplist_sets_fn ca_proplist_sets; static ca_context_play_full_fn ca_context_play_full; struct ScopedCanberraFile { - ScopedCanberraFile(nsILocalFile *file): mFile(file) {}; + ScopedCanberraFile(nsIFile *file): mFile(file) {}; ~ScopedCanberraFile() { if (mFile) { @@ -80,10 +80,10 @@ struct ScopedCanberraFile { void forget() { mFile.forget(); } - nsILocalFile* operator->() { return mFile; } - operator nsILocalFile*() { return mFile; } + nsIFile* operator->() { return mFile; } + operator nsIFile*() { return mFile; } - nsCOMPtr mFile; + nsCOMPtr mFile; }; static ca_context* @@ -153,7 +153,7 @@ ca_finish_cb(ca_context *c, int error_code, void *userdata) { - nsILocalFile *file = reinterpret_cast(userdata); + nsIFile *file = reinterpret_cast(userdata); if (file) { file->Remove(false); NS_RELEASE(file); @@ -243,8 +243,8 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, return aStatus; } - nsCOMPtr tmpFile; - nsDirectoryService::gService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsILocalFile), + nsCOMPtr tmpFile; + nsDirectoryService::gService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(tmpFile)); nsresult rv = tmpFile->AppendNative(nsDependentCString("mozilla_audio_sample")); @@ -415,8 +415,8 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias) nsresult rv; nsCOMPtr fileURI; - // create a nsILocalFile and then a nsIFileURL from that - nsCOMPtr soundFile; + // create a nsIFile and then a nsIFileURL from that + nsCOMPtr soundFile; rv = NS_NewLocalFile(aSoundAlias, true, getter_AddRefs(soundFile)); NS_ENSURE_SUCCESS(rv,rv); diff --git a/widget/gtk2/nsWindow.cpp b/widget/gtk2/nsWindow.cpp index 8359e32511a..1f6d9c5f48e 100644 --- a/widget/gtk2/nsWindow.cpp +++ b/widget/gtk2/nsWindow.cpp @@ -84,7 +84,6 @@ using namespace mozilla::widget; #include "nsAppDirectoryServiceDefs.h" #include "nsXPIDLString.h" #include "nsIFile.h" -#include "nsILocalFile.h" /* SetCursor(imgIContainer*) */ #include @@ -1740,7 +1739,7 @@ nsWindow::SetIcon(const nsAString& aIconSpec) AppendUTF16toUTF8(aIconSpec, iconName); } - nsCOMPtr iconFile; + nsCOMPtr iconFile; nsCAutoString path; gint *iconSizes = diff --git a/widget/nsIFilePicker.idl b/widget/nsIFilePicker.idl index 064155475c2..275023f8ca5 100644 --- a/widget/nsIFilePicker.idl +++ b/widget/nsIFilePicker.idl @@ -6,7 +6,7 @@ #include "nsISupports.idl" -interface nsILocalFile; +interface nsIFile; interface nsIURI; interface nsIDOMWindow; interface nsISimpleEnumerator; @@ -104,15 +104,15 @@ interface nsIFilePicker : nsISupports * @param displayDirectory the name of the directory * */ - attribute nsILocalFile displayDirectory; + attribute nsIFile displayDirectory; /** - * Get the nsILocalFile for the file or directory. + * Get the nsIFile for the file or directory. * * @return Returns the file currently selected */ - readonly attribute nsILocalFile file; + readonly attribute nsIFile file; /** * Get the nsIURI for the file or directory. diff --git a/widget/os2/nsDeviceContextSpecOS2.cpp b/widget/os2/nsDeviceContextSpecOS2.cpp index 2cebff718c1..1e871514a6f 100644 --- a/widget/os2/nsDeviceContextSpecOS2.cpp +++ b/widget/os2/nsDeviceContextSpecOS2.cpp @@ -20,7 +20,7 @@ #include "nsOS2Uni.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsDirectoryServiceDefs.h" #include "nsIFileStreams.h" #include "gfxPDFSurface.h" @@ -358,7 +358,7 @@ NS_IMETHODIMP nsDeviceContextSpecOS2::GetSurfaceForPrinter(gfxASurface **surface width /= TWIPS_PER_POINT_FLOAT; height /= TWIPS_PER_POINT_FLOAT; - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); rv = file->InitWithPath(filename); if (NS_FAILED(rv)) return rv; diff --git a/widget/os2/nsDragService.cpp b/widget/os2/nsDragService.cpp index 9d9ad3f3423..fd585786f3a 100644 --- a/widget/os2/nsDragService.cpp +++ b/widget/os2/nsDragService.cpp @@ -12,7 +12,7 @@ #include "nsXPIDLString.h" #include "nsReadableUtils.h" #include "nsIWebBrowserPersist.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIURI.h" #include "nsIURL.h" #include "nsNetUtil.h" @@ -63,7 +63,7 @@ nsresult GetAtom( ATOM aAtom, char** outText); nsresult GetFileName(PDRAGITEM pditem, char** outText); nsresult GetFileContents(PCSZ pszPath, char** outText); nsresult GetTempFileName(char** outText); -void SaveTypeAndSource(nsILocalFile *file, nsIDOMDocument *domDoc, +void SaveTypeAndSource(nsIFile *file, nsIDOMDocument *domDoc, PCSZ pszType); int UnicodeToCodepage( const nsAString& inString, char **outText); int CodepageToUnicode( const nsACString& inString, PRUnichar **outText); @@ -494,7 +494,7 @@ nsresult nsDragService::SaveAsContents(PCSZ pszDest, nsIURL* aURL) if (!webPersist) return NS_ERROR_FAILURE; - nsCOMPtr file; + nsCOMPtr file; NS_NewNativeLocalFile(nsDependentCString(pszDest), true, getter_AddRefs(file)); if (!file) @@ -523,7 +523,7 @@ nsresult nsDragService::SaveAsURL(PCSZ pszDest, nsIURI* aURI) if (strUri.IsEmpty()) return NS_ERROR_FAILURE; - nsCOMPtr file; + nsCOMPtr file; NS_NewNativeLocalFile(nsDependentCString(pszDest), true, getter_AddRefs(file)); if (!file) @@ -555,7 +555,7 @@ nsresult nsDragService::SaveAsText(PCSZ pszDest, nsISupportsString* aString) if (strData.IsEmpty()) return NS_ERROR_FAILURE; - nsCOMPtr file; + nsCOMPtr file; NS_NewNativeLocalFile(nsDependentCString(pszDest), true, getter_AddRefs(file)); if (!file) @@ -876,7 +876,7 @@ NS_IMETHODIMP nsDragService::NativeDragEnter(PDRAGINFO pdinfo) else if (isFQFile && !isAlt && NS_SUCCEEDED(GetFileName(pditem, getter_Copies(someText)))) { - nsCOMPtr file; + nsCOMPtr file; if (NS_SUCCEEDED(NS_NewNativeLocalFile(someText, true, getter_AddRefs(file)))) { nsCAutoString textStr; @@ -1137,7 +1137,7 @@ NS_IMETHODIMP nsDragService::NativeDrop(PDRAGINFO pdinfo, HWND hwnd, rv = GetFileContents(fileName.get(), getter_Copies(dropText)); else { isUrl = true; - nsCOMPtr file; + nsCOMPtr file; if (NS_SUCCEEDED(NS_NewNativeLocalFile(fileName, true, getter_AddRefs(file)))) { nsCAutoString textStr; @@ -1439,7 +1439,7 @@ nsresult RenderToOS2FileComplete(PDRAGTRANSFER pdxfer, USHORT usResult, if (content) rv = GetFileContents(gTempFile, outText); else { - nsCOMPtr file; + nsCOMPtr file; if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(gTempFile), true, getter_AddRefs(file)))) { nsCAutoString textStr; @@ -1676,7 +1676,7 @@ nsresult GetTempFileName(char** outText) // set the file's .TYPE and .SUBJECT EAs; since this is non-critical // (though highly desirable), errors aren't reported -void SaveTypeAndSource(nsILocalFile *file, nsIDOMDocument *domDoc, +void SaveTypeAndSource(nsIFile *file, nsIDOMDocument *domDoc, PCSZ pszType) { if (!file) diff --git a/widget/os2/nsFilePicker.cpp b/widget/os2/nsFilePicker.cpp index d12a21c5f0c..e682b72a797 100644 --- a/widget/os2/nsFilePicker.cpp +++ b/widget/os2/nsFilePicker.cpp @@ -9,7 +9,7 @@ #include "nsNetUtil.h" #include "nsIServiceManager.h" #include "nsIPlatformCharset.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIURL.h" #include "nsIStringBundle.h" #include "nsEnumeratorUtils.h" @@ -257,7 +257,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval) if (filedlg.papszFQFilename) { for (ULONG i=0;i file = do_CreateInstance("@mozilla.org/file/local;1", &rv); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1", &rv); NS_ENSURE_SUCCESS(rv,rv); rv = file->InitWithNativePath(nsDependentCString(*(filedlg.papszFQFilename)[i])); @@ -268,7 +268,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval) } WinFreeFileDlgList(filedlg.papszFQFilename); } else { - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1", &rv); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1", &rv); NS_ENSURE_SUCCESS(rv,rv); rv = file->InitWithNativePath(nsDependentCString(filedlg.szFullFile)); @@ -305,25 +305,22 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval) nsresult rv; // Remember last used directory. - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1", &rv)); + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1", &rv)); NS_ENSURE_SUCCESS(rv, rv); file->InitWithNativePath(mFile); nsCOMPtr dir; if (NS_SUCCEEDED(file->GetParent(getter_AddRefs(dir)))) { - nsCOMPtr localDir(do_QueryInterface(dir)); - if (localDir) { - nsCAutoString newDir; - localDir->GetNativePath(newDir); - if(!newDir.IsEmpty()) - PL_strncpyz(mLastUsedDirectory, newDir.get(), MAX_PATH+1); - // Update mDisplayDirectory with this directory, also. - // Some callers rely on this. - if (!mDisplayDirectory) - mDisplayDirectory = do_CreateInstance("@mozilla.org/file/local;1"); - if (mDisplayDirectory) - mDisplayDirectory->InitWithNativePath( nsDependentCString(mLastUsedDirectory) ); - } + nsCAutoString newDir; + dir->GetNativePath(newDir); + if(!newDir.IsEmpty()) + PL_strncpyz(mLastUsedDirectory, newDir.get(), MAX_PATH+1); + // Update mDisplayDirectory with this directory, also. + // Some callers rely on this. + if (!mDisplayDirectory) + mDisplayDirectory = do_CreateInstance("@mozilla.org/file/local;1"); + if (mDisplayDirectory) + mDisplayDirectory->InitWithNativePath( nsDependentCString(mLastUsedDirectory) ); } if (mMode == modeSave) { @@ -344,14 +341,14 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval) -NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile) +NS_IMETHODIMP nsFilePicker::GetFile(nsIFile **aFile) { NS_ENSURE_ARG_POINTER(aFile); if (mFile.IsEmpty()) return NS_OK; - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); @@ -366,7 +363,7 @@ NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile) NS_IMETHODIMP nsFilePicker::GetFileURL(nsIURI **aFileURL) { *aFileURL = nsnull; - nsCOMPtr file; + nsCOMPtr file; nsresult rv = GetFile(getter_AddRefs(file)); if (!file) return rv; diff --git a/widget/os2/nsFilePicker.h b/widget/os2/nsFilePicker.h index a1ff4d0443b..062d2c8a51c 100644 --- a/widget/os2/nsFilePicker.h +++ b/widget/os2/nsFilePicker.h @@ -41,7 +41,7 @@ public: NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension); NS_IMETHOD GetFilterIndex(PRInt32 *aFilterIndex); NS_IMETHOD SetFilterIndex(PRInt32 aFilterIndex); - NS_IMETHOD GetFile(nsILocalFile * *aFile); + NS_IMETHOD GetFile(nsIFile * *aFile); NS_IMETHOD GetFileURL(nsIURI * *aFileURL); NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles); NS_IMETHOD Show(PRInt16 *_retval); @@ -69,7 +69,7 @@ protected: nsIUnicodeEncoder* mUnicodeEncoder; nsIUnicodeDecoder* mUnicodeDecoder; PRInt16 mSelectedType; - nsCOMArray mFiles; + nsCOMArray mFiles; static char mLastUsedDirectory[]; }; diff --git a/widget/os2/nsSound.cpp b/widget/os2/nsSound.cpp index 77cb50db749..073dea6ef86 100644 --- a/widget/os2/nsSound.cpp +++ b/widget/os2/nsSound.cpp @@ -260,7 +260,7 @@ nsresult nsSound::PlaySoundFile(const nsAString &aSoundFile) nsresult nsSound::PlaySoundFile(const nsACString &aSoundFile) { nsresult rv; - nsCOMPtr soundFile; + nsCOMPtr soundFile; rv = NS_NewNativeLocalFile(aSoundFile, false, getter_AddRefs(soundFile)); NS_ENSURE_SUCCESS(rv,rv); diff --git a/widget/os2/nsWidgetFactory.cpp b/widget/os2/nsWidgetFactory.cpp index 7973b22dc75..eb6a938a835 100644 --- a/widget/os2/nsWidgetFactory.cpp +++ b/widget/os2/nsWidgetFactory.cpp @@ -33,7 +33,7 @@ #include "nsBidiKeyboard.h" #include "nsWindow.h" #include "nsDragService.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsFilePicker.h" #include "nsLookAndFeel.h" #include "nsSound.h" diff --git a/widget/os2/os2FrameWindow.cpp b/widget/os2/os2FrameWindow.cpp index a2ad941152f..9c79d5b148c 100644 --- a/widget/os2/os2FrameWindow.cpp +++ b/widget/os2/os2FrameWindow.cpp @@ -479,7 +479,7 @@ nsresult os2FrameWindow::SetIcon(const nsAString& aIconSpec) HPOINTER hWorkingIcon = 0; // Assume the given string is a local identifier for an icon file. - nsCOMPtr iconFile; + nsCOMPtr iconFile; mOwner->ResolveIconName(aIconSpec, NS_LITERAL_STRING(".ico"), getter_AddRefs(iconFile)); diff --git a/widget/qt/faststartupqt/mozqwidgetfast.cpp b/widget/qt/faststartupqt/mozqwidgetfast.cpp index 6f2c54eab77..f74bc544f58 100644 --- a/widget/qt/faststartupqt/mozqwidgetfast.cpp +++ b/widget/qt/faststartupqt/mozqwidgetfast.cpp @@ -7,7 +7,7 @@ #include #include "mozqwidgetfast.h" #include "nsFastStartupQt.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsStringGlue.h" #include "BinaryPath.h" diff --git a/widget/qt/nsDeviceContextSpecQt.cpp b/widget/qt/nsDeviceContextSpecQt.cpp index ace4bdef30d..e6349f2e1d5 100644 --- a/widget/qt/nsDeviceContextSpecQt.cpp +++ b/widget/qt/nsDeviceContextSpecQt.cpp @@ -26,7 +26,7 @@ #include "nsIServiceManager.h" #include "nsPrintSettingsQt.h" #include "nsIFileStreams.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsTArray.h" #include @@ -179,7 +179,7 @@ NS_IMETHODIMP nsDeviceContextSpecQt::EndDocument() } // Handle print-to-file ourselves for the benefit of embedders nsXPIDLString targetPath; - nsCOMPtr destFile; + nsCOMPtr destFile; mPrintSettings->GetToFileName(getter_Copies(targetPath)); nsresult rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(targetPath), diff --git a/widget/qt/nsDeviceContextSpecQt.h b/widget/qt/nsDeviceContextSpecQt.h index 855a4f63dd7..746eec84594 100644 --- a/widget/qt/nsDeviceContextSpecQt.h +++ b/widget/qt/nsDeviceContextSpecQt.h @@ -44,8 +44,8 @@ protected: bool mIsPPreview : 1; /* If true, is print preview */ char mPath[PATH_MAX]; /* If toPrinter = false, dest file */ char mPrinter[256]; /* Printer name */ - nsCString mSpoolName; - nsCOMPtr mSpoolFile; + nsCString mSpoolName; + nsCOMPtr mSpoolFile; }; class nsPrinterEnumeratorQt : public nsIPrinterEnumerator diff --git a/widget/qt/nsFilePicker.cpp b/widget/qt/nsFilePicker.cpp index 92650b0e807..1dc9491e6a5 100644 --- a/widget/qt/nsFilePicker.cpp +++ b/widget/qt/nsFilePicker.cpp @@ -129,9 +129,9 @@ nsFilePicker::SetFilterIndex(PRInt32 aFilterIndex) return NS_OK; } -/* readonly attribute nsILocalFile file; */ +/* readonly attribute nsIFile file; */ NS_IMETHODIMP -nsFilePicker::GetFile(nsILocalFile* *aFile) +nsFilePicker::GetFile(nsIFile* *aFile) { NS_ENSURE_ARG_POINTER(aFile); @@ -140,7 +140,7 @@ nsFilePicker::GetFile(nsILocalFile* *aFile) return NS_OK; } - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); file->InitWithNativePath(mFile); @@ -154,7 +154,7 @@ nsFilePicker::GetFile(nsILocalFile* *aFile) NS_IMETHODIMP nsFilePicker::GetFileURL(nsIURI* *aFileURL) { - nsCOMPtr file; + nsCOMPtr file; GetFile(getter_AddRefs(file)); nsCOMPtr uri; @@ -275,7 +275,7 @@ nsFilePicker::Show(PRInt16* aReturn) *aReturn = nsIFilePicker::returnOK; if (mMode == modeSave) { - nsCOMPtr file; + nsCOMPtr file; GetFile(getter_AddRefs(file)); if (file) { bool exists = false; diff --git a/widget/qt/nsFilePicker.h b/widget/qt/nsFilePicker.h index e99a29c6876..052cd7ca3d0 100644 --- a/widget/qt/nsFilePicker.h +++ b/widget/qt/nsFilePicker.h @@ -30,7 +30,7 @@ public: NS_IMETHODIMP SetDefaultExtension(const nsAString& aDefaultExtension); NS_IMETHODIMP GetFilterIndex(PRInt32* aFilterIndex); NS_IMETHODIMP SetFilterIndex(PRInt32 aFilterIndex); - NS_IMETHODIMP GetFile(nsILocalFile* *aFile); + NS_IMETHODIMP GetFile(nsIFile* *aFile); NS_IMETHODIMP GetFileURL(nsIURI* *aFileURL); NS_IMETHODIMP GetFiles(nsISimpleEnumerator* *aFiles); NS_IMETHODIMP Show(PRInt16* aReturn); @@ -41,7 +41,7 @@ private: protected: QPointer mDialog; - nsCOMArray mFiles; + nsCOMArray mFiles; PRInt16 mMode; PRInt16 mSelectedType; diff --git a/widget/qt/nsPrintSettingsQt.cpp b/widget/qt/nsPrintSettingsQt.cpp index 2dc14350ebc..dc06d94cdfd 100644 --- a/widget/qt/nsPrintSettingsQt.cpp +++ b/widget/qt/nsPrintSettingsQt.cpp @@ -7,7 +7,7 @@ #include #include #include "nsPrintSettingsQt.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsCRTGlue.h" NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSettingsQt, @@ -209,7 +209,7 @@ nsPrintSettingsQt::GetToFileName(PRUnichar** aToFileName) NS_IMETHODIMP nsPrintSettingsQt::SetToFileName(const PRUnichar* aToFileName) { - nsCOMPtr file; + nsCOMPtr file; nsresult rv = NS_NewLocalFile(nsDependentString(aToFileName), true, getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/widget/qt/nsSound.cpp b/widget/qt/nsSound.cpp index d855d36a6ec..593807139c0 100644 --- a/widget/qt/nsSound.cpp +++ b/widget/qt/nsSound.cpp @@ -356,8 +356,8 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias) nsresult rv; nsCOMPtr fileURI; - // create a nsILocalFile and then a nsIFileURL from that - nsCOMPtr soundFile; + // create a nsIFile and then a nsIFileURL from that + nsCOMPtr soundFile; rv = NS_NewLocalFile(aSoundAlias, true, getter_AddRefs(soundFile)); NS_ENSURE_SUCCESS(rv,rv); diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index 61d22cf3504..5852d723afa 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -815,7 +815,7 @@ nsWindow::SetIcon(const nsAString& aIconSpec) if (!mWidget) return NS_OK; - nsCOMPtr iconFile; + nsCOMPtr iconFile; nsCAutoString path; nsTArray iconList; diff --git a/widget/windows/JumpListBuilder.cpp b/widget/windows/JumpListBuilder.cpp index 6d47b8fb813..8f233ac2c61 100644 --- a/widget/windows/JumpListBuilder.cpp +++ b/widget/windows/JumpListBuilder.cpp @@ -610,7 +610,7 @@ NS_IMETHODIMP AsyncWriteIconToDisk::Run() getter_AddRefs(iconStream)); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr icoFile + nsCOMPtr icoFile = do_CreateInstance("@mozilla.org/file/local;1"); NS_ENSURE_TRUE(icoFile, NS_ERROR_FAILURE); rv = icoFile->InitWithPath(mIconPath); @@ -655,7 +655,7 @@ AsyncDeleteIconFromDisk::AsyncDeleteIconFromDisk(const nsAString &aIconPath) NS_IMETHODIMP AsyncDeleteIconFromDisk::Run() { // Construct the parent path of the passed in path - nsCOMPtr icoFile = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr icoFile = do_CreateInstance("@mozilla.org/file/local;1"); NS_ENSURE_TRUE(icoFile, NS_ERROR_FAILURE); nsresult rv = icoFile->InitWithPath(mIconPath); NS_ENSURE_SUCCESS(rv, rv); diff --git a/widget/windows/JumpListItem.cpp b/widget/windows/JumpListItem.cpp index 1bf00f7f06a..d05d368f0f5 100644 --- a/widget/windows/JumpListItem.cpp +++ b/widget/windows/JumpListItem.cpp @@ -10,7 +10,6 @@ #include #include "nsIFile.h" -#include "nsILocalFile.h" #include "nsNetUtil.h" #include "nsCRT.h" #include "nsNetCID.h" @@ -491,10 +490,8 @@ nsresult JumpListShortcut::GetShellLink(nsCOMPtr& item, // Path nsCOMPtr executable; handlerApp->GetExecutable(getter_AddRefs(executable)); - nsCOMPtr localFile = do_QueryInterface(executable, &rv); - NS_ENSURE_SUCCESS(rv, rv); - rv = localFile->GetPath(appPath); + rv = executable->GetPath(appPath); NS_ENSURE_SUCCESS(rv, rv); // Command line parameters @@ -587,7 +584,7 @@ static nsresult IsPathInOurIconCache(nsCOMPtr& aShortcut, NS_ENSURE_SUCCESS(rv, rv); // Construct the parent path of the passed in path - nsCOMPtr passedInFile = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr passedInFile = do_CreateInstance("@mozilla.org/file/local;1"); NS_ENSURE_TRUE(passedInFile, NS_ERROR_FAILURE); nsAutoString passedInPath(aPath); rv = passedInFile->InitWithPath(passedInPath); @@ -620,7 +617,7 @@ nsresult JumpListShortcut::GetJumpListShortcut(IShellLinkW *pLink, nsCOMPtr file; + nsCOMPtr file; nsDependentString filepath(buf); rv = NS_NewLocalFile(filepath, false, getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/widget/windows/nsClipboard.cpp b/widget/windows/nsClipboard.cpp index 1b070e55314..5da17dbee0b 100644 --- a/widget/windows/nsClipboard.cpp +++ b/widget/windows/nsClipboard.cpp @@ -606,7 +606,7 @@ nsresult nsClipboard::GetDataFromDataObject(IDataObject * aDataObject, if ( strcmp(flavorStr, kFileMime) == 0 ) { // we have a file path in |data|. Create an nsLocalFile object. nsDependentString filepath(reinterpret_cast(data)); - nsCOMPtr file; + nsCOMPtr file; if ( NS_SUCCEEDED(NS_NewLocalFile(filepath, false, getter_AddRefs(file))) ) genericDataWrapper = do_QueryInterface(file); nsMemory::Free(data); @@ -761,7 +761,7 @@ nsClipboard :: FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, v if ( NS_SUCCEEDED(loadResult) && *outData ) { // we have a file path in |data|. Is it an internet shortcut or a normal file? const nsDependentString filepath(static_cast(*outData)); - nsCOMPtr file; + nsCOMPtr file; nsresult rv = NS_NewLocalFile(filepath, true, getter_AddRefs(file)); if (NS_FAILED(rv)) { nsMemory::Free(*outData); @@ -862,7 +862,7 @@ nsClipboard :: FindURLFromNativeURL ( IDataObject* inDataObject, UINT inIndex, v // ResolveShortcut // void -nsClipboard :: ResolveShortcut ( nsILocalFile* aFile, nsACString& outURL ) +nsClipboard :: ResolveShortcut ( nsIFile* aFile, nsACString& outURL ) { nsCOMPtr fph; nsresult rv = NS_GetFileProtocolHandler(getter_AddRefs(fph)); diff --git a/widget/windows/nsClipboard.h b/widget/windows/nsClipboard.h index f8c14dd636e..551009c9131 100644 --- a/widget/windows/nsClipboard.h +++ b/widget/windows/nsClipboard.h @@ -13,7 +13,7 @@ class nsITransferable; class nsIClipboardOwner; class nsIWidget; -class nsILocalFile; +class nsIFile; struct IDataObject; /** @@ -57,7 +57,7 @@ protected: static bool FindURLFromNativeURL ( IDataObject* inDataObject, UINT inIndex, void** outData, PRUint32* outDataLen ) ; static bool FindUnicodeFromPlainText ( IDataObject* inDataObject, UINT inIndex, void** outData, PRUint32* outDataLen ) ; static bool FindPlatformHTML ( IDataObject* inDataObject, UINT inIndex, void** outData, PRUint32* outDataLen ); - static void ResolveShortcut ( nsILocalFile* inFileName, nsACString& outURL ) ; + static void ResolveShortcut ( nsIFile* inFileName, nsACString& outURL ) ; nsIWidget * mWindow; diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp index 566e6811732..b98bcb55011 100644 --- a/widget/windows/nsDataObj.cpp +++ b/widget/windows/nsDataObj.cpp @@ -876,7 +876,7 @@ nsDataObj :: GetFileContents ( FORMATETC& aFE, STGMEDIUM& aSTG ) // any title that starts with a forbidden name and extension (e.g. "nul" is invalid, but // "nul." and "nul.txt" are also invalid and will cause problems). // -// It would seem that this is more functionality suited to being in nsILocalFile. +// It would seem that this is more functionality suited to being in nsIFile. // static void MangleTextToValidFilename(nsString & aText) @@ -907,7 +907,7 @@ MangleTextToValidFilename(nsString & aText) // with the supplied extension. This ensures that we do not cut MBCS characters // in the middle. // -// It would seem that this is more functionality suited to being in nsILocalFile. +// It would seem that this is more functionality suited to being in nsIFile. // static bool CreateFilenameFromTextA(nsString & aText, const char * aExtension, diff --git a/widget/windows/nsDataObj.h b/widget/windows/nsDataObj.h index 95db7f692a6..06cc8aedae9 100644 --- a/widget/windows/nsDataObj.h +++ b/widget/windows/nsDataObj.h @@ -11,7 +11,7 @@ #include "nsCOMPtr.h" #include "nsString.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIURI.h" #include "nsIInputStream.h" #include "nsIStreamListener.h" diff --git a/widget/windows/nsDeviceContextSpecWin.cpp b/widget/windows/nsDeviceContextSpecWin.cpp index fb4fb34aa43..94aa0b5f364 100644 --- a/widget/windows/nsDeviceContextSpecWin.cpp +++ b/widget/windows/nsDeviceContextSpecWin.cpp @@ -36,7 +36,6 @@ #include "nsNativeCharsetUtils.h" // File Picker -#include "nsILocalFile.h" #include "nsIFile.h" #include "nsIFilePicker.h" #include "nsIStringBundle.h" @@ -283,7 +282,7 @@ GetFileNameForPrintSettings(nsIPrintSettings* aPS) if (fileName) { if (*fileName) { nsAutoString leafName; - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); if (file) { rv = file->InitWithPath(nsDependentString(fileName)); if (NS_SUCCEEDED(rv)) { @@ -306,7 +305,7 @@ GetFileNameForPrintSettings(nsIPrintSettings* aPS) return NS_ERROR_ABORT; } - nsCOMPtr localFile; + nsCOMPtr localFile; rv = filePicker->GetFile(getter_AddRefs(localFile)); NS_ENSURE_SUCCESS(rv, rv); @@ -487,7 +486,7 @@ NS_IMETHODIMP nsDeviceContextSpecWin::GetSurfaceForPrinter(gfxASurface **surface width /= TWIPS_PER_POINT_FLOAT; height /= TWIPS_PER_POINT_FLOAT; - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); nsresult rv = file->InitWithPath(filename); if (NS_FAILED(rv)) return rv; diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp index 57983d46b9d..6209aa9dfbb 100644 --- a/widget/windows/nsFilePicker.cpp +++ b/widget/windows/nsFilePicker.cpp @@ -805,7 +805,7 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir) while (current && *current && *(current + NS_strlen(current) + 1)) { current = current + NS_strlen(current) + 1; - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); NS_ENSURE_TRUE(file, false); // Only prepend the directory if the path specified is a relative path @@ -827,7 +827,7 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir) // specify OFN_ALLOWMULTISELECT and the user selects only one file the // lpstrFile string does not have a separator between the path and file name. if (current && *current && (current == fileBuffer)) { - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); NS_ENSURE_TRUE(file, false); nsAutoString canonicalizedPath; @@ -983,7 +983,7 @@ nsFilePicker::ShowFilePicker(const nsString& aInitialDir) if (SUCCEEDED(items->GetItemAt(idx, getter_AddRefs(item)))) { if (!WinUtils::GetShellItemPath(item, str)) continue; - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); if (file && NS_SUCCEEDED(file->InitWithPath(str))) mFiles.AppendObject(file); } @@ -1040,7 +1040,7 @@ nsFilePicker::ShowW(PRInt16 *aReturnVal) if (mMode == modeSave) { // Windows does not return resultReplace, we must check if file // already exists. - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); bool flag = false; if (file && NS_SUCCEEDED(file->InitWithPath(mUnicodeFile)) && NS_SUCCEEDED(file->Exists(&flag)) && flag) { @@ -1059,7 +1059,7 @@ nsFilePicker::Show(PRInt16 *aReturnVal) } NS_IMETHODIMP -nsFilePicker::GetFile(nsILocalFile **aFile) +nsFilePicker::GetFile(nsIFile **aFile) { NS_ENSURE_ARG_POINTER(aFile); *aFile = nsnull; @@ -1067,7 +1067,7 @@ nsFilePicker::GetFile(nsILocalFile **aFile) if (mUnicodeFile.IsEmpty()) return NS_OK; - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); @@ -1082,7 +1082,7 @@ NS_IMETHODIMP nsFilePicker::GetFileURL(nsIURI **aFileURL) { *aFileURL = nsnull; - nsCOMPtr file; + nsCOMPtr file; nsresult rv = GetFile(getter_AddRefs(file)); if (!file) return rv; @@ -1228,7 +1228,7 @@ nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) void nsFilePicker::RememberLastUsedDirectory() { - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); if (!file || NS_FAILED(file->InitWithPath(mUnicodeFile))) { NS_WARNING("RememberLastUsedDirectory failed to init file path."); return; diff --git a/widget/windows/nsFilePicker.h b/widget/windows/nsFilePicker.h index 2a1c060f35d..a92ae1fd32f 100644 --- a/widget/windows/nsFilePicker.h +++ b/widget/windows/nsFilePicker.h @@ -20,7 +20,7 @@ #define _WIN32_IE _WIN32_IE_IE70 #endif -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsITimer.h" #include "nsISimpleEnumerator.h" #include "nsCOMArray.h" @@ -60,7 +60,7 @@ public: NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension); NS_IMETHOD GetFilterIndex(PRInt32 *aFilterIndex); NS_IMETHOD SetFilterIndex(PRInt32 aFilterIndex); - NS_IMETHOD GetFile(nsILocalFile * *aFile); + NS_IMETHOD GetFile(nsIFile * *aFile); NS_IMETHOD GetFileURL(nsIURI * *aFileURL); NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles); NS_IMETHOD Show(PRInt16 *aReturnVal); @@ -114,7 +114,7 @@ protected: nsString mDefaultExtension; nsString mFilterList; PRInt16 mSelectedType; - nsCOMArray mFiles; + nsCOMArray mFiles; static char mLastUsedDirectory[]; nsString mUnicodeFile; static PRUnichar *mLastUsedUnicodeDirectory; diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 8293c9fcd6c..23452869888 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -86,7 +86,6 @@ #include "nsIClipboard.h" #include "nsIMM32Handler.h" #include "WinMouseScrollHandler.h" -#include "nsILocalFile.h" #include "nsFontMetrics.h" #include "nsIFontEnumerator.h" #include "nsGUIEvent.h" @@ -2794,7 +2793,7 @@ NS_METHOD nsWindow::SetIcon(const nsAString& aIconSpec) { // Assume the given string is a local identifier for an icon file. - nsCOMPtr iconFile; + nsCOMPtr iconFile; ResolveIconName(aIconSpec, NS_LITERAL_STRING(".ico"), getter_AddRefs(iconFile)); if (!iconFile) diff --git a/widget/windows/tests/TestWinDND.cpp b/widget/windows/tests/TestWinDND.cpp index 7f94bf252a0..7a9690603f1 100644 --- a/widget/windows/tests/TestWinDND.cpp +++ b/widget/windows/tests/TestWinDND.cpp @@ -9,7 +9,7 @@ #include "TestHarness.h" #include "nsIArray.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsNetUtil.h" #include "nsISupportsPrimitives.h" #include "nsIFileURL.h" @@ -48,7 +48,7 @@ nsresult CheckValidHDROP(STGMEDIUM* pSTG) if (s.IsEmpty()) break; nsresult rv; - nsCOMPtr localFile( + nsCOMPtr localFile( do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv)); rv = localFile->InitWithPath(s); if (NS_FAILED(rv)) { diff --git a/widget/xpwidgets/nsBaseFilePicker.cpp b/widget/xpwidgets/nsBaseFilePicker.cpp index 3b7ef8e30ed..e7f62ff7bfb 100644 --- a/widget/xpwidgets/nsBaseFilePicker.cpp +++ b/widget/xpwidgets/nsBaseFilePicker.cpp @@ -16,7 +16,7 @@ #include "nsXPIDLString.h" #include "nsIServiceManager.h" #include "nsCOMArray.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsEnumeratorUtils.h" #include "mozilla/Services.h" #include "WidgetUtils.h" @@ -140,13 +140,13 @@ NS_IMETHODIMP nsBaseFilePicker::SetFilterIndex(PRInt32 aFilterIndex) NS_IMETHODIMP nsBaseFilePicker::GetFiles(nsISimpleEnumerator **aFiles) { NS_ENSURE_ARG_POINTER(aFiles); - nsCOMArray files; + nsCOMArray files; nsresult rv; // if we get into the base class, the platform // doesn't implement GetFiles() yet. // so we fake it. - nsCOMPtr file; + nsCOMPtr file; rv = GetFile(getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv,rv); @@ -159,7 +159,7 @@ NS_IMETHODIMP nsBaseFilePicker::GetFiles(nsISimpleEnumerator **aFiles) #ifdef BASEFILEPICKER_HAS_DISPLAYDIRECTORY // Set the display directory -NS_IMETHODIMP nsBaseFilePicker::SetDisplayDirectory(nsILocalFile *aDirectory) +NS_IMETHODIMP nsBaseFilePicker::SetDisplayDirectory(nsIFile *aDirectory) { if (!aDirectory) { mDisplayDirectory = nsnull; @@ -174,7 +174,7 @@ NS_IMETHODIMP nsBaseFilePicker::SetDisplayDirectory(nsILocalFile *aDirectory) } // Get the display directory -NS_IMETHODIMP nsBaseFilePicker::GetDisplayDirectory(nsILocalFile **aDirectory) +NS_IMETHODIMP nsBaseFilePicker::GetDisplayDirectory(nsIFile **aDirectory) { *aDirectory = nsnull; if (!mDisplayDirectory) diff --git a/widget/xpwidgets/nsBaseFilePicker.h b/widget/xpwidgets/nsBaseFilePicker.h index 52554490f55..dd6238f7ea7 100644 --- a/widget/xpwidgets/nsBaseFilePicker.h +++ b/widget/xpwidgets/nsBaseFilePicker.h @@ -32,8 +32,8 @@ public: NS_IMETHOD SetFilterIndex(PRInt32 aFilterIndex); NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles); #ifdef BASEFILEPICKER_HAS_DISPLAYDIRECTORY - NS_IMETHOD GetDisplayDirectory(nsILocalFile * *aDisplayDirectory); - NS_IMETHOD SetDisplayDirectory(nsILocalFile * aDisplayDirectory); + NS_IMETHOD GetDisplayDirectory(nsIFile * *aDisplayDirectory); + NS_IMETHOD SetDisplayDirectory(nsIFile * aDisplayDirectory); #endif NS_IMETHOD GetAddToRecentDocs(bool *aFlag); NS_IMETHOD SetAddToRecentDocs(bool aFlag); @@ -45,7 +45,7 @@ protected: bool mAddToRecentDocs; #ifdef BASEFILEPICKER_HAS_DISPLAYDIRECTORY - nsCOMPtr mDisplayDirectory; + nsCOMPtr mDisplayDirectory; #endif }; diff --git a/widget/xpwidgets/nsBaseWidget.cpp b/widget/xpwidgets/nsBaseWidget.cpp index ca37528cd16..39f263ad500 100644 --- a/widget/xpwidgets/nsBaseWidget.cpp +++ b/widget/xpwidgets/nsBaseWidget.cpp @@ -1238,7 +1238,7 @@ nsBaseWidget::OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta, * Returns true if the icon file exists and can be read. */ static bool -ResolveIconNameHelper(nsILocalFile *aFile, +ResolveIconNameHelper(nsIFile *aFile, const nsAString &aIconName, const nsAString &aIconSuffix) { @@ -1260,7 +1260,7 @@ ResolveIconNameHelper(nsILocalFile *aFile, void nsBaseWidget::ResolveIconName(const nsAString &aIconName, const nsAString &aIconSuffix, - nsILocalFile **aResult) + nsIFile **aResult) { *aResult = nsnull; @@ -1280,7 +1280,7 @@ nsBaseWidget::ResolveIconName(const nsAString &aIconName, dirs->GetNext(getter_AddRefs(element)); if (!element) continue; - nsCOMPtr file = do_QueryInterface(element); + nsCOMPtr file = do_QueryInterface(element); if (!file) continue; if (ResolveIconNameHelper(file, aIconName, aIconSuffix)) { @@ -1292,8 +1292,8 @@ nsBaseWidget::ResolveIconName(const nsAString &aIconName, // then check the main app chrome directory - nsCOMPtr file; - dirSvc->Get(NS_APP_CHROME_DIR, NS_GET_IID(nsILocalFile), + nsCOMPtr file; + dirSvc->Get(NS_APP_CHROME_DIR, NS_GET_IID(nsIFile), getter_AddRefs(file)); if (file && ResolveIconNameHelper(file, aIconName, aIconSuffix)) NS_ADDREF(*aResult = file); diff --git a/widget/xpwidgets/nsBaseWidget.h b/widget/xpwidgets/nsBaseWidget.h index 0ccb932cc10..e1f55ed9586 100644 --- a/widget/xpwidgets/nsBaseWidget.h +++ b/widget/xpwidgets/nsBaseWidget.h @@ -8,7 +8,7 @@ #include "nsRect.h" #include "nsIWidget.h" #include "nsWidgetsCID.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsString.h" #include "nsCOMPtr.h" #include "nsGUIEvent.h" @@ -214,7 +214,7 @@ protected: virtual void ResolveIconName(const nsAString &aIconName, const nsAString &aIconSuffix, - nsILocalFile **aResult); + nsIFile **aResult); virtual void OnDestroy(); virtual void BaseCreate(nsIWidget *aParent, const nsIntRect &aRect, diff --git a/widget/xpwidgets/nsFilePickerProxy.cpp b/widget/xpwidgets/nsFilePickerProxy.cpp index 82e12a7f49b..7de8e2f1971 100644 --- a/widget/xpwidgets/nsFilePickerProxy.cpp +++ b/widget/xpwidgets/nsFilePickerProxy.cpp @@ -84,9 +84,9 @@ nsFilePickerProxy::SetFilterIndex(PRInt32 aFilterIndex) return NS_OK; } -/* readonly attribute nsILocalFile file; */ +/* readonly attribute nsIFile file; */ NS_IMETHODIMP -nsFilePickerProxy::GetFile(nsILocalFile** aFile) +nsFilePickerProxy::GetFile(nsIFile** aFile) { NS_ENSURE_ARG_POINTER(aFile); @@ -95,7 +95,7 @@ nsFilePickerProxy::GetFile(nsILocalFile** aFile) return NS_OK; } - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); file->InitWithPath(mFile); @@ -109,7 +109,7 @@ nsFilePickerProxy::GetFile(nsILocalFile** aFile) NS_IMETHODIMP nsFilePickerProxy::GetFileURL(nsIURI** aFileURL) { - nsCOMPtr file; + nsCOMPtr file; GetFile(getter_AddRefs(file)); nsCOMPtr uri; @@ -152,7 +152,7 @@ NS_IMETHODIMP nsFilePickerProxy::Show(PRInt16* aReturn) if (mMode == nsIFilePicker::modeOpenMultiple) { for (PRUint32 i = 0; i < count; ++i) { - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); file->InitWithPath(filePaths[i]); diff --git a/widget/xpwidgets/nsFilePickerProxy.h b/widget/xpwidgets/nsFilePickerProxy.h index c1cc4ff6267..e3739b98089 100644 --- a/widget/xpwidgets/nsFilePickerProxy.h +++ b/widget/xpwidgets/nsFilePickerProxy.h @@ -13,7 +13,7 @@ #include "nsCOMArray.h" class nsIWidget; -class nsILocalFile; +class nsIFile; /** This class creates a proxy file picker to be used in content processes. @@ -37,7 +37,7 @@ public: NS_IMETHODIMP SetDefaultExtension(const nsAString& aDefaultExtension); NS_IMETHODIMP GetFilterIndex(PRInt32* aFilterIndex); NS_IMETHODIMP SetFilterIndex(PRInt32 aFilterIndex); - NS_IMETHODIMP GetFile(nsILocalFile** aFile); + NS_IMETHODIMP GetFile(nsIFile** aFile); NS_IMETHODIMP GetFileURL(nsIURI** aFileURL); NS_IMETHODIMP GetFiles(nsISimpleEnumerator** aFiles); NS_IMETHODIMP Show(PRInt16* aReturn); @@ -46,7 +46,7 @@ private: ~nsFilePickerProxy(); void InitNative(nsIWidget*, const nsAString&, short int); - nsCOMArray mFiles; + nsCOMArray mFiles; PRInt16 mMode; PRInt16 mSelectedType; diff --git a/xpcom/build/BinaryPath.h b/xpcom/build/BinaryPath.h index 3d325d5237c..ef3d48f5c4c 100644 --- a/xpcom/build/BinaryPath.h +++ b/xpcom/build/BinaryPath.h @@ -135,9 +135,9 @@ private: #endif public: - static nsresult GetFile(const char *argv0, nsILocalFile* *aResult) + static nsresult GetFile(const char *argv0, nsIFile* *aResult) { - nsCOMPtr lf; + nsCOMPtr lf; #ifdef XP_WIN PRUnichar exePath[MAXPATHLEN]; nsresult rv = GetW(argv0, exePath); diff --git a/xpcom/build/FileLocation.cpp b/xpcom/build/FileLocation.cpp index 08ce7db1692..6e76ddcdb07 100644 --- a/xpcom/build/FileLocation.cpp +++ b/xpcom/build/FileLocation.cpp @@ -29,7 +29,6 @@ FileLocation::FileLocation(const FileLocation &file, const char *path) if (path) { nsCOMPtr cfile; file.mBaseFile->GetParent(getter_AddRefs(cfile)); - nsCOMPtr clfile = do_QueryInterface(cfile); #if defined(XP_WIN) || defined(XP_OS2) nsCAutoString pathStr(path); @@ -40,11 +39,11 @@ FileLocation::FileLocation(const FileLocation &file, const char *path) *p = '\\'; } } - clfile->AppendRelativeNativePath(pathStr); + cfile->AppendRelativeNativePath(pathStr); #else - clfile->AppendRelativeNativePath(nsDependentCString(path)); + cfile->AppendRelativeNativePath(nsDependentCString(path)); #endif - Init(clfile); + Init(cfile); } else { Init(file.mBaseFile); } @@ -67,7 +66,7 @@ FileLocation::GetURIString(nsACString &result) const } } -already_AddRefed +already_AddRefed FileLocation::GetBaseFile() { if (IsZip() && mBaseZip) { @@ -77,7 +76,7 @@ FileLocation::GetBaseFile() return NULL; } - nsCOMPtr file = mBaseFile; + nsCOMPtr file = mBaseFile; return file.forget(); } diff --git a/xpcom/build/FileLocation.h b/xpcom/build/FileLocation.h index 8e867e15375..d1d42374738 100644 --- a/xpcom/build/FileLocation.h +++ b/xpcom/build/FileLocation.h @@ -8,7 +8,7 @@ #include "nsString.h" #include "nsCOMPtr.h" #include "nsAutoPtr.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIURI.h" #include "FileUtils.h" @@ -36,16 +36,16 @@ public: /** * Constructor for plain files */ - FileLocation(nsILocalFile *file) + FileLocation(nsIFile *file) { Init(file); } /** * Constructors for path within an archive. The archive can be given either - * as nsILocalFile or nsZipArchive. + * as nsIFile or nsZipArchive. */ - FileLocation(nsILocalFile *zip, const char *path) + FileLocation(nsIFile *zip, const char *path) { Init(zip, path); } @@ -63,14 +63,14 @@ public: /** * Initialization functions corresponding to constructors */ - void Init(nsILocalFile *file) + void Init(nsIFile *file) { mBaseZip = NULL; mBaseFile = file; mPath.Truncate(); } - void Init(nsILocalFile *zip, const char *path) + void Init(nsIFile *zip, const char *path) { mBaseZip = NULL; mBaseFile = zip; @@ -95,7 +95,7 @@ public: * - The archive file when the location is in an archive * - The outer archive file when the location is in an archive in an archive */ - already_AddRefed GetBaseFile(); + already_AddRefed GetBaseFile(); /** * Returns whether the "base file" (see GetBaseFile) is an archive @@ -155,7 +155,7 @@ public: */ nsresult GetData(Data &data); private: - nsCOMPtr mBaseFile; + nsCOMPtr mBaseFile; nsRefPtr mBaseZip; nsCString mPath; }; /* class FileLocation */ diff --git a/xpcom/build/XPCOM.h b/xpcom/build/XPCOM.h index fbe07446ce9..8ce424ce9e7 100644 --- a/xpcom/build/XPCOM.h +++ b/xpcom/build/XPCOM.h @@ -128,7 +128,6 @@ #include "nsIConverterOutputStream.h" #include "nsIDebug2.h" #include "nsIInputStreamTee.h" -#include "nsILocalFile.h" #include "nsIMultiplexInputStream.h" #include "nsIMutableArray.h" #include "nsIPersistentProperties2.h" diff --git a/xpcom/build/nsXPCOM.h b/xpcom/build/nsXPCOM.h index 720eb89b072..54b65c8bfc4 100644 --- a/xpcom/build/nsXPCOM.h +++ b/xpcom/build/nsXPCOM.h @@ -92,7 +92,7 @@ struct Module; * nsnull for the default behaviour. * * @see NS_NewLocalFile - * @see nsILocalFile + * @see nsIFile * @see nsIDirectoryServiceProvider * * @return NS_OK for success; @@ -171,7 +171,7 @@ XPCOM_API(nsresult) NS_GetMemoryManager(nsIMemory* *result); /** - * Public Method to create an instance of a nsILocalFile. This function + * Public Method to create an instance of a nsIFile. This function * may be called prior to NS_InitXPCOM. * * @param path @@ -185,7 +185,7 @@ NS_GetMemoryManager(nsIMemory* *result); * resolve symbolic links. By default, this value will be false * on all non unix systems. On unix, this attribute is effectively * a noop. - * @param result Interface pointer to a new instance of an nsILocalFile + * @param result Interface pointer to a new instance of an nsIFile * * @return NS_OK for success; * other error codes indicate a failure. @@ -196,12 +196,12 @@ NS_GetMemoryManager(nsIMemory* *result); XPCOM_API(nsresult) NS_NewLocalFile(const nsAString &path, bool followLinks, - nsILocalFile* *result); + nsIFile* *result); XPCOM_API(nsresult) NS_NewNativeLocalFile(const nsACString &path, bool followLinks, - nsILocalFile* *result); + nsIFile* *result); #endif diff --git a/xpcom/build/nsXPCOMCID.h b/xpcom/build/nsXPCOMCID.h index c2cb9e6f1c6..ee641596c08 100644 --- a/xpcom/build/nsXPCOMCID.h +++ b/xpcom/build/nsXPCOMCID.h @@ -22,7 +22,7 @@ * The file abstraction provides ways to obtain and access files and * directories located on the local system. * - * This contract supports the nsIFile interface and the nsILocalFile interface. + * This contract supports the nsIFile interface. * This contract may also support platform specific interfaces such as * nsILocalFileMac on platforms where additional interfaces are required. * diff --git a/xpcom/build/nsXPCOMPrivate.h b/xpcom/build/nsXPCOMPrivate.h index 48308b7e191..5f616e4ab95 100644 --- a/xpcom/build/nsXPCOMPrivate.h +++ b/xpcom/build/nsXPCOMPrivate.h @@ -35,8 +35,8 @@ typedef nsresult (* GetServiceManagerFunc)(nsIServiceManager* *result); typedef nsresult (* GetComponentManagerFunc)(nsIComponentManager* *result); typedef nsresult (* GetComponentRegistrarFunc)(nsIComponentRegistrar* *result); typedef nsresult (* GetMemoryManagerFunc)(nsIMemory* *result); -typedef nsresult (* NewLocalFileFunc)(const nsAString &path, bool followLinks, nsILocalFile* *result); -typedef nsresult (* NewNativeLocalFileFunc)(const nsACString &path, bool followLinks, nsILocalFile* *result); +typedef nsresult (* NewLocalFileFunc)(const nsAString &path, bool followLinks, nsIFile* *result); +typedef nsresult (* NewNativeLocalFileFunc)(const nsACString &path, bool followLinks, nsIFile* *result); typedef nsresult (* GetDebugFunc)(nsIDebug* *result); typedef nsresult (* GetTraceRefcntFunc)(nsITraceRefcnt* *result); diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp index b39268705b9..9793e3f6f8d 100644 --- a/xpcom/build/nsXPComInit.cpp +++ b/xpcom/build/nsXPComInit.cpp @@ -57,7 +57,7 @@ #include "nsEnvironment.h" #include "nsVersionComparatorImpl.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsLocalFile.h" #if defined(XP_UNIX) || defined(XP_OS2) #include "nsNativeCharsetUtils.h" diff --git a/xpcom/build/nsXREAppData.h b/xpcom/build/nsXREAppData.h index 68fb89df056..e2b5215e40f 100644 --- a/xpcom/build/nsXREAppData.h +++ b/xpcom/build/nsXREAppData.h @@ -8,7 +8,7 @@ #include "mozilla/StandardInteger.h" -class nsILocalFile; +class nsIFile; /** * Application-specific data needed to start the apprunner. @@ -30,7 +30,7 @@ struct nsXREAppData * The directory of the application to be run. May be null if the * xulrunner and the app are installed into the same directory. */ - nsILocalFile* directory; + nsIFile* directory; /** * The name of the application vendor. This must be ASCII, and is normally @@ -85,7 +85,7 @@ struct nsXREAppData * The location of the XRE. XRE_main may not be able to figure this out * programatically. */ - nsILocalFile* xreDirectory; + nsIFile* xreDirectory; /** * The minimum/maximum compatible XRE version. diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h index 8f8cfe291d9..88a01fd153e 100644 --- a/xpcom/build/nsXULAppAPI.h +++ b/xpcom/build/nsXULAppAPI.h @@ -155,12 +155,12 @@ XRE_API(int, /** * Given a path relative to the current working directory (or an absolute - * path), return an appropriate nsILocalFile object. + * path), return an appropriate nsIFile object. * * @note Pass UTF8 strings on Windows... native charset on other platforms. */ XRE_API(nsresult, - XRE_GetFileFromPath, (const char *aPath, nsILocalFile* *aResult)) + XRE_GetFileFromPath, (const char *aPath, nsIFile* *aResult)) /** * Get the path of the running application binary and store it in aResult. @@ -169,7 +169,7 @@ XRE_API(nsresult, * the binary path have failed. */ XRE_API(nsresult, - XRE_GetBinaryPath, (const char *argv0, nsILocalFile* *aResult)) + XRE_GetBinaryPath, (const char *argv0, nsIFile* *aResult)) /** * Get the static module built in to libxul. @@ -185,7 +185,7 @@ XRE_API(const mozilla::Module*, * as long as the XPCOM reference is held. */ XRE_API(nsresult, - XRE_LockProfileDirectory, (nsILocalFile* aDirectory, + XRE_LockProfileDirectory, (nsIFile* aDirectory, nsISupports* *aLockObject)) /** @@ -209,8 +209,8 @@ XRE_API(nsresult, */ XRE_API(nsresult, - XRE_InitEmbedding2, (nsILocalFile *aLibXULDirectory, - nsILocalFile *aAppDirectory, + XRE_InitEmbedding2, (nsIFile *aLibXULDirectory, + nsIFile *aAppDirectory, nsIDirectoryServiceProvider *aAppDirProvider)) /** @@ -245,7 +245,7 @@ enum NSLocationType XRE_API(nsresult, XRE_AddManifestLocation, (NSLocationType aType, - nsILocalFile* aLocation)) + nsIFile* aLocation)) /** * Register XPCOM components found in a JAR. @@ -266,7 +266,7 @@ XRE_API(nsresult, */ XRE_API(nsresult, XRE_AddJarManifestLocation, (NSLocationType aType, - nsILocalFile* aLocation)) + nsIFile* aLocation)) /** * Fire notifications to inform the toolkit about a new profile. This @@ -312,7 +312,7 @@ XRE_API(void, * XRE_FreeAppData. */ XRE_API(nsresult, - XRE_CreateAppData, (nsILocalFile* aINIFile, + XRE_CreateAppData, (nsIFile* aINIFile, nsXREAppData **aAppData)) /** @@ -323,7 +323,7 @@ XRE_API(nsresult, * @param aAppData The nsXREAppData structure to fill. */ XRE_API(nsresult, - XRE_ParseAppData, (nsILocalFile* aINIFile, + XRE_ParseAppData, (nsIFile* aINIFile, nsXREAppData *aAppData)) /** @@ -367,7 +367,7 @@ XRE_API(GeckoProcessType, #if defined(MOZ_CRASHREPORTER) // Used in the "master" parent process hosting the crash server XRE_API(bool, - XRE_TakeMinidumpForChild, (PRUint32 aChildPid, nsILocalFile** aDump)) + XRE_TakeMinidumpForChild, (PRUint32 aChildPid, nsIFile** aDump)) // Used in child processes. XRE_API(bool, @@ -440,8 +440,8 @@ XRE_API(void, XRE_TelemetryAccumulate, (int aID, PRUint32 aSample)) XRE_API(void, - XRE_InitOmnijar, (nsILocalFile* greOmni, - nsILocalFile* appOmni)) + XRE_InitOmnijar, (nsIFile* greOmni, + nsIFile* appOmni)) #ifdef XP_WIN /** diff --git a/xpcom/components/ManifestParser.h b/xpcom/components/ManifestParser.h index f0eb5a459f5..86b6ef031b0 100644 --- a/xpcom/components/ManifestParser.h +++ b/xpcom/components/ManifestParser.h @@ -10,7 +10,7 @@ #include "nsChromeRegistry.h" #include "mozilla/FileLocation.h" -class nsILocalFile; +class nsIFile; void ParseManifest(NSLocationType type, mozilla::FileLocation &file, char* buf, bool aChromeOnly); diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index eaf0c7cb244..e4de8b32f59 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -209,7 +209,7 @@ ArenaStrdup(const char *s, PLArenaPool *arena) } // this is safe to call during InitXPCOM -static already_AddRefed +static already_AddRefed GetLocationFromDirectoryService(const char* prop) { nsCOMPtr directoryService; @@ -220,9 +220,9 @@ GetLocationFromDirectoryService(const char* prop) if (!directoryService) return NULL; - nsCOMPtr file; + nsCOMPtr file; nsresult rv = directoryService->Get(prop, - NS_GET_IID(nsILocalFile), + NS_GET_IID(nsIFile), getter_AddRefs(file)); if (NS_FAILED(rv)) return NULL; @@ -230,17 +230,16 @@ GetLocationFromDirectoryService(const char* prop) return file.forget(); } -static already_AddRefed -CloneAndAppend(nsILocalFile* aBase, const nsACString& append) +static already_AddRefed +CloneAndAppend(nsIFile* aBase, const nsACString& append) { nsCOMPtr f; aBase->Clone(getter_AddRefs(f)); if (!f) return NULL; - nsCOMPtr lf = do_QueryInterface(f); f->AppendNative(append); - return lf.forget(); + return f.forget(); } //////////////////////////////////////////////////////////////////////////////// @@ -313,16 +312,16 @@ nsresult nsComponentManagerImpl::Init() mLoaderMap.Init(); mKnownModules.Init(); - nsCOMPtr greDir = + nsCOMPtr greDir = GetLocationFromDirectoryService(NS_GRE_DIR); - nsCOMPtr appDir = + nsCOMPtr appDir = GetLocationFromDirectoryService(NS_XPCOM_CURRENT_PROCESS_DIR); InitializeStaticModules(); InitializeModuleLocations(); ComponentLocation* cl = sModuleLocations->InsertElementAt(0); - nsCOMPtr lf = CloneAndAppend(appDir, NS_LITERAL_CSTRING("chrome.manifest")); + nsCOMPtr lf = CloneAndAppend(appDir, NS_LITERAL_CSTRING("chrome.manifest")); cl->type = NS_COMPONENT_LOCATION; cl->location.Init(lf); @@ -1535,11 +1534,7 @@ nsComponentManagerImpl::UnregisterFactory(const nsCID& aClass, NS_IMETHODIMP nsComponentManagerImpl::AutoRegister(nsIFile* aLocation) { - nsCOMPtr lf = do_QueryInterface(aLocation); - if (!lf) - return NS_ERROR_INVALID_ARG; - - XRE_AddManifestLocation(NS_COMPONENT_LOCATION, lf); + XRE_AddManifestLocation(NS_COMPONENT_LOCATION, aLocation); return NS_OK; } @@ -1774,7 +1769,7 @@ XRE_AddStaticComponent(const mozilla::Module* aComponent) } NS_IMETHODIMP -nsComponentManagerImpl::AddBootstrappedManifestLocation(nsILocalFile* aLocation) +nsComponentManagerImpl::AddBootstrappedManifestLocation(nsIFile* aLocation) { nsString path; nsresult rv = aLocation->GetPath(path); @@ -1785,19 +1780,19 @@ nsComponentManagerImpl::AddBootstrappedManifestLocation(nsILocalFile* aLocation) return XRE_AddJarManifestLocation(NS_BOOTSTRAPPED_LOCATION, aLocation); } - nsCOMPtr manifest = + nsCOMPtr manifest = CloneAndAppend(aLocation, NS_LITERAL_CSTRING("chrome.manifest")); return XRE_AddManifestLocation(NS_BOOTSTRAPPED_LOCATION, manifest); } NS_IMETHODIMP -nsComponentManagerImpl::RemoveBootstrappedManifestLocation(nsILocalFile* aLocation) +nsComponentManagerImpl::RemoveBootstrappedManifestLocation(nsIFile* aLocation) { nsCOMPtr cr = mozilla::services::GetChromeRegistryService(); if (!cr) return NS_ERROR_FAILURE; - nsCOMPtr manifest; + nsCOMPtr manifest; nsString path; nsresult rv = aLocation->GetPath(path); if (NS_FAILED(rv)) @@ -1809,7 +1804,7 @@ nsComponentManagerImpl::RemoveBootstrappedManifestLocation(nsILocalFile* aLocati if (Substring(path, path.Length() - 4).Equals(NS_LITERAL_STRING(".xpi"))) { elem.location.Init(aLocation, "chrome.manifest"); } else { - nsCOMPtr lf = CloneAndAppend(aLocation, NS_LITERAL_CSTRING("chrome.manifest")); + nsCOMPtr lf = CloneAndAppend(aLocation, NS_LITERAL_CSTRING("chrome.manifest")); elem.location.Init(lf); } @@ -1821,7 +1816,7 @@ nsComponentManagerImpl::RemoveBootstrappedManifestLocation(nsILocalFile* aLocati } EXPORT_XPCOM_API(nsresult) -XRE_AddManifestLocation(NSLocationType aType, nsILocalFile* aLocation) +XRE_AddManifestLocation(NSLocationType aType, nsIFile* aLocation) { nsComponentManagerImpl::InitializeModuleLocations(); nsComponentManagerImpl::ComponentLocation* c = @@ -1837,7 +1832,7 @@ XRE_AddManifestLocation(NSLocationType aType, nsILocalFile* aLocation) } EXPORT_XPCOM_API(nsresult) -XRE_AddJarManifestLocation(NSLocationType aType, nsILocalFile* aLocation) +XRE_AddJarManifestLocation(NSLocationType aType, nsIFile* aLocation) { nsComponentManagerImpl::InitializeModuleLocations(); nsComponentManagerImpl::ComponentLocation* c = diff --git a/xpcom/components/nsComponentManager.h b/xpcom/components/nsComponentManager.h index 2bc997cd3fa..2c3c422ef41 100644 --- a/xpcom/components/nsComponentManager.h +++ b/xpcom/components/nsComponentManager.h @@ -12,7 +12,7 @@ #include "nsIComponentManager.h" #include "nsIComponentRegistrar.h" #include "nsIServiceManager.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "mozilla/Module.h" #include "mozilla/ModuleLoader.h" #include "mozilla/ReentrantMonitor.h" @@ -26,7 +26,6 @@ #include "nsCOMPtr.h" #include "nsAutoPtr.h" #include "nsWeakReference.h" -#include "nsIFile.h" #include "plarena.h" #include "nsCOMArray.h" #include "nsDataHashtable.h" @@ -87,7 +86,7 @@ public: nsresult RegistryLocationForFile(nsIFile* aFile, nsCString& aResult); nsresult FileForRegistryLocation(const nsCString &aLocation, - nsILocalFile **aSpec); + nsIFile **aSpec); NS_DECL_NSISERVICEMANAGER diff --git a/xpcom/components/nsIComponentManager.idl b/xpcom/components/nsIComponentManager.idl index 6cecd4e4934..bd3922b0662 100644 --- a/xpcom/components/nsIComponentManager.idl +++ b/xpcom/components/nsIComponentManager.idl @@ -9,7 +9,7 @@ #include "nsISupports.idl" -interface nsILocalFile; +interface nsIFile; interface nsIFactory; [scriptable, uuid(1d940426-5fe5-42c3-84ae-a300f2d9ebd5)] @@ -77,7 +77,7 @@ interface nsIComponentManager : nsISupports * @param aLocation : A directory where chrome.manifest resides, * or an XPI with it on the root. */ - void addBootstrappedManifestLocation(in nsILocalFile aLocation); + void addBootstrappedManifestLocation(in nsIFile aLocation); /** * removeBootstrappedManifestLocation @@ -87,7 +87,7 @@ interface nsIComponentManager : nsISupports * @param aLocation : A directory where chrome.manifest resides, * or an XPI with it on the root. */ - void removeBootstrappedManifestLocation(in nsILocalFile aLocation); + void removeBootstrappedManifestLocation(in nsIFile aLocation); }; diff --git a/xpcom/components/nsNativeComponentLoader.cpp b/xpcom/components/nsNativeComponentLoader.cpp index 7b985c3325b..aefde7fffa5 100644 --- a/xpcom/components/nsNativeComponentLoader.cpp +++ b/xpcom/components/nsNativeComponentLoader.cpp @@ -31,7 +31,7 @@ #include "nsThreadUtils.h" #include "nsTraceRefcntImpl.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #ifdef XP_WIN #include @@ -105,7 +105,7 @@ nsNativeModuleLoader::LoadModule(FileLocation &aFile) NS_ERROR("Binary components cannot be loaded from JARs"); return NULL; } - nsCOMPtr file = aFile.GetBaseFile(); + nsCOMPtr file = aFile.GetBaseFile(); nsresult rv; if (!NS_IsMainThread()) { diff --git a/xpcom/ds/nsIINIParser.idl b/xpcom/ds/nsIINIParser.idl index 453ae8a01f9..166828e5d33 100644 --- a/xpcom/ds/nsIINIParser.idl +++ b/xpcom/ds/nsIINIParser.idl @@ -5,7 +5,7 @@ #include "nsISupports.idl" interface nsIUTF8StringEnumerator; -interface nsILocalFile; +interface nsIFile; [scriptable, uuid(7eb955f6-3e78-4d39-b72f-c1bf12a94bce)] interface nsIINIParser : nsISupports @@ -44,7 +44,7 @@ interface nsIINIParserWriter : nsISupports /** * Write to the INI file. */ - void writeFile([optional] in nsILocalFile aINIFile, + void writeFile([optional] in nsIFile aINIFile, [optional] in unsigned long aFlags); }; @@ -54,5 +54,5 @@ interface nsIINIParserFactory : nsISupports /** * Create an iniparser instance from a local file. */ - nsIINIParser createINIParser(in nsILocalFile aINIFile); + nsIINIParser createINIParser(in nsIFile aINIFile); }; diff --git a/xpcom/ds/nsINIParserImpl.cpp b/xpcom/ds/nsINIParserImpl.cpp index f74521809b7..7dd033ffd52 100644 --- a/xpcom/ds/nsINIParserImpl.cpp +++ b/xpcom/ds/nsINIParserImpl.cpp @@ -4,7 +4,7 @@ #include "nsINIParserImpl.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsINIParser.h" #include "nsStringEnumerator.h" @@ -17,7 +17,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIINIPARSER - nsresult Init(nsILocalFile* aINIFile) { + nsresult Init(nsIFile* aINIFile) { return mParser.Init(aINIFile); } @@ -30,7 +30,7 @@ NS_IMPL_ISUPPORTS2(nsINIParserFactory, nsIFactory) NS_IMETHODIMP -nsINIParserFactory::CreateINIParser(nsILocalFile* aINIFile, +nsINIParserFactory::CreateINIParser(nsIFile* aINIFile, nsIINIParser* *aResult) { *aResult = nsnull; diff --git a/xpcom/glue/nsINIParser.cpp b/xpcom/glue/nsINIParser.cpp index e79b0314dd7..b6ebf9feedd 100644 --- a/xpcom/glue/nsINIParser.cpp +++ b/xpcom/glue/nsINIParser.cpp @@ -6,7 +6,7 @@ // Moz headers (alphabetical) #include "nsCRTGlue.h" #include "nsError.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsINIParser.h" #include "mozilla/FileUtils.h" // AutoFILE @@ -54,7 +54,7 @@ private: }; nsresult -nsINIParser::Init(nsILocalFile* aFile) +nsINIParser::Init(nsIFile* aFile) { /* open the file. Don't use OpenANSIFileDesc, because you mustn't pass FILE* across shared library boundaries, which may be using diff --git a/xpcom/glue/nsINIParser.h b/xpcom/glue/nsINIParser.h index 96dc624a1f2..57e12589627 100644 --- a/xpcom/glue/nsINIParser.h +++ b/xpcom/glue/nsINIParser.h @@ -18,7 +18,7 @@ #include -class nsILocalFile; +class nsIFile; class NS_COM_GLUE nsINIParser { @@ -27,12 +27,12 @@ public: ~nsINIParser() { } /** - * Initialize the INIParser with a nsILocalFile. If this method fails, no + * Initialize the INIParser with a nsIFile. If this method fails, no * other methods should be called. This method reads and parses the file, * the class does not hold a file handle open. An instance must only be * initialized once. */ - nsresult Init(nsILocalFile* aFile); + nsresult Init(nsIFile* aFile); /** * Initialize the INIParser with a file path. If this method fails, no diff --git a/xpcom/glue/standalone/nsXPCOMGlue.cpp b/xpcom/glue/standalone/nsXPCOMGlue.cpp index d92e20390ee..1433d7e552a 100644 --- a/xpcom/glue/standalone/nsXPCOMGlue.cpp +++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp @@ -169,7 +169,7 @@ NS_GetMemoryManager(nsIMemory* *result) } XPCOM_API(nsresult) -NS_NewLocalFile(const nsAString &path, bool followLinks, nsILocalFile* *result) +NS_NewLocalFile(const nsAString &path, bool followLinks, nsIFile* *result) { if (!xpcomFunctions.newLocalFile) return NS_ERROR_NOT_INITIALIZED; @@ -177,7 +177,7 @@ NS_NewLocalFile(const nsAString &path, bool followLinks, nsILocalFile* *result) } XPCOM_API(nsresult) -NS_NewNativeLocalFile(const nsACString &path, bool followLinks, nsILocalFile* *result) +NS_NewNativeLocalFile(const nsACString &path, bool followLinks, nsIFile* *result) { if (!xpcomFunctions.newNativeLocalFile) return NS_ERROR_NOT_INITIALIZED; diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp index 751bc24204c..8f80bbbff1d 100644 --- a/xpcom/io/SpecialSystemDirectory.cpp +++ b/xpcom/io/SpecialSystemDirectory.cpp @@ -82,7 +82,7 @@ void StartupSpecialSystemDirectory() #if defined (XP_WIN) -static nsresult GetKnownFolder(GUID* guid, nsILocalFile** aFile) +static nsresult GetKnownFolder(GUID* guid, nsIFile** aFile) { if (!guid || !gGetKnownFolderPath) return NS_ERROR_FAILURE; @@ -102,7 +102,7 @@ static nsresult GetKnownFolder(GUID* guid, nsILocalFile** aFile) } //---------------------------------------------------------------------------------------- -static nsresult GetWindowsFolder(int folder, nsILocalFile** aFile) +static nsresult GetWindowsFolder(int folder, nsIFile** aFile) //---------------------------------------------------------------------------------------- { WCHAR path_orig[MAX_PATH + 3]; @@ -128,7 +128,7 @@ static nsresult GetWindowsFolder(int folder, nsILocalFile** aFile) * querying the registry when the call to SHGetSpecialFolderPathW is unable to * provide these paths (Bug 513958). */ -static nsresult GetRegWindowsAppDataFolder(bool aLocal, nsILocalFile** aFile) +static nsresult GetRegWindowsAppDataFolder(bool aLocal, nsIFile** aFile) { HKEY key; NS_NAMED_LITERAL_STRING(keyName, @@ -163,7 +163,7 @@ static nsresult GetRegWindowsAppDataFolder(bool aLocal, nsILocalFile** aFile) #if defined(XP_UNIX) static nsresult -GetUnixHomeDir(nsILocalFile** aFile) +GetUnixHomeDir(nsIFile** aFile) { #ifdef VMS char *pHome; @@ -358,14 +358,14 @@ static const PRUint8 xdg_user_dir_offsets[] = { static nsresult GetUnixXDGUserDirectory(SystemDirectories aSystemDirectory, - nsILocalFile** aFile) + nsIFile** aFile) { char *dir = xdg_user_dir_lookup (xdg_user_dirs + xdg_user_dir_offsets[aSystemDirectory - Unix_XDG_Desktop]); nsresult rv; - nsCOMPtr file; + nsCOMPtr file; if (dir) { rv = NS_NewNativeLocalFile(nsDependentCString(dir), true, getter_AddRefs(file)); @@ -422,7 +422,7 @@ GetUnixXDGUserDirectory(SystemDirectories aSystemDirectory, nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, - nsILocalFile** aFile) + nsIFile** aFile) { #if defined(XP_WIN) WCHAR path[MAX_PATH]; @@ -852,7 +852,7 @@ GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, #if defined (MOZ_WIDGET_COCOA) nsresult -GetOSXFolderType(short aDomain, OSType aFolderType, nsILocalFile **localFile) +GetOSXFolderType(short aDomain, OSType aFolderType, nsIFile **localFile) { OSErr err; FSRef fsRef; diff --git a/xpcom/io/SpecialSystemDirectory.h b/xpcom/io/SpecialSystemDirectory.h index c0dcfa47931..1d884de3545 100644 --- a/xpcom/io/SpecialSystemDirectory.h +++ b/xpcom/io/SpecialSystemDirectory.h @@ -7,7 +7,7 @@ #define _SPECIALSYSTEMDIRECTORY_H_ #include "nscore.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #ifdef MOZ_WIDGET_COCOA #include @@ -95,10 +95,10 @@ enum SystemDirectories { nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, - nsILocalFile** aFile); + nsIFile** aFile); #ifdef MOZ_WIDGET_COCOA nsresult -GetOSXFolderType(short aDomain, OSType aFolderType, nsILocalFile **localFile); +GetOSXFolderType(short aDomain, OSType aFolderType, nsIFile **localFile); #endif #endif diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocationProvider.cpp index e694860638b..895c932e476 100644 --- a/xpcom/io/nsAppFileLocationProvider.cpp +++ b/xpcom/io/nsAppFileLocationProvider.cpp @@ -7,7 +7,7 @@ #include "nsAppDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h" #include "nsIAtom.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsString.h" #include "nsXPIDLString.h" #include "nsISimpleEnumerator.h" @@ -87,7 +87,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS2(nsAppFileLocationProvider, nsIDirectoryServiceProv NS_IMETHODIMP nsAppFileLocationProvider::GetFile(const char *prop, bool *persistent, nsIFile **_retval) { - nsCOMPtr localFile; + nsCOMPtr localFile; nsresult rv = NS_ERROR_FAILURE; NS_ENSURE_ARG(prop); @@ -246,7 +246,7 @@ nsAppFileLocationProvider::GetFile(const char *prop, bool *persistent, nsIFile * } -NS_METHOD nsAppFileLocationProvider::CloneMozBinDirectory(nsILocalFile **aLocalFile) +NS_METHOD nsAppFileLocationProvider::CloneMozBinDirectory(nsIFile **aLocalFile) { NS_ENSURE_ARG_POINTER(aLocalFile); nsresult rv; @@ -275,11 +275,7 @@ NS_METHOD nsAppFileLocationProvider::CloneMozBinDirectory(nsILocalFile **aLocalF if (NS_FAILED(rv)) return rv; - nsCOMPtr lfile = do_QueryInterface (aFile); - if (!lfile) - return NS_ERROR_FAILURE; - - NS_IF_ADDREF(*aLocalFile = lfile); + NS_IF_ADDREF(*aLocalFile = aFile); return NS_OK; } @@ -291,13 +287,13 @@ NS_METHOD nsAppFileLocationProvider::CloneMozBinDirectory(nsILocalFile **aLocalF // WIN : \Mozilla // Mac : :Documents:Mozilla: //---------------------------------------------------------------------------------------- -NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsILocalFile **aLocalFile, bool aLocal) +NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsIFile **aLocalFile, bool aLocal) { NS_ENSURE_ARG_POINTER(aLocalFile); nsresult rv; bool exists; - nsCOMPtr localDir; + nsCOMPtr localDir; #if defined(MOZ_WIDGET_COCOA) FSRef fsRef; @@ -313,14 +309,14 @@ NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsILocalFile **aLocalFi nsCOMPtr directoryService = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; - rv = directoryService->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(localDir)); + rv = directoryService->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsIFile), getter_AddRefs(localDir)); if (NS_FAILED(rv)) return rv; #elif defined(XP_WIN) nsCOMPtr directoryService = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; const char* prop = aLocal ? NS_WIN_LOCAL_APPDATA_DIR : NS_WIN_APPDATA_DIR; - rv = directoryService->Get(prop, NS_GET_IID(nsILocalFile), getter_AddRefs(localDir)); + rv = directoryService->Get(prop, NS_GET_IID(nsIFile), getter_AddRefs(localDir)); if (NS_FAILED(rv)) return rv; #elif defined(XP_UNIX) rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true, getter_AddRefs(localDir)); @@ -352,12 +348,12 @@ NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsILocalFile **aLocalFi // WIN : \Mozilla\Profiles // Mac : :Documents:Mozilla:Profiles: //---------------------------------------------------------------------------------------- -NS_METHOD nsAppFileLocationProvider::GetDefaultUserProfileRoot(nsILocalFile **aLocalFile, bool aLocal) +NS_METHOD nsAppFileLocationProvider::GetDefaultUserProfileRoot(nsIFile **aLocalFile, bool aLocal) { NS_ENSURE_ARG_POINTER(aLocalFile); nsresult rv; - nsCOMPtr localDir; + nsCOMPtr localDir; rv = GetProductDirectory(getter_AddRefs(localDir), aLocal); if (NS_FAILED(rv)) return rv; @@ -485,7 +481,7 @@ class nsPathsDirectoryEnumerator : public nsAppDirectoryEnumerator do { ++mEndPath; } while (*mEndPath && *mEndPath != PATH_SEPARATOR); - nsCOMPtr localFile; + nsCOMPtr localFile; NS_NewNativeLocalFile(Substring(pathVar, mEndPath), true, getter_AddRefs(localFile)); diff --git a/xpcom/io/nsAppFileLocationProvider.h b/xpcom/io/nsAppFileLocationProvider.h index 2e2726d1220..840b2f22505 100644 --- a/xpcom/io/nsAppFileLocationProvider.h +++ b/xpcom/io/nsAppFileLocationProvider.h @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIDirectoryService.h" -#include "nsILocalFile.h" +#include "nsIFile.h" class nsIFile; @@ -25,7 +25,7 @@ private: ~nsAppFileLocationProvider() {} protected: - NS_METHOD CloneMozBinDirectory(nsILocalFile **aLocalFile); + NS_METHOD CloneMozBinDirectory(nsIFile **aLocalFile); /** * Get the product directory. This is a user-specific directory for storing * application settings (e.g. the Application Data directory on windows @@ -33,14 +33,14 @@ protected: * @param aLocal If true, should try to get a directory that is only stored * locally (ie not transferred with roaming profiles) */ - NS_METHOD GetProductDirectory(nsILocalFile **aLocalFile, + NS_METHOD GetProductDirectory(nsIFile **aLocalFile, bool aLocal = false); - NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile, + NS_METHOD GetDefaultUserProfileRoot(nsIFile **aLocalFile, bool aLocal = false); #if defined(MOZ_WIDGET_COCOA) static bool IsOSXLeopard(); #endif - nsCOMPtr mMozBinDirectory; + nsCOMPtr mMozBinDirectory; }; diff --git a/xpcom/io/nsDirectoryService.cpp b/xpcom/io/nsDirectoryService.cpp index 342ea71455e..1cee8afd720 100644 --- a/xpcom/io/nsDirectoryService.cpp +++ b/xpcom/io/nsDirectoryService.cpp @@ -58,7 +58,7 @@ using namespace mozilla; //---------------------------------------------------------------------------------------- nsresult -nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile) +nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile) //---------------------------------------------------------------------------------------- { NS_ENSURE_ARG_POINTER(aFile); @@ -77,8 +77,8 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile) if (dirService) { - nsCOMPtr aLocalFile; - dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(aLocalFile)); + nsCOMPtr aLocalFile; + dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(aLocalFile)); if (aLocalFile) { *aFile = aLocalFile; @@ -547,7 +547,7 @@ nsDirectoryService::UnregisterProvider(nsIDirectoryServiceProvider *prov) NS_IMETHODIMP nsDirectoryService::GetFile(const char *prop, bool *persistent, nsIFile **_retval) { - nsCOMPtr localFile; + nsCOMPtr localFile; nsresult rv = NS_ERROR_FAILURE; *_retval = nsnull; diff --git a/xpcom/io/nsDirectoryService.h b/xpcom/io/nsDirectoryService.h index 3ad37636b17..5fd79ce7035 100644 --- a/xpcom/io/nsDirectoryService.h +++ b/xpcom/io/nsDirectoryService.h @@ -8,7 +8,7 @@ #include "nsIDirectoryService.h" #include "nsHashtable.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsISupportsArray.h" #include "nsIAtom.h" @@ -45,7 +45,7 @@ class nsDirectoryService : public nsIDirectoryService, static nsDirectoryService* gService; private: - nsresult GetCurrentProcessDirectory(nsILocalFile** aFile); + nsresult GetCurrentProcessDirectory(nsIFile** aFile); static bool ReleaseValues(nsHashKey* key, void* data, void* closure); nsSupportsHashtable mHashtable; diff --git a/xpcom/io/nsIFile.idl b/xpcom/io/nsIFile.idl index 5240e28c2b5..c18e28ac479 100644 --- a/xpcom/io/nsIFile.idl +++ b/xpcom/io/nsIFile.idl @@ -311,7 +311,7 @@ interface nsIFile : nsISupports /** * initWith[Native]Path * - * This function will initialize the nsILocalFile object. Any + * This function will initialize the nsIFile object. Any * internal state information will be reset. * * @param filePath @@ -379,7 +379,7 @@ interface nsIFile : nsISupports /** * appendRelative[Native]Path * - * Append a relative path to the current path of the nsILocalFile object. + * Append a relative path to the current path of the nsIFile object. * * @param relativeFilePath * relativeFilePath is a native relative path. For security reasons, diff --git a/xpcom/io/nsILocalFileMac.idl b/xpcom/io/nsILocalFileMac.idl index e9cf58d620d..d312c769005 100644 --- a/xpcom/io/nsILocalFileMac.idl +++ b/xpcom/io/nsILocalFileMac.idl @@ -118,11 +118,11 @@ interface nsILocalFileMac : nsILocalFile * * Launch the application that this file points to with a document. * - * @param aDocToLoad Must not be NULL. If no document, use nsILocalFile::launch + * @param aDocToLoad Must not be NULL. If no document, use nsIFile::launch * @param aLaunchInBackground TRUE if the application should not come to the front. * */ - void launchWithDoc(in nsILocalFile aDocToLoad, in boolean aLaunchInBackground); + void launchWithDoc(in nsIFile aDocToLoad, in boolean aLaunchInBackground); /** * openDocWithApp @@ -135,7 +135,7 @@ interface nsILocalFileMac : nsILocalFile * @param aLaunchInBackground TRUE if the application should not come to the front. * */ - void openDocWithApp(in nsILocalFile aAppToOpenWith, in boolean aLaunchInBackground); + void openDocWithApp(in nsIFile aAppToOpenWith, in boolean aLaunchInBackground); /** * isPackage diff --git a/xpcom/io/nsILocalFileWin.idl b/xpcom/io/nsILocalFileWin.idl index b8fed2ebc7f..a416ae16d22 100644 --- a/xpcom/io/nsILocalFileWin.idl +++ b/xpcom/io/nsILocalFileWin.idl @@ -22,7 +22,7 @@ interface nsILocalFileWin : nsILocalFile /** * The canonical path of the file, which avoids short/long - * pathname inconsistencies. The nsILocalFile persistent + * pathname inconsistencies. The nsIFile persistent * descriptor is not guaranteed to be canonicalized (it may * persist either the long or the short path name). The format of * the canonical path will vary with the underlying file system: @@ -88,11 +88,11 @@ interface nsILocalFileWin : nsILocalFile iconFile. If iconFile contains only one icon, this value should be 0. */ - void setShortcut([optional] in nsILocalFile targetFile, - [optional] in nsILocalFile workingDir, + void setShortcut([optional] in nsIFile targetFile, + [optional] in nsIFile workingDir, [optional] in wstring args, [optional] in wstring description, - [optional] in nsILocalFile iconFile, + [optional] in nsIFile iconFile, [optional] in long iconIndex); }; diff --git a/xpcom/io/nsLocalFileOS2.cpp b/xpcom/io/nsLocalFileOS2.cpp index 75fce3325e4..3c64180ed5d 100644 --- a/xpcom/io/nsLocalFileOS2.cpp +++ b/xpcom/io/nsLocalFileOS2.cpp @@ -243,7 +243,7 @@ class nsDirEnumerator : public nsISimpleEnumerator, { } - nsresult Init(nsILocalFile* parent) + nsresult Init(nsIFile* parent) { nsCAutoString filepath; parent->GetNativeTarget(filepath); @@ -358,9 +358,9 @@ class nsDirEnumerator : public nsISimpleEnumerator, } protected: - PRDir* mDir; - nsCOMPtr mParent; - nsCOMPtr mNext; + PRDir* mDir; + nsCOMPtr mParent; + nsCOMPtr mNext; }; NS_IMPL_ISUPPORTS2(nsDirEnumerator, nsISimpleEnumerator, nsIDirectoryEnumerator) @@ -439,7 +439,7 @@ NS_IMETHODIMP nsDriveEnumerator::GetNext(nsISupports **aNext) mDrives >>= 1; mLetter++; - nsILocalFile *file; + nsIFile *file; nsresult rv = NS_NewNativeLocalFile(nsDependentCString(drive), false, &file); *aNext = file; @@ -1993,7 +1993,7 @@ nsLocalFile::GetParent(nsIFile * *aParent) else parentPath.AssignLiteral("\\\\."); - nsCOMPtr localFile; + nsCOMPtr localFile; nsresult rv = NS_NewNativeLocalFile(parentPath, false, getter_AddRefs(localFile)); if(NS_SUCCEEDED(rv) && localFile) @@ -2375,7 +2375,7 @@ nsLocalFile::Launch() } nsresult -NS_NewNativeLocalFile(const nsACString &path, bool followLinks, nsILocalFile* *result) +NS_NewNativeLocalFile(const nsACString &path, bool followLinks, nsIFile* *result) { nsLocalFile* file = new nsLocalFile(); if (file == nsnull) @@ -2546,7 +2546,7 @@ nsLocalFile::GetHashCode(PRUint32 *aResult) } nsresult -NS_NewLocalFile(const nsAString &path, bool followLinks, nsILocalFile* *result) +NS_NewLocalFile(const nsAString &path, bool followLinks, nsIFile* *result) { nsCAutoString buf; nsresult rv = NS_CopyUnicodeToNative(path, buf); diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index a7b0e1beea9..0d3d1c76ba7 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -204,7 +204,7 @@ nsDirEnumeratorUnix::GetNextFile(nsIFile **_retval) return NS_OK; } - nsCOMPtr file = new nsLocalFile(); + nsCOMPtr file = new nsLocalFile(); if (!file) return NS_ERROR_OUT_OF_MEMORY; @@ -699,8 +699,7 @@ nsLocalFile::CopyDirectoryTo(nsIFile *newParent) nsCOMPtr destClone; rv = newParent->Clone(getter_AddRefs(destClone)); if (NS_SUCCEEDED(rv)) { - nsCOMPtr newDir(do_QueryInterface(destClone)); - if (NS_FAILED(rv = entry->CopyToNative(newDir, EmptyCString()))) { + if (NS_FAILED(rv = entry->CopyToNative(destClone, EmptyCString()))) { #ifdef DEBUG nsresult rv2; nsCAutoString pathName; @@ -780,7 +779,7 @@ nsLocalFile::CopyToNative(nsIFile *newParent, const nsACString &newName) if (!newFile) return NS_ERROR_OUT_OF_MEMORY; - nsCOMPtr fileRef(newFile); // release on exit + nsCOMPtr fileRef(newFile); // release on exit rv = newFile->InitWithNativePath(newPathName); if (NS_FAILED(rv)) @@ -1320,7 +1319,7 @@ nsLocalFile::GetParent(nsIFile **aParent) char c = *slashp; *slashp = '\0'; - nsCOMPtr localFile; + nsCOMPtr localFile; nsresult rv = NS_NewNativeLocalFile(nsDependentCString(buffer), true, getter_AddRefs(localFile)); @@ -1601,12 +1600,9 @@ nsLocalFile::GetNativeTarget(nsACString &_retval) nsCOMPtr parent; if (NS_FAILED(rv = self->GetParent(getter_AddRefs(parent)))) break; - nsCOMPtr localFile(do_QueryInterface(parent, &rv)); - if (NS_FAILED(rv)) + if (NS_FAILED(rv = parent->AppendRelativeNativePath(nsDependentCString(target)))) break; - if (NS_FAILED(rv = localFile->AppendRelativeNativePath(nsDependentCString(target)))) - break; - if (NS_FAILED(rv = localFile->GetNativePath(_retval))) + if (NS_FAILED(rv = parent->GetNativePath(_retval))) break; self = parent; } else { @@ -1879,7 +1875,7 @@ nsLocalFile::Launch() } nsresult -NS_NewNativeLocalFile(const nsACString &path, bool followSymlinks, nsILocalFile **result) +NS_NewNativeLocalFile(const nsACString &path, bool followSymlinks, nsIFile **result) { nsLocalFile *file = new nsLocalFile(); if (!file) @@ -2003,7 +1999,7 @@ nsLocalFile::GetHashCode(PRUint32 *aResult) } nsresult -NS_NewLocalFile(const nsAString &path, bool followLinks, nsILocalFile* *result) +NS_NewLocalFile(const nsAString &path, bool followLinks, nsIFile* *result) { nsCAutoString buf; nsresult rv = NS_CopyUnicodeToNative(path, buf); @@ -2247,7 +2243,7 @@ nsLocalFile::SetFileCreator(OSType aFileCreator) } NS_IMETHODIMP -nsLocalFile::LaunchWithDoc(nsILocalFile *aDocToLoad, bool aLaunchInBackground) +nsLocalFile::LaunchWithDoc(nsIFile *aDocToLoad, bool aLaunchInBackground) { bool isExecutable; nsresult rv = IsExecutable(&isExecutable); @@ -2290,7 +2286,7 @@ nsLocalFile::LaunchWithDoc(nsILocalFile *aDocToLoad, bool aLaunchInBackground) } NS_IMETHODIMP -nsLocalFile::OpenDocWithApp(nsILocalFile *aAppToOpenWith, bool aLaunchInBackground) +nsLocalFile::OpenDocWithApp(nsIFile *aAppToOpenWith, bool aLaunchInBackground) { FSRef docFSRef; nsresult rv = GetFSRef(&docFSRef); diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index 1069d21b4b9..fc89683c5fb 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -623,11 +623,11 @@ OpenFile(const nsAFlatString &name, PRIntn osflags, PRIntn mode, flags = OPEN_EXISTING; } - if (osflags & nsILocalFile::DELETE_ON_CLOSE) { + if (osflags & nsIFile::DELETE_ON_CLOSE) { flag6 |= FILE_FLAG_DELETE_ON_CLOSE; } - if (osflags & nsILocalFile::OS_READAHEAD) { + if (osflags & nsIFile::OS_READAHEAD) { flag6 |= FILE_FLAG_SEQUENTIAL_SCAN; } @@ -826,7 +826,7 @@ class nsDirEnumerator : public nsISimpleEnumerator, { } - nsresult Init(nsILocalFile* parent) + nsresult Init(nsIFile* parent) { nsAutoString filepath; parent->GetTarget(filepath); @@ -934,9 +934,9 @@ class nsDirEnumerator : public nsISimpleEnumerator, } protected: - nsDir* mDir; - nsCOMPtr mParent; - nsCOMPtr mNext; + nsDir* mDir; + nsCOMPtr mParent; + nsCOMPtr mNext; }; NS_IMPL_ISUPPORTS2(nsDirEnumerator, nsISimpleEnumerator, nsIDirectoryEnumerator) @@ -1676,11 +1676,11 @@ nsLocalFile::GetVersionInfoField(const char* aField, nsAString& _retval) } NS_IMETHODIMP -nsLocalFile::SetShortcut(nsILocalFile* targetFile, - nsILocalFile* workingDir, +nsLocalFile::SetShortcut(nsIFile* targetFile, + nsIFile* workingDir, const PRUnichar* args, const PRUnichar* description, - nsILocalFile* iconFile, + nsIFile* iconFile, PRInt32 iconIndex) { bool exists; @@ -1937,7 +1937,7 @@ nsLocalFile::CopyMove(nsIFile *aParentDir, const nsAString &newName, bool follow nsAutoString target; newParentDir->GetTarget(target); - nsCOMPtr realDest = new nsLocalFile(); + nsCOMPtr realDest = new nsLocalFile(); if (realDest == nsnull) return NS_ERROR_OUT_OF_MEMORY; @@ -2566,8 +2566,7 @@ nsLocalFile::GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable) // Since GetDiskFreeSpaceExW works only on directories, use the parent. nsCOMPtr parent; if (NS_SUCCEEDED(GetParent(getter_AddRefs(parent))) && parent) { - nsCOMPtr localParent = do_QueryInterface(parent); - return localParent->GetDiskSpaceAvailable(aDiskSpaceAvailable); + return parent->GetDiskSpaceAvailable(aDiskSpaceAvailable); } } @@ -2617,7 +2616,7 @@ nsLocalFile::GetParent(nsIFile * *aParent) else parentPath.AssignLiteral("\\\\."); - nsCOMPtr localFile; + nsCOMPtr localFile; nsresult rv = NS_NewLocalFile(parentPath, mFollowSymlinks, getter_AddRefs(localFile)); if (NS_SUCCEEDED(rv) && localFile) { @@ -3173,7 +3172,7 @@ nsLocalFile::Launch() } nsresult -NS_NewLocalFile(const nsAString &path, bool followLinks, nsILocalFile* *result) +NS_NewLocalFile(const nsAString &path, bool followLinks, nsIFile* *result) { nsLocalFile* file = new nsLocalFile(); if (file == nsnull) @@ -3342,7 +3341,7 @@ nsLocalFile::GetNativeTarget(nsACString &_retval) } nsresult -NS_NewNativeLocalFile(const nsACString &path, bool followLinks, nsILocalFile* *result) +NS_NewNativeLocalFile(const nsACString &path, bool followLinks, nsIFile* *result) { nsAutoString buf; nsresult rv = NS_CopyNativeToUnicode(path, buf); @@ -3461,7 +3460,7 @@ NS_IMETHODIMP nsDriveEnumerator::GetNext(nsISupports **aNext) nsString drive(Substring(mStartOfCurrentDrive, driveEnd)); mStartOfCurrentDrive = ++driveEnd; - nsILocalFile *file; + nsIFile *file; nsresult rv = NS_NewLocalFile(drive, false, &file); *aNext = file; diff --git a/xpcom/io/nsMediaCacheRemover.cpp b/xpcom/io/nsMediaCacheRemover.cpp index 41e6cc04b25..7af01694299 100644 --- a/xpcom/io/nsMediaCacheRemover.cpp +++ b/xpcom/io/nsMediaCacheRemover.cpp @@ -9,7 +9,7 @@ #include "nsIObserver.h" #include "nsIIdleService.h" #include "nsISimpleEnumerator.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsAppDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h" #include "nsXULAppAPI.h" @@ -31,7 +31,7 @@ // media cache temp files which were supposed to be deleted on application // exit were actually deleted as they may not be if we previously crashed. // See bug 572579. This is only needed on some versions of Windows, -// nsILocalFile::DELETE_ON_CLOSE works on other platforms. +// nsIFile::DELETE_ON_CLOSE works on other platforms. class nsMediaCacheRemover : public nsIObserver { public: NS_DECL_ISUPPORTS @@ -87,12 +87,8 @@ public: if (NS_FAILED(rv)) return; - nsCOMPtr tmpFile = do_QueryInterface(tmpDir); - if (!tmpFile) - return; - // Remove the directory recursively. - tmpFile->Remove(true); + tmpDir->Remove(true); } }; diff --git a/xpcom/io/nsNativeCharsetUtils.h b/xpcom/io/nsNativeCharsetUtils.h index e27c070de5b..0dc6aec1563 100644 --- a/xpcom/io/nsNativeCharsetUtils.h +++ b/xpcom/io/nsNativeCharsetUtils.h @@ -27,9 +27,9 @@ nsresult NS_CopyUnicodeToNative(const nsAString &input, nsACString &output); /* * This function indicates whether the character encoding used in the file * system (more exactly what's used for |GetNativeFoo| and |SetNativeFoo| - * of |nsILocalFile|) is UTF-8 or not. Knowing that helps us avoid an + * of |nsIFile|) is UTF-8 or not. Knowing that helps us avoid an * unncessary encoding conversion in some cases. For instance, to get the leaf - * name in UTF-8 out of nsILocalFile, we can just use |GetNativeLeafName| rather + * name in UTF-8 out of nsIFile, we can just use |GetNativeLeafName| rather * than using |GetLeafName| and converting the result to UTF-8 if the file * system encoding is UTF-8. * On Unix (but not on Mac OS X), it depends on the locale and is not known diff --git a/xpcom/reflect/xptinfo/src/xptiprivate.h b/xpcom/reflect/xptinfo/src/xptiprivate.h index 9b09ed1768d..127d9485fce 100644 --- a/xpcom/reflect/xptinfo/src/xptiprivate.h +++ b/xpcom/reflect/xptinfo/src/xptiprivate.h @@ -22,7 +22,7 @@ #include "xptinfo.h" #include "nsIServiceManager.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIDirectoryService.h" #include "nsDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h" @@ -134,10 +134,10 @@ public: // Directory stuff... PRUint32 GetDirectoryCount(); - nsresult GetCloneOfDirectoryAt(PRUint32 i, nsILocalFile** dir); - nsresult GetDirectoryAt(PRUint32 i, nsILocalFile** dir); - bool FindDirectory(nsILocalFile* dir, PRUint32* index); - bool FindDirectoryOfFile(nsILocalFile* file, PRUint32* index); + nsresult GetCloneOfDirectoryAt(PRUint32 i, nsIFile** dir); + nsresult GetDirectoryAt(PRUint32 i, nsIFile** dir); + bool FindDirectory(nsIFile* dir, PRUint32* index); + bool FindDirectoryOfFile(nsIFile* file, PRUint32* index); bool DirectoryAtMatchesPersistentDescriptor(PRUint32 i, const char* desc); private: diff --git a/xpcom/string/public/nsXPCOMStrings.h b/xpcom/string/public/nsXPCOMStrings.h index 8cfc8d15df0..e7abee37db5 100644 --- a/xpcom/string/public/nsXPCOMStrings.h +++ b/xpcom/string/public/nsXPCOMStrings.h @@ -740,7 +740,7 @@ enum nsCStringEncoding { /* Conversion from UTF-16 to the native filesystem charset may result in a * loss of information. No attempt is made to protect against data loss in * this case. The native filesystem charset applies to strings passed to - * the "Native" method variants on nsIFile and nsILocalFile. */ + * the "Native" method variants on nsIFile. */ NS_CSTRING_ENCODING_NATIVE_FILESYSTEM = 2 }; diff --git a/xpcom/stub/nsXPComStub.cpp b/xpcom/stub/nsXPComStub.cpp index f16bfba157e..9d6282a5294 100644 --- a/xpcom/stub/nsXPComStub.cpp +++ b/xpcom/stub/nsXPComStub.cpp @@ -166,7 +166,7 @@ NS_GetMemoryManager(nsIMemory* *result) EXPORT_XPCOM_API(nsresult) NS_NewLocalFile(const nsAString &path, bool followLinks, - nsILocalFile **result) + nsIFile **result) { return NS_NewLocalFile_P(path, followLinks, result); } @@ -175,7 +175,7 @@ NS_NewLocalFile(const nsAString &path, EXPORT_XPCOM_API(nsresult) NS_NewNativeLocalFile(const nsACString &path, bool followLinks, - nsILocalFile **result) + nsIFile **result) { return NS_NewNativeLocalFile_P(path, followLinks, result); } diff --git a/xpcom/system/nsICrashReporter.idl b/xpcom/system/nsICrashReporter.idl index 27cf533aacb..17e5a78e74c 100644 --- a/xpcom/system/nsICrashReporter.idl +++ b/xpcom/system/nsICrashReporter.idl @@ -4,7 +4,7 @@ #include "nsISupports.idl" -interface nsILocalFile; +interface nsIFile; interface nsIURL; /** @@ -39,7 +39,7 @@ interface nsICrashReporter : nsISupports * * @throw NS_ERROR_NOT_INITIALIZED if crash reporting is not initialized */ - attribute nsILocalFile minidumpPath; + attribute nsIFile minidumpPath; /** * Add some extra data to be submitted with a crash report. diff --git a/xpcom/tests/RegFactory.cpp b/xpcom/tests/RegFactory.cpp index 1b2c20e694e..a36c3c6252a 100644 --- a/xpcom/tests/RegFactory.cpp +++ b/xpcom/tests/RegFactory.cpp @@ -9,7 +9,7 @@ #include "nsIComponentRegistrar.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsCOMPtr.h" #include "nsString.h" @@ -37,7 +37,7 @@ void print_err(nsresult err) nsresult Register(nsIComponentRegistrar* registrar, const char *path) { - nsCOMPtr file; + nsCOMPtr file; nsresult rv = NS_NewLocalFile( NS_ConvertUTF8toUTF16(path), diff --git a/xpcom/tests/TestExpirationTracker.cpp b/xpcom/tests/TestExpirationTracker.cpp index 3d61ba0aa9a..ecc0bda5311 100644 --- a/xpcom/tests/TestExpirationTracker.cpp +++ b/xpcom/tests/TestExpirationTracker.cpp @@ -15,7 +15,7 @@ #include "nsDirectoryServiceUtils.h" #include "nsComponentManagerUtils.h" #include "nsXPCOM.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "prinrval.h" #include "nsThreadUtils.h" diff --git a/xpcom/tests/TestFile.cpp b/xpcom/tests/TestFile.cpp index 4ccee451b4a..66c16b04568 100644 --- a/xpcom/tests/TestFile.cpp +++ b/xpcom/tests/TestFile.cpp @@ -8,7 +8,7 @@ #include "TestHarness.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsDirectoryServiceDefs.h" #include "nsDirectoryServiceUtils.h" @@ -23,18 +23,13 @@ static bool VerifyResult(nsresult aRV, const char* aMsg) return true; } -static already_AddRefed NewFile(nsIFile* aBase) +static already_AddRefed NewFile(nsIFile* aBase) { nsresult rv; - nsCOMPtr file = + nsCOMPtr file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv); - VerifyResult(rv, "Creating nsILocalFile"); - nsCOMPtr localBase = do_QueryInterface(aBase); - if (!localBase) { - fail("%s Base directory not a local file", gFunction); - return nsnull; - } - rv = file->InitWithFile(localBase); + VerifyResult(rv, "Creating nsIFile"); + rv = file->InitWithFile(aBase); VerifyResult(rv, "InitWithFile"); return file.forget(); } @@ -59,7 +54,7 @@ static nsCString FixName(const char* aName) static bool TestInvalidFileName(nsIFile* aBase, const char* aName) { gFunction = "TestInvalidFileName"; - nsCOMPtr file = NewFile(aBase); + nsCOMPtr file = NewFile(aBase); if (!file) return false; @@ -78,7 +73,7 @@ static bool TestInvalidFileName(nsIFile* aBase, const char* aName) static bool TestCreate(nsIFile* aBase, const char* aName, PRInt32 aType, PRInt32 aPerm) { gFunction = "TestCreate"; - nsCOMPtr file = NewFile(aBase); + nsCOMPtr file = NewFile(aBase); if (!file) return false; @@ -117,7 +112,7 @@ static bool TestCreate(nsIFile* aBase, const char* aName, PRInt32 aType, PRInt32 static bool TestCreateUnique(nsIFile* aBase, const char* aName, PRInt32 aType, PRInt32 aPerm) { gFunction = "TestCreateUnique"; - nsCOMPtr file = NewFile(aBase); + nsCOMPtr file = NewFile(aBase); if (!file) return false; @@ -158,12 +153,12 @@ static bool TestCreateUnique(nsIFile* aBase, const char* aName, PRInt32 aType, P return true; } -// Test nsILocalFile::OpenNSPRFileDesc with DELETE_ON_CLOSE, verifying that the file exists +// Test nsIFile::OpenNSPRFileDesc with DELETE_ON_CLOSE, verifying that the file exists // and did not exist before, and leaving it there for future tests static bool TestDeleteOnClose(nsIFile* aBase, const char* aName, PRInt32 aFlags, PRInt32 aPerm) { gFunction = "TestDeleteOnClose"; - nsCOMPtr file = NewFile(aBase); + nsCOMPtr file = NewFile(aBase); if (!file) return false; @@ -182,7 +177,7 @@ static bool TestDeleteOnClose(nsIFile* aBase, const char* aName, PRInt32 aFlags, } PRFileDesc* fileDesc; - rv = file->OpenNSPRFileDesc(aFlags | nsILocalFile::DELETE_ON_CLOSE, aPerm, &fileDesc); + rv = file->OpenNSPRFileDesc(aFlags | nsIFile::DELETE_ON_CLOSE, aPerm, &fileDesc); if (!VerifyResult(rv, "OpenNSPRFileDesc")) return false; PRStatus status = PR_Close(fileDesc); @@ -206,7 +201,7 @@ static bool TestDeleteOnClose(nsIFile* aBase, const char* aName, PRInt32 aFlags, static bool TestRemove(nsIFile* aBase, const char* aName, bool aRecursive) { gFunction = "TestDelete"; - nsCOMPtr file = NewFile(aBase); + nsCOMPtr file = NewFile(aBase); if (!file) return false; @@ -244,7 +239,7 @@ static bool TestRemove(nsIFile* aBase, const char* aName, bool aRecursive) static bool TestMove(nsIFile* aBase, nsIFile* aDestDir, const char* aName, const char* aNewName) { gFunction = "TestMove"; - nsCOMPtr file = NewFile(aBase); + nsCOMPtr file = NewFile(aBase); if (!file) return false; @@ -262,7 +257,7 @@ static bool TestMove(nsIFile* aBase, nsIFile* aDestDir, const char* aName, const return false; } - nsCOMPtr newFile = NewFile(file); + nsCOMPtr newFile = NewFile(file); nsCString newName = FixName(aNewName); rv = newFile->MoveToNative(aDestDir, newName); if (!VerifyResult(rv, "MoveToNative")) @@ -307,7 +302,7 @@ static bool TestMove(nsIFile* aBase, nsIFile* aDestDir, const char* aName, const static bool TestCopy(nsIFile* aBase, nsIFile* aDestDir, const char* aName, const char* aNewName) { gFunction = "TestCopy"; - nsCOMPtr file = NewFile(aBase); + nsCOMPtr file = NewFile(aBase); if (!file) return false; @@ -325,7 +320,7 @@ static bool TestCopy(nsIFile* aBase, nsIFile* aDestDir, const char* aName, const return false; } - nsCOMPtr newFile = NewFile(file); + nsCOMPtr newFile = NewFile(file); nsCString newName = FixName(aNewName); rv = newFile->CopyToNative(aDestDir, newName); if (!VerifyResult(rv, "MoveToNative")) @@ -369,7 +364,7 @@ static bool TestCopy(nsIFile* aBase, nsIFile* aDestDir, const char* aName, const static bool TestParent(nsIFile* aBase, nsIFile* aStart) { gFunction = "TestParent"; - nsCOMPtr file = NewFile(aStart); + nsCOMPtr file = NewFile(aStart); if (!file) return false; @@ -392,7 +387,7 @@ static bool TestParent(nsIFile* aBase, nsIFile* aStart) static bool TestNormalizeNativePath(nsIFile* aBase, nsIFile* aStart) { gFunction = "TestNormalizeNativePath"; - nsCOMPtr file = NewFile(aStart); + nsCOMPtr file = NewFile(aStart); if (!file) return false; @@ -446,7 +441,7 @@ int main(int argc, char** argv) return 1; // Initialize subdir object for later use - nsCOMPtr subdir = NewFile(base); + nsCOMPtr subdir = NewFile(base); if (!subdir) return 1; rv = subdir->AppendNative(nsDependentCString("subdir")); diff --git a/xpcom/tests/TestINIParser.cpp b/xpcom/tests/TestINIParser.cpp index a9ed9d48fb1..b955c8e8968 100644 --- a/xpcom/tests/TestINIParser.cpp +++ b/xpcom/tests/TestINIParser.cpp @@ -6,7 +6,7 @@ #include "nsXPCOM.h" #include "nsINIParser.h" -#include "nsILocalFile.h" +#include "nsIFile.h" static bool StringCB(const char *aKey, const char *aValue, void* aClosure) @@ -37,7 +37,7 @@ int main(int argc, char **argv) return 255; } - nsCOMPtr lf; + nsCOMPtr lf; nsresult rv = NS_NewNativeLocalFile(nsDependentCString(argv[1]), true, diff --git a/xpcom/tests/TestRegistrationOrder.cpp b/xpcom/tests/TestRegistrationOrder.cpp index 4f3b130b84c..8bf713d8dcd 100644 --- a/xpcom/tests/TestRegistrationOrder.cpp +++ b/xpcom/tests/TestRegistrationOrder.cpp @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "TestHarness.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIDirectoryService.h" #include "nsDirectoryServiceDefs.h" #include "nsCOMArray.h" @@ -130,10 +130,10 @@ bool TestContractFirst() return true; } -static already_AddRefed +static already_AddRefed GetRegDirectory(const char* basename, const char* dirname, const char* leafname) { - nsCOMPtr f; + nsCOMPtr f; nsresult rv = NS_NewNativeLocalFile(nsDependentCString(basename), true, getter_AddRefs(f)); if (NS_FAILED(rv)) @@ -159,11 +159,11 @@ int main(int argc, char** argv) const char *regPath = argv[1]; XRE_AddManifestLocation(NS_COMPONENT_LOCATION, - nsCOMPtr(GetRegDirectory(regPath, "core", "component.manifest"))); + nsCOMPtr(GetRegDirectory(regPath, "core", "component.manifest"))); XRE_AddManifestLocation(NS_COMPONENT_LOCATION, - nsCOMPtr(GetRegDirectory(regPath, "extension", "extComponent.manifest"))); + nsCOMPtr(GetRegDirectory(regPath, "extension", "extComponent.manifest"))); XRE_AddJarManifestLocation(NS_COMPONENT_LOCATION, - nsCOMPtr(GetRegDirectory(regPath, "extension2.jar", NULL))); + nsCOMPtr(GetRegDirectory(regPath, "extension2.jar", NULL))); ScopedXPCOM xpcom("RegistrationOrder"); if (xpcom.failed()) return 1; diff --git a/xpcom/tests/TestTArray.cpp b/xpcom/tests/TestTArray.cpp index ec7f699d0d7..e3111e81045 100644 --- a/xpcom/tests/TestTArray.cpp +++ b/xpcom/tests/TestTArray.cpp @@ -16,7 +16,7 @@ #include "nsDirectoryServiceUtils.h" #include "nsComponentManagerUtils.h" #include "nsXPCOM.h" -#include "nsILocalFile.h" +#include "nsIFile.h" using namespace mozilla; diff --git a/xpcom/tests/nsIFileEnumerator.cpp b/xpcom/tests/nsIFileEnumerator.cpp index 11956aa5dc4..e930c6318e2 100644 --- a/xpcom/tests/nsIFileEnumerator.cpp +++ b/xpcom/tests/nsIFileEnumerator.cpp @@ -1,4 +1,4 @@ -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsStringGlue.h" #include @@ -9,7 +9,7 @@ #include "nsISimpleEnumerator.h" #include "nsCOMPtr.h" -bool LoopInDir(nsILocalFile* file) +bool LoopInDir(nsIFile* file) { nsresult rv; nsCOMPtr entries; @@ -25,7 +25,7 @@ bool LoopInDir(nsILocalFile* file) if(!sup) return false; - nsCOMPtr file = do_QueryInterface(sup); + nsCOMPtr file = do_QueryInterface(sup); if(!file) return false; @@ -44,8 +44,7 @@ bool LoopInDir(nsILocalFile* file) if (isDir) { - nsCOMPtr lfile = do_QueryInterface(file); - LoopInDir(lfile); + LoopInDir(file); } } return true; @@ -57,7 +56,7 @@ main(int argc, char* argv[]) { nsresult rv; { - nsCOMPtr topDir; + nsCOMPtr topDir; nsCOMPtr servMan; rv = NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull); diff --git a/xpcom/tests/windows/TestNTFSPermissions.cpp b/xpcom/tests/windows/TestNTFSPermissions.cpp index 32a2a828169..fc278f76d18 100644 --- a/xpcom/tests/windows/TestNTFSPermissions.cpp +++ b/xpcom/tests/windows/TestNTFSPermissions.cpp @@ -10,7 +10,7 @@ #include "../TestHarness.h" #include "nsEmbedString.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include #include @@ -25,9 +25,9 @@ nsresult TestPermissions() // File variables HANDLE tempFileHandle; - nsCOMPtr tempFile; - nsCOMPtr tempDirectory1; - nsCOMPtr tempDirectory2; + nsCOMPtr tempFile; + nsCOMPtr tempDirectory1; + nsCOMPtr tempDirectory2; WCHAR filePath[MAX_PATH]; WCHAR dir1Path[MAX_PATH]; WCHAR dir2Path[MAX_PATH]; diff --git a/xpcom/tests/windows/TestWinFileAttribs.cpp b/xpcom/tests/windows/TestWinFileAttribs.cpp index f26512e739a..e83ff527039 100644 --- a/xpcom/tests/windows/TestWinFileAttribs.cpp +++ b/xpcom/tests/windows/TestWinFileAttribs.cpp @@ -38,7 +38,7 @@ nsresult TestWinAttribs() // File variables HANDLE hIndexed; - nsCOMPtr localFile; + nsCOMPtr localFile; WCHAR filePath[MAX_PATH]; // Create and open temporary file diff --git a/xulrunner/app/nsXULRunnerApp.cpp b/xulrunner/app/nsXULRunnerApp.cpp index f5a8cdb3d8b..16e9ab113b0 100644 --- a/xulrunner/app/nsXULRunnerApp.cpp +++ b/xulrunner/app/nsXULRunnerApp.cpp @@ -11,7 +11,7 @@ #include "nsXULAppAPI.h" #include "nsXPCOMGlue.h" #include "nsAppRunner.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include "nsIXULAppInstall.h" #include "nsCOMPtr.h" #include "nsMemory.h" @@ -100,7 +100,7 @@ GetGREVersion(const char *argv0, if (aVersion) aVersion->Assign(""); - nsCOMPtr iniFile; + nsCOMPtr iniFile; nsresult rv = XRE_GetBinaryPath(argv0, getter_AddRefs(iniFile)); if (NS_FAILED(rv)) return rv; @@ -157,7 +157,7 @@ GetXULRunnerDir(const char *argv0, nsIFile* *aResult) { nsresult rv; - nsCOMPtr appFile; + nsCOMPtr appFile; rv = XRE_GetBinaryPath(argv0, getter_AddRefs(appFile)); if (NS_FAILED(rv)) { Output(true, "Could not find XULRunner application path.\n"); @@ -177,8 +177,8 @@ InstallXULApp(nsIFile* aXULRunnerDir, const char *aInstallTo, const char *aLeafName) { - nsCOMPtr appLocation; - nsCOMPtr installTo; + nsCOMPtr appLocation; + nsCOMPtr installTo; nsString leafName; nsresult rv = XRE_GetFileFromPath(aAppLocation, getter_AddRefs(appLocation)); @@ -222,7 +222,7 @@ InstallXULApp(nsIFile* aXULRunnerDir, class AutoAppData { public: - AutoAppData(nsILocalFile* aINIFile) : mAppData(nsnull) { + AutoAppData(nsIFile* aINIFile) : mAppData(nsnull) { nsresult rv = XRE_CreateAppData(aINIFile, &mAppData); if (NS_FAILED(rv)) mAppData = nsnull; @@ -334,7 +334,7 @@ int main(int argc, char* argv[]) PR_SetEnv(kAppEnv); } - nsCOMPtr appDataLF; + nsCOMPtr appDataLF; nsresult rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appDataLF)); if (NS_FAILED(rv)) { Output(true, "Error: unrecognized application.ini path.\n"); diff --git a/xulrunner/stub/nsXULStub.cpp b/xulrunner/stub/nsXULStub.cpp index 82fb63511ad..8c2eecc4574 100644 --- a/xulrunner/stub/nsXULStub.cpp +++ b/xulrunner/stub/nsXULStub.cpp @@ -8,7 +8,7 @@ #include "nsXPCOMPrivate.h" // for XP MAXPATHLEN #include "nsMemory.h" // for NS_ARRAY_LENGTH #include "nsXULAppAPI.h" -#include "nsILocalFile.h" +#include "nsIFile.h" #include @@ -137,7 +137,7 @@ static nsresult GetRealPath(const char* appDataFile, char* *aResult) class AutoAppData { public: - AutoAppData(nsILocalFile* aINIFile) : mAppData(nsnull) { + AutoAppData(nsIFile* aINIFile) : mAppData(nsnull) { nsresult rv = XRE_CreateAppData(aINIFile, &mAppData); if (NS_FAILED(rv)) mAppData = nsnull; @@ -442,7 +442,7 @@ main(int argc, char **argv) int retval; { // Scope COMPtr and AutoAppData - nsCOMPtr iniFile; + nsCOMPtr iniFile; #ifdef XP_WIN // On Windows iniPath is UTF-8 encoded so we need to convert it. rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(iniPath), false,