[Libreoffice-commits] core.git: 2 commits - pyuno/zipcore solenv/gbuild
Stephan Bergmann
sbergman at redhat.com
Fri Nov 29 08:40:13 PST 2013
pyuno/zipcore/python.cxx | 32 +++++++++++++++++---------------
solenv/gbuild/platform/com_MSC_class.mk | 2 +-
solenv/gbuild/platform/com_MSC_defs.mk | 3 +--
3 files changed, 19 insertions(+), 18 deletions(-)
New commits:
commit f304c906320a3258f5baf6bfa7d43f678ce3f534
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Nov 29 17:27:21 2013 +0100
Fix Cygwin PATH composition
Adding Windows-style paths (C:\foo\bar) happened to appear to work, as Cygwin
translated that into two paths C;\foo\bar (where the former typically just does
not exist and the latter is relative to the current drive, which is typically
C).
In theory, wrapping in $(shell cygpath -u ...) should not be necessary, but in
practice S is set to a Windows-syte path (which is probably a bug?) after the
paths of PATH would be shortened to use $I/$S/$W, which is prevented with the
wrapper.
In theory, the shell variable assignment PATH="$$PATH:... would more
idiomatically read PATH=$$PATH:"... but e.g.
unoidl/CustomTarget_unoidl-write_test.mk passes this variable assignment as a
command line argument to exectest.pl in which case it would potentially be split
into multiple arguments.
Change-Id: If870e9eba8b650fe75b324ac54c49891d19fcc55
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 790ba16..eafc570 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -382,7 +382,7 @@ endef
# CppunitTest class
gb_CppunitTest_DEFS := -D_DLL
-gb_CppunitTest_CPPTESTPRECOMMAND := $(gb_Helper_set_ld_path):"$(shell cygpath -w $(gb_Library_DLLDIR)):$(shell cygpath -w $(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/$(if $(MSVC_USE_DEBUG_RUNTIME),DebugDll,ReleaseDll))"
+gb_CppunitTest_CPPTESTPRECOMMAND := $(gb_Helper_set_ld_path):"$(shell cygpath -u $(gb_Library_DLLDIR)):$(shell cygpath -u $(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/$(if $(MSVC_USE_DEBUG_RUNTIME),DebugDll,ReleaseDll))"
gb_CppunitTest_get_filename = test_$(1).dll
gb_CppunitTest_get_ilibfilename = itest_$(1).lib
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index f002d51..c4d6408 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -293,7 +293,6 @@ gb_LTOFLAGS := $(if $(filter TRUE,$(ENABLE_LTO)),-GL)
# Helper class
-# need windows path with backslashes here
-gb_Helper_set_ld_path := PATH="$(PATH);$(shell cygpath -w $(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath -w $(INSTDIR)/$(LIBO_BIN_FOLDER))"
+gb_Helper_set_ld_path := PATH="$$PATH:$(shell cygpath -u $(INSTDIR)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR)/$(LIBO_BIN_FOLDER))"
# vim: set noet sw=4:
commit 50bd5c11f551f5274be9a4411c5ddcbd32bd9a03
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Nov 29 17:26:54 2013 +0100
wsprintf is broken by design and never writes more than 1024 characters
Change-Id: I791e55bb5d98ee82c01271dcebafa7c4672cd424
diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx
index 9ef7183..517a6ae 100644
--- a/pyuno/zipcore/python.cxx
+++ b/pyuno/zipcore/python.cxx
@@ -192,10 +192,12 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
exit(EXIT_FAILURE);
}
}
- wchar_t * value = new wchar_t[
- (urepathEnd - urepath) + MY_LENGTH(L";") + (pathEnd - path) +
- (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow
- wsprintfW(value, L"%s;%s%s%s", urepath, path, n == 0 ? L"" : L";", orig);
+ std::size_t len = (urepathEnd - urepath) + MY_LENGTH(L";") +
+ (pathEnd - path) + (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1;
+ //TODO: overflow
+ wchar_t * value = new wchar_t[len];
+ _snwprintf(
+ value, len, L"%s;%s%s%s", urepath, path, n == 0 ? L"" : L";", orig);
if (!SetEnvironmentVariableW(L"PATH", value)) {
exit(EXIT_FAILURE);
}
@@ -218,21 +220,21 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
}
}
#ifdef __MINGW32__
- value = new wchar_t[
- (pathEnd - path) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) +
+ len = (pathEnd - path) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) +
MY_LENGTH(L";") + (pythonpath4End - pythonpath4) +
MY_LENGTH(L";") + (pythonpath3End - pythonpath3) +
- (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow
- wsprintfW(
- value, L"%s;%s;%s;%s%s%s", path, pythonpath2, pythonpath4, pythonpath3,
- n == 0 ? L"" : L";", orig);
+ (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1; //TODO: overflow
+ value = new wchar_t[len];
+ _snwprintf(
+ value, len, L"%s;%s;%s;%s%s%s", path, pythonpath2, pythonpath4,
+ pythonpath3, n == 0 ? L"" : L";", orig);
#else
- value = new wchar_t[
- (pathEnd - path) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) +
+ len = (pathEnd - path) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) +
MY_LENGTH(L";") + (pythonpath3End - pythonpath3) +
- (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow
- wsprintfW(
- value, L"%s;%s;%s%s%s", path, pythonpath2, pythonpath3,
+ (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1; //TODO: overflow
+ value = new wchar_t[len];
+ _snwprintf(
+ value, len, L"%s;%s;%s%s%s", path, pythonpath2, pythonpath3,
n == 0 ? L"" : L";", orig);
#endif
if (!SetEnvironmentVariableW(L"PYTHONPATH", value)) {
More information about the Libreoffice-commits
mailing list