Bug 726978 - Remove useless NS_New(Native)LocalFile calls in nsBrowserApp.cpp. r=glandium

This commit is contained in:
Mark Banner 2012-02-14 18:03:31 +00:00
parent 48d09f5e97
commit 4a997866e5
3 changed files with 15 additions and 72 deletions

View File

@ -48,11 +48,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "plstr.h"
#include "prprf.h"
#include "prenv.h"
#include "nsCOMPtr.h"
#include "nsILocalFile.h"
@ -137,7 +132,7 @@ static const nsDynamicFunctionLoad kXULFuncs[] = {
{ nsnull, nsnull }
};
static int do_main(const char *exePath, int argc, char* argv[])
static int do_main(int argc, char* argv[])
{
nsCOMPtr<nsILocalFile> appini;
nsresult rv;
@ -175,7 +170,6 @@ static int do_main(const char *exePath, int argc, char* argv[])
argc -= 2;
}
int result;
if (appini) {
nsXREAppData *appData;
rv = XRE_CreateAppData(appini, &appData);
@ -183,25 +177,12 @@ static int do_main(const char *exePath, int argc, char* argv[])
Output("Couldn't read application.ini");
return 255;
}
result = XRE_main(argc, argv, appData);
int result = XRE_main(argc, argv, appData);
XRE_FreeAppData(appData);
} else {
#ifdef XP_WIN
// exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
// encoded path, so it is safe to convert it
rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), PR_FALSE,
getter_AddRefs(appini));
#else
rv = NS_NewNativeLocalFile(nsDependentCString(exePath), PR_FALSE,
getter_AddRefs(appini));
#endif
if (NS_FAILED(rv)) {
return 255;
}
result = XRE_main(argc, argv, &sAppData);
return result;
}
return result;
return XRE_main(argc, argv, &sAppData);
}
int main(int argc, char* argv[])
@ -284,7 +265,7 @@ int main(int argc, char* argv[])
int result;
{
ScopedLogging log;
result = do_main(exePath, argc, argv);
result = do_main(argc, argv);
}
XPCOMGlueShutdown();

View File

@ -52,11 +52,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "plstr.h"
#include "prprf.h"
#include "prenv.h"
#include "nsCOMPtr.h"
#include "nsILocalFile.h"
@ -141,7 +136,7 @@ static const nsDynamicFunctionLoad kXULFuncs[] = {
{ nsnull, nsnull }
};
static int do_main(const char *exePath, int argc, char* argv[])
static int do_main(int argc, char* argv[])
{
nsCOMPtr<nsILocalFile> appini;
nsresult rv;
@ -179,7 +174,6 @@ static int do_main(const char *exePath, int argc, char* argv[])
argc -= 2;
}
int result;
if (appini) {
nsXREAppData *appData;
rv = XRE_CreateAppData(appini, &appData);
@ -187,25 +181,12 @@ static int do_main(const char *exePath, int argc, char* argv[])
Output("Couldn't read application.ini");
return 255;
}
result = XRE_main(argc, argv, appData);
int result = XRE_main(argc, argv, appData);
XRE_FreeAppData(appData);
} else {
#ifdef XP_WIN
// exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
// encoded path, so it is safe to convert it
rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), PR_FALSE,
getter_AddRefs(appini));
#else
rv = NS_NewNativeLocalFile(nsDependentCString(exePath), PR_FALSE,
getter_AddRefs(appini));
#endif
if (NS_FAILED(rv)) {
return 255;
}
result = XRE_main(argc, argv, &sAppData);
return result;
}
return result;
return XRE_main(argc, argv, &sAppData);
}
int main(int argc, char* argv[])
@ -292,7 +273,7 @@ int main(int argc, char* argv[])
int result;
{
ScopedLogging log;
result = do_main(exePath, argc, argv);
result = do_main(argc, argv);
}
XPCOMGlueShutdown();

View File

@ -48,11 +48,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "plstr.h"
#include "prprf.h"
#include "prenv.h"
#include "nsCOMPtr.h"
#include "nsILocalFile.h"
@ -144,7 +139,7 @@ static const nsDynamicFunctionLoad kXULFuncs[] = {
{ nsnull, nsnull }
};
static int do_main(const char *exePath, int argc, char* argv[])
static int do_main(int argc, char* argv[])
{
nsCOMPtr<nsILocalFile> appini;
nsresult rv;
@ -182,7 +177,6 @@ static int do_main(const char *exePath, int argc, char* argv[])
argc -= 2;
}
int result;
if (appini) {
nsXREAppData *appData;
rv = XRE_CreateAppData(appini, &appData);
@ -190,25 +184,12 @@ static int do_main(const char *exePath, int argc, char* argv[])
Output("Couldn't read application.ini");
return 255;
}
result = XRE_main(argc, argv, appData);
int result = XRE_main(argc, argv, appData);
XRE_FreeAppData(appData);
} else {
#ifdef XP_WIN
// exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
// encoded path, so it is safe to convert it
rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), PR_FALSE,
getter_AddRefs(appini));
#else
rv = NS_NewNativeLocalFile(nsDependentCString(exePath), PR_FALSE,
getter_AddRefs(appini));
#endif
if (NS_FAILED(rv)) {
return 255;
}
result = XRE_main(argc, argv, &sAppData);
return result;
}
return result;
return XRE_main(argc, argv, &sAppData);
}
#if MOZ_PLATFORM_MAEMO == 6
@ -314,7 +295,7 @@ int main(int argc, char* argv[])
int result;
{
ScopedLogging log;
result = do_main(exePath, argc, argv);
result = do_main(argc, argv);
}
XPCOMGlueShutdown();