diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-07-02 08:46:01 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-07-02 08:46:01 +0000 |
commit | b3eb92fb02e49ed4e23f357c7164541c31560b93 (patch) | |
tree | 17087cc9aade66d459b5ae555936c2b1654af953 /pyuno | |
parent | 4ecc198ffd619cf523c2d6cfb650d98b1cb1dbbd (diff) |
INTEGRATION: CWS mingwport14 (1.3.2); FILE MERGED
2008/06/21 14:22:13 tono 1.3.2.1: #i90950#: mingw port
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/zipcore/python.cxx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx index b9a2248f6915..4a7fa06d85c1 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.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -77,7 +77,11 @@ wchar_t * encode(wchar_t * buffer, wchar_t const * text) { return buffer; } +#ifdef __MINGW32__ +int main(int argc, char ** argv, char **) { +#else int wmain(int argc, wchar_t ** argv, wchar_t **) { +#endif wchar_t path[MAX_PATH]; DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH); if (n == 0 || n >= MAX_PATH) { @@ -147,7 +151,11 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { // 4 * len: each char preceded by backslash, each trailing backslash // doubled for (int i = 1; i < argc; ++i) { +#ifdef __MINGW32__ + clSize += MY_LENGTH(L" \"") + 4 * strlen(argv[i]) + +#else clSize += MY_LENGTH(L" \"") + 4 * wcslen(argv[i]) + +#endif MY_LENGTH(L"\""); //TODO: overflow } wchar_t * cl = new wchar_t[clSize]; @@ -157,7 +165,16 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { wchar_t * cp = encode(cl, pythonhome); for (int i = 1; i < argc; ++i) { *cp++ = L' '; +#ifdef __MINGW32__ + int nNeededWStrBuffSize = MultiByteToWideChar(CP_ACP, 0, argv[i], -1, NULL, 0); + WCHAR *buff = new WCHAR[nNeededWStrBuffSize+1]; + MultiByteToWideChar(CP_ACP, 0, argv[i], -1, buff, nNeededWStrBuffSize); + buff[nNeededWStrBuffSize] = 0; + cp = encode(cp, buff); + delete buff; +#else cp = encode(cp, argv[i]); +#endif } *cp = L'\0'; n = GetEnvironmentVariableW(L"PATH", NULL, 0); |