diff options
author | Jan Klass <kissaki@posteo.de> | 2017-04-29 14:34:01 +0300 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2017-05-20 20:59:13 +0300 |
commit | d8f7800b161f52b2c7b2f5bae1d4c9a48891bb28 (patch) | |
tree | 204b7e552d8dc1e6f37eb80dc4404c11309ce5aa /src | |
parent | 3399a50b8e1a477b2223be37c63dec9eaeb18da1 (diff) |
Make use of EnvUtils::setenv
Diffstat (limited to 'src')
-rw-r--r-- | src/mumble/main.cpp | 5 | ||||
-rw-r--r-- | src/murmur/UnixMurmur.cpp | 3 | ||||
-rw-r--r-- | src/murmur/main.cpp | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp index fbc463d00..a2db70f4b 100644 --- a/src/mumble/main.cpp +++ b/src/mumble/main.cpp @@ -38,6 +38,7 @@ #include "Themes.h" #include "UserLockFile.h" #include "License.h" +#include "EnvUtils.h" #if defined(USE_STATIC_QT_PLUGINS) && QT_VERSION < 0x050000 Q_IMPORT_PLUGIN(qtaccessiblewidgets) @@ -78,7 +79,7 @@ int main(int argc, char **argv) { SetDllDirectory(L""); #else #ifndef Q_OS_MAC - setenv("AVAHI_COMPAT_NOWARN", "1", 1); + EnvUtils::setenv(QLatin1String("AVAHI_COMPAT_NOWARN"), QLatin1String("1")); #endif #endif @@ -103,7 +104,7 @@ int main(int argc, char **argv) { { QDir d(a.applicationVersionRootPath()); QString helper = d.absoluteFilePath(QString::fromLatin1("sbcelt-helper")); - setenv("SBCELT_HELPER_BINARY", helper.toUtf8().constData(), 1); + EnvUtils::setenv(QLatin1String("SBCELT_HELPER_BINARY"), helper.toUtf8().constData()); } #endif diff --git a/src/murmur/UnixMurmur.cpp b/src/murmur/UnixMurmur.cpp index a3429503f..56da21ea2 100644 --- a/src/murmur/UnixMurmur.cpp +++ b/src/murmur/UnixMurmur.cpp @@ -8,6 +8,7 @@ #include "UnixMurmur.h" #include "Meta.h" +#include "EnvUtils.h" QMutex *LimitTest::qm; QWaitCondition *LimitTest::qw; @@ -274,7 +275,7 @@ void UnixMurmur::setuid() { // QDir::homePath is broken. It only looks at $HOME // instead of getpwuid() so we have to set our home // ourselves - ::setenv("HOME", qPrintable(Meta::mp.qsHome), 1); + EnvUtils::setenv(QLatin1String("HOME"), qPrintable(Meta::mp.qsHome)); } #endif } else if (bRoot) { diff --git a/src/murmur/main.cpp b/src/murmur/main.cpp index 26ac98b2a..fdf5cb487 100644 --- a/src/murmur/main.cpp +++ b/src/murmur/main.cpp @@ -187,7 +187,7 @@ int main(int argc, char **argv) { a.setWindowIcon(icon); #else #ifndef Q_OS_MAC - setenv("AVAHI_COMPAT_NOWARN", "1", 1); + EnvUtils::setenv(QLatin1String("AVAHI_COMPAT_NOWARN"), QLatin1String("1")); #endif QCoreApplication a(argc, argv); UnixMurmur unixhandler; @@ -215,9 +215,7 @@ int main(int argc, char **argv) { qWarning() << "Failed to get PATH. Not adding application directory to PATH. DBus bindings may not work."; } else { QString newPath = QString::fromLatin1("%1;%2").arg(QDir::toNativeSeparators(a.applicationDirPath())).arg(path); - STACKVAR(wchar_t, buffout, newPath.length() + 1); - newPath.toWCharArray(buffout); - if (_wputenv_s(L"PATH", buffout) != 0) { + if (!EnvUtils::setenv(QLatin1String("PATH"), newPath)) { qWarning() << "Failed to set PATH. DBus bindings may not work."; } } |