[Libreoffice-commits] .: Branch 'libreoffice-3-3' - sal/osl

Tor Lillqvist tml at kemper.freedesktop.org
Tue Jan 25 06:32:38 PST 2011


 sal/osl/w32/process.cxx |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit f06193d3a0c3c5f827df091f0253928adfbf43d9
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Tue Jan 25 16:24:07 2011 +0200

    Manipulate also the C runtime's environment
    
    Fixes fdo#33355.
    
    Signed-off-by: Fridrich Strba <fridrich.strba at bluewin.ch>

diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 796f4c4..1749b8e 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -28,6 +28,7 @@
 
 #define UNICODE
 #include "system.h"
+#include <string.h>
 #ifdef _MSC_VER
 #pragma warning(push,1) /* disable warnings within system headers */
 #endif
@@ -419,7 +420,15 @@ oslProcessError SAL_CALL osl_setEnvironment(rtl_uString *ustrVar, rtl_uString *u
     LPCWSTR lpName = reinterpret_cast<LPCWSTR>(ustrVar->buffer);
     LPCWSTR lpValue = reinterpret_cast<LPCWSTR>(ustrValue->buffer);
     if (SetEnvironmentVariableW(lpName, lpValue))
+    {
+        wchar_t *buffer = new wchar_t[wcslen(lpName) + 1 + wcslen(lpValue) + 1];
+        wcscpy(buffer, lpName);
+        wcscat(buffer, L"=");
+        wcscat(buffer, lpValue);
+        _wputenv(buffer);
+        delete[] buffer;
         return osl_Process_E_None;
+    }
     return osl_Process_E_Unknown;
 }
 
@@ -429,7 +438,14 @@ oslProcessError SAL_CALL osl_clearEnvironment(rtl_uString *ustrVar)
     //process's environment.
     LPCWSTR lpName = reinterpret_cast<LPCWSTR>(ustrVar->buffer);
     if (SetEnvironmentVariableW(lpName, NULL))
+    {
+        wchar_t *buffer = new wchar_t[wcslen(lpName) + 1 + 1];
+        wcscpy(buffer, lpName);
+        wcscat(buffer, L"=");
+        _wputenv(buffer);
+        delete[] buffer;
         return osl_Process_E_None;
+    }
     return osl_Process_E_Unknown;
 }
 


More information about the Libreoffice-commits mailing list