This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 15c65b16d509a8205b0c87d327e641203074f87c
Author: Andrew Stitcher <[email protected]>
AuthorDate: Wed Apr 3 15:40:49 2019 -0400

    PROTON-2023: [C++] Fix Json connect file test to work with Windows
---
 cpp/src/connect_config_test.cpp | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/cpp/src/connect_config_test.cpp b/cpp/src/connect_config_test.cpp
index 8a17bba..b7e9d93 100644
--- a/cpp/src/connect_config_test.cpp
+++ b/cpp/src/connect_config_test.cpp
@@ -37,7 +37,34 @@
 #include <sstream>
 #include <fstream>
 #include <cstdio>
+#include <cstdlib>
 
+// Windows has a different set of APIs for setting the environment
+#ifdef _WIN32
+#include <string.h>
+namespace {
+    void setenv(const char* var, const char* value, int) {
+        int vlen = strlen(var);
+        int len = vlen+strlen(value)+1;
+        char* buff = new char[len+1];
+        strcpy(buff, var);
+        strcpy(buff+vlen, "=");
+        strcpy(buff+vlen+1, value);
+        _putenv(buff);
+        delete [] buff;
+    }
+
+    void unsetenv(const char* var) {
+        int len = strlen(var);
+        char* buff = new char[len+1];
+        strcpy(buff, var);
+        strcpy(buff+len, "=");
+        _putenv(buff);
+        delete [] buff;
+    }
+}
+
+#endif
 namespace {
 
 using namespace std;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to