summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-06-12 06:43:56 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-06-12 06:43:56 +0000
commit5e52dcb0a992a6f19ae48aef0bf55e921f60454c (patch)
tree2b214b5f4d2b71455644ef53cd5abfeab8a7db10 /pyuno
parente1d6e7d277fe3f30ee770da96f7fcb17723d9838 (diff)
#i90610# Fix for .Net2003 compiler (patch by sb).
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/zipcore/python.cxx56
1 files changed, 31 insertions, 25 deletions
diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx
index e18af9565463..b9a2248f6915 100644
--- a/pyuno/zipcore/python.cxx
+++ b/pyuno/zipcore/python.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: python.cxx,v $
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
* This file is part of OpenOffice.org.
*
@@ -29,11 +29,17 @@
************************************************************************/
#include <cstddef>
-#include <cstdlib>
-#include <cwchar>
+#include <stdlib.h>
+#include <wchar.h>
#define WIN32_LEAN_AND_MEAN
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
#include <windows.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
#include "tools/pathutils.hxx"
@@ -75,7 +81,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
wchar_t path[MAX_PATH];
DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH);
if (n == 0 || n >= MAX_PATH) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
wchar_t * pathEnd = tools::filename(path);
wchar_t bootstrap[MAX_PATH];
@@ -85,21 +91,21 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
(tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link"))
== NULL))
{
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
pathEnd = tools::resolveLink(path);
wchar_t path1[MAX_PATH];
wchar_t * path1End = tools::buildPath(
path1, path, pathEnd, MY_STRING(L"\\program"));
if (path1End == NULL) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
wchar_t pythonpath2[MAX_PATH];
wchar_t * pythonpath2End = tools::buildPath(
pythonpath2, path, pathEnd,
MY_STRING(L"\\program\\python-core-" MY_PYVERSION L"\\lib"));
if (pythonpath2End == NULL) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
wchar_t pythonpath3[MAX_PATH];
wchar_t * pythonpath3End = tools::buildPath(
@@ -107,14 +113,14 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
MY_STRING(
L"\\program\\python-core-" MY_PYVERSION L"\\lib\\site-packages"));
if (pythonpath3End == NULL) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
wchar_t pythonhome[MAX_PATH];
wchar_t * pythonhomeEnd = tools::buildPath(
pythonhome, path, pathEnd,
MY_STRING(L"\\program\\python-core-" MY_PYVERSION));
if (pythonhomeEnd == NULL) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
wchar_t pythonexe[MAX_PATH];
wchar_t * pythonexeEnd = tools::buildPath(
@@ -122,31 +128,31 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
MY_STRING(
L"\\program\\python-core-" MY_PYVERSION L"\\bin\\python.exe"));
if (pythonexeEnd == NULL) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
{
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
pathEnd = tools::resolveLink(path);
if (pathEnd == NULL) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
pathEnd = tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin"));
if (pathEnd == NULL) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
std::size_t clSize = MY_LENGTH(L"\"") + 4 * (pythonexeEnd - pythonexe) +
MY_LENGTH(L"\"\0"); //TODO: overflow
// 4 * len: each char preceded by backslash, each trailing backslash
// doubled
for (int i = 1; i < argc; ++i) {
- clSize += MY_LENGTH(L" \"") + 4 * std::wcslen(argv[i]) +
+ clSize += MY_LENGTH(L" \"") + 4 * wcslen(argv[i]) +
MY_LENGTH(L"\""); //TODO: overflow
}
wchar_t * cl = new wchar_t[clSize];
if (cl == NULL) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
wchar_t * cp = encode(cl, pythonhome);
for (int i = 1; i < argc; ++i) {
@@ -158,7 +164,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
wchar_t * orig;
if (n == 0) {
if (GetLastError() != ERROR_ENVVAR_NOT_FOUND) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
orig = L"";
} else {
@@ -166,7 +172,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
if (orig == NULL ||
GetEnvironmentVariableW(L"PATH", orig, n) != n - 1)
{
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
}
wchar_t * value = new wchar_t[
@@ -174,7 +180,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
(n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow
wsprintfW(value, L"%s;%s%s%s", path, path1, n == 0 ? L"" : L";", orig);
if (!SetEnvironmentVariableW(L"PATH", value)) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (n != 0) {
delete orig;
@@ -183,7 +189,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
n = GetEnvironmentVariableW(L"PYTHONPATH", NULL, 0);
if (n == 0) {
if (GetLastError() != ERROR_ENVVAR_NOT_FOUND) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
orig = L"";
} else {
@@ -191,7 +197,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
if (orig == NULL ||
GetEnvironmentVariableW(L"PYTHONPATH", orig, n) != n - 1)
{
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
}
value = new wchar_t[
@@ -202,21 +208,21 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
value, L"%s;%s;%s%s%s", path1, pythonpath2, pythonpath3,
n == 0 ? L"" : L";", orig);
if (!SetEnvironmentVariableW(L"PYTHONPATH", value)) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
if (n != 0) {
delete orig;
}
delete value;
if (!SetEnvironmentVariableW(L"PYTHONHOME", pythonhome)) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
n = GetEnvironmentVariableW(L"URE_BOOTSTRAP", NULL, 0);
if (n == 0) {
if (GetLastError() != ERROR_ENVVAR_NOT_FOUND ||
!SetEnvironmentVariableW(L"URE_BOOTSTRAP", bootstrap))
{
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
}
STARTUPINFOW startinfo;
@@ -226,7 +232,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
if (!CreateProcessW(
pythonexe, cl, NULL, NULL, FALSE, CREATE_UNICODE_ENVIRONMENT, NULL,
NULL, &startinfo, &procinfo)) {
- std::exit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
}
- std::exit(EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}