Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
Diffstat (limited to 'intern')
-rw-r--r--intern/utfconv/utf_winfunc.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/intern/utfconv/utf_winfunc.c b/intern/utfconv/utf_winfunc.c
index 2ae261b44a8..19917571b5e 100644
--- a/intern/utfconv/utf_winfunc.c
+++ b/intern/utfconv/utf_winfunc.c
@@ -166,12 +166,23 @@ int uputenv(const char *name, const char *value)
{
int r = -1;
UTF16_ENCODE(name);
- UTF16_ENCODE(value);
- if (name_16 && value_16) {
- r = (SetEnvironmentVariableW(name_16,value_16)!= 0) ? 0 : -1;
+ if (value) {
+ /* set */
+ UTF16_ENCODE(value);
+
+ if (name_16 && value_16) {
+ r = (SetEnvironmentVariableW(name_16,value_16)!= 0) ? 0 : -1;
+ }
+ UTF16_UN_ENCODE(value);
}
- UTF16_UN_ENCODE(value);
+ else {
+ /* clear */
+ if (name_16) {
+ r = (SetEnvironmentVariableW(name_16,NULL)!= 0) ? 0 : -1;
+ }
+ }
+
UTF16_UN_ENCODE(name);
return r;