From a2b9df40b820218e30efa28ff10e0cf8802556b9 Mon Sep 17 00:00:00 2001 From: "mozilla%weilbacher.org" Date: Wed, 10 Jan 2007 08:43:08 +0000 Subject: [PATCH] [OS/2] Bug 355077: fix xulrunner-stub to work on OS/2, p=abwillis1+me, r=mkaply git-svn-id: svn://10.0.0.236/trunk@218108 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/glue/nsGREGlue.cpp | 7 ++++++ .../glue/standalone/nsGlueLinkingOS2.cpp | 6 +++-- mozilla/xulrunner/stub/nsXULStub.cpp | 25 +++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/mozilla/xpcom/glue/nsGREGlue.cpp b/mozilla/xpcom/glue/nsGREGlue.cpp index 5c1ea650b44..51b148d6a87 100755 --- a/mozilla/xpcom/glue/nsGREGlue.cpp +++ b/mozilla/xpcom/glue/nsGREGlue.cpp @@ -166,6 +166,13 @@ GRE_GetGREPathWithProperties(const GREVersionRange *versions, #elif XP_WIN if (_fullpath(aBuffer, p, aBufLen)) return NS_OK; +#elif XP_OS2 + // realpath on OS/2 returns a unix-ized path, so re-native-ize + if (realpath(p, aBuffer)) { + for (char* ptr = strchr(aBuffer, '/'); ptr; ptr = strchr(ptr, '/')) + *ptr = '\\'; + return NS_OK; + } #elif XP_BEOS BPath path; status_t result; diff --git a/mozilla/xpcom/glue/standalone/nsGlueLinkingOS2.cpp b/mozilla/xpcom/glue/standalone/nsGlueLinkingOS2.cpp index dbf739739b5..c2f38568100 100644 --- a/mozilla/xpcom/glue/standalone/nsGlueLinkingOS2.cpp +++ b/mozilla/xpcom/glue/standalone/nsGlueLinkingOS2.cpp @@ -135,7 +135,7 @@ XPCOMGlueLoad(const char *xpcomFile) GetFrozenFunctionsFunc sym; - ulrc = DosQueryProcAddr(h, 0, "NS_GetFrozenFunctions", (PFN*)&sym); + ulrc = DosQueryProcAddr(h, 0, "_NS_GetFrozenFunctions", (PFN*)&sym); if (ulrc != NO_ERROR) XPCOMGlueUnload(); @@ -171,7 +171,9 @@ XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols) nsresult rv = NS_OK; while (symbols->functionName) { - ulrc = DosQueryProcAddr(sXULLibrary, 0, symbols->functionName, (PFN*)symbols->function); + char buffer[512]; + snprintf(buffer, sizeof(buffer), "_%s", symbols->functionName); + ulrc = DosQueryProcAddr(sXULLibrary, 0, buffer, (PFN*)symbols->function); if (ulrc != NO_ERROR) rv = NS_ERROR_LOSS_OF_SIGNIFICANT_DATA; diff --git a/mozilla/xulrunner/stub/nsXULStub.cpp b/mozilla/xulrunner/stub/nsXULStub.cpp index 51a3a9dc180..dee10e7f8e2 100644 --- a/mozilla/xulrunner/stub/nsXULStub.cpp +++ b/mozilla/xulrunner/stub/nsXULStub.cpp @@ -56,6 +56,15 @@ #elif defined(XP_MACOSX) #include #define PATH_SEPARATOR_CHAR '/' +#elif defined (XP_OS2) +#define INCL_DOS +#define INCL_DOSMISC +#define INCL_DOSERRORS +#include +#include +#include +#include +#define PATH_SEPARATOR_CHAR '\\' #else #include #include @@ -162,6 +171,13 @@ main(int argc, char **argv) if (!::GetModuleFileName(NULL, iniPath, sizeof(iniPath))) return 1; +#elif defined(XP_OS2) + PPIB ppib; + PTIB ptib; + + DosGetInfoBlocks(&ptib, &ppib); + DosQueryModuleName(ppib->pib_hmte, sizeof(iniPath), iniPath); + #else // on unix, there is no official way to get the path of the current binary. // instead of using the MOZILLA_FIVE_HOME hack, which doesn't scale to @@ -266,6 +282,15 @@ main(int argc, char **argv) return 1; } } +#ifdef XP_OS2 + // On OS/2 we need to set BEGINLIBPATH to be able to find XULRunner DLLs + strcpy(tmpPath, greDir); + lastSlash = strrchr(tmpPath, PATH_SEPARATOR_CHAR); + if (lastSlash) { + *lastSlash = '\0'; + } + DosSetExtLIBPATH(tmpPath, BEGIN_LIBPATH); +#endif rv = XPCOMGlueStartup(greDir); if (NS_FAILED(rv)) {