Salome HOME
projects
/
modules
/
kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[EDF29150] : head monitoring file management
[modules/kernel.git]
/
src
/
Basics
/
Basics_Utils.cxx
diff --git
a/src/Basics/Basics_Utils.cxx
b/src/Basics/Basics_Utils.cxx
index 15f59842739c6308be81706d76e62ee7d0593884..d5de49184e28902721d9d2492375f71ca81a5243 100644
(file)
--- a/
src/Basics/Basics_Utils.cxx
+++ b/
src/Basics/Basics_Utils.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-202
0 CEA/DEN, EDF R&D
, OPEN CASCADE
+// Copyright (C) 2007-202
3 CEA, EDF
, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@
-32,6
+32,8
@@
#include <execinfo.h>
#endif
#include <execinfo.h>
#endif
+#include <memory>
+#include <functional>
namespace Kernel_Utils
{
namespace Kernel_Utils
{
@@
-144,7
+146,8
@@
namespace Kernel_Utils
std::string encode_s(const wchar_t* decoded)
{
std::string encode_s(const wchar_t* decoded)
{
- return std::string(encode(decoded));
+ std::unique_ptr<char,std::function<void(char*)>> tmp((char *)encode(decoded),[](char *ptr) { delete [] ptr; });
+ return std::string(tmp.get());
}
#ifndef WIN32
}
#ifndef WIN32
@@
-172,7
+175,7
@@
namespace Kernel_Utils
{
std::stringstream sstr;
sstr<<name<<'='<<value;
{
std::stringstream sstr;
sstr<<name<<'='<<value;
- if(rewrite || std::string(getenv(name)).length() == 0)
+ if(rewrite ||
getenv(name) == nullptr ||
std::string(getenv(name)).length() == 0)
return _putenv(sstr.str().c_str());
else return -1;
}
return _putenv(sstr.str().c_str());
else return -1;
}