Skip to content

Commit

Permalink
Issue #2391 - Part 11: Remove obsolete define for older MSVC
Browse files Browse the repository at this point in the history
Also cleans up trailing spaces.
  • Loading branch information
Matheus Marinho committed Nov 25, 2023
1 parent 77c99ed commit a803a6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
5 changes: 1 addition & 4 deletions xulrunner/app/nsXULRunnerApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
#include <stdlib.h>
#ifdef XP_WIN
#include <windows.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
#define strcasecmp _stricmp
#endif

Expand Down Expand Up @@ -60,7 +57,7 @@ static void Output(bool isError, const char *fmt, ... )
flags |= MB_ICONERROR;
else
flags |= MB_ICONINFORMATION;

MessageBoxW(nullptr, msg, L"XULRunner", flags);
#else
vfprintf(stderr, fmt, ap);
Expand Down
20 changes: 8 additions & 12 deletions xulrunner/stub/nsXULStub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
#ifdef XP_WIN
#include <windows.h>
#include <io.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
#define strcasecmp _stricmp
#define PATH_SEPARATOR_CHAR '\\'
#define R_OK 04
Expand Down Expand Up @@ -57,7 +53,7 @@ static void Output(bool isError, const char *fmt, ... )
-1,
wide_msg,
sizeof(wide_msg) / sizeof(wchar_t));

MessageBoxW(nullptr, wide_msg, L"XULRunner", flags);
#else
vfprintf(stderr, fmt, ap);
Expand Down Expand Up @@ -236,11 +232,11 @@ main(int argc, char **argv)

strncpy(lastSlash, "application.ini", sizeof(iniPath) - (lastSlash - iniPath));

// If -app parameter was passed in, it is now time to take it under
// If -app parameter was passed in, it is now time to take it under
// consideration.
const char *appDataFile;
appDataFile = getenv("XUL_APP_FILE");
if (!appDataFile || !*appDataFile)
if (!appDataFile || !*appDataFile)
if (argc > 1 && IsArg(argv[1], "app")) {
if (argc == 2) {
Output(false, "specify APP-FILE (optional)\n");
Expand All @@ -257,16 +253,16 @@ main(int argc, char **argv)

char kAppEnv[MAXPATHLEN];
snprintf(kAppEnv, MAXPATHLEN, "XUL_APP_FILE=%s", appDataFile);
if (putenv(kAppEnv))
if (putenv(kAppEnv))
Output(false, "Couldn't set %s.\n", kAppEnv);

char *result = (char*) calloc(sizeof(char), MAXPATHLEN);
if (NS_FAILED(GetRealPath(appDataFile, &result))) {
Output(true, "Invalid application.ini path.\n");
return 1;
}
// We have a valid application.ini path passed in to the -app parameter

// We have a valid application.ini path passed in to the -app parameter
// but not yet a valid greDir, so lets look for it also on the same folder
// as the stub.
if (!greFound) {
Expand All @@ -279,11 +275,11 @@ main(int argc, char **argv)
snprintf(greDir, sizeof(greDir), "%s" XPCOM_DLL, iniPath);
greFound = FolderExists(greDir);
}

// copy it back.
strcpy(iniPath, result);
}

nsINIParser parser;
rv = parser.Init(iniPath);
if (NS_FAILED(rv)) {
Expand Down

0 comments on commit a803a6c

Please sign in to comment.