[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/qca/unittest/pgpunittest
From:       Justin Karneges <infiniti () affinix ! com>
Date:       2008-07-21 1:12:00
Message-ID: 1216602720.012830.21946.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 835695 by infiniti:

oops, qputenv is not available in 4.2.  copy it from 4.4 for now.


 M  +15 -1     pgpunittest.cpp  


--- trunk/kdesupport/qca/unittest/pgpunittest/pgpunittest.cpp #835694:835695
@@ -28,11 +28,25 @@
 
 #include <stdlib.h>
 
+// qt did not introduce qputenv until 4.4, so we'll keep a copy here for 4.2
+//   compat
+bool my_qputenv(const char *varName, const QByteArray& value)
+{
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+    return _putenv_s(varName, value.constData()) == 0;
+#else
+    QByteArray buffer(varName);
+    buffer += "=";
+    buffer += value;
+    return putenv(qstrdup(buffer.constData())) == 0;
+#endif
+}
+
 static int qca_setenv(const char *name, const char *value, int overwrite)
 {
     if (!overwrite && !qgetenv(name).isNull()) return 0;
 
-    if(qputenv(name, QByteArray(value)))
+    if(my_qputenv(name, QByteArray(value)))
         return 0; // success
     else
         return 1; // error
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic