Bug 297598 - bring pyxpcom up to speed.

r=alecf, sr=shaver - not used by any builds.


git-svn-id: svn://10.0.0.236/trunk@178999 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mhammond%skippinet.com.au
2005-08-25 21:52:19 +00:00
parent 96d6a8d0f7
commit 1cf8051395
21 changed files with 554 additions and 347 deletions

View File

@@ -43,8 +43,13 @@
// the xpcom "components" directory. Simply locates and loads the standard
// _xpcom support module and transfers control to that.
#include <Python.h>
#ifdef HAVE_LONG_LONG
#undef HAVE_LONG_LONG
#endif
#include "nsIComponentLoader.h"
#include "nsIRegistry.h"
#include "nsISupports.h"
#include "nsIModule.h"
#include "nsDirectoryServiceDefs.h"
@@ -57,15 +62,8 @@
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include <nsFileStream.h> // For console logging.
#include "nspr.h" // PR_fprintf
#ifdef HAVE_LONG_LONG
#undef HAVE_LONG_LONG
#endif
#include "Python.h"
#if (PY_VERSION_HEX >= 0x02030000)
#define PYXPCOM_USE_PYGILSTATE
#endif
@@ -100,10 +98,10 @@ static void LogDebug(const char *fmt, ...);
void AddStandardPaths()
{
// Put {bin}\Python on the path if it exists.
nsresult rv;
nsCOMPtr<nsIFile> aFile;
nsCOMPtr<nsILocalFile> aLocalFile;
NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR, getter_AddRefs(aFile));
if (!aFile) {
rv = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR, getter_AddRefs(aFile));
if (NS_FAILED(rv)) {
LogError("The Python XPCOM loader could not locate the 'bin' directory\n");
return;
}
@@ -245,9 +243,7 @@ void LogMessage(const char *prefix, const char *pszMessageText)
void LogMessage(const char *prefix, nsACString &text)
{
char *c = ToNewCString(text);
LogMessage(prefix, c);
nsCRT::free(c);
LogMessage(prefix, nsPromiseFlatCString(text).get());
}
// A helper for the various logging routines.