Commit d7ebcc2a authored by Max Lyon's avatar Max Lyon

remove some more c++11/Windows features

parent 1d6aa957
......@@ -2,6 +2,7 @@
#include "Base/Security/Mandatory.hh"
#include "Environment.hh"
#include <cstdlib>
namespace System {
namespace Environment {
......@@ -17,8 +18,8 @@ bool variable(const char* _vrbl_name, std::string& _vrbl)
getenv_s(&char_nmbr, &_vrbl[0], char_nmbr, _vrbl_name);
_vrbl.resize(char_nmbr - 1); // remove the trailing \0 char
#else
const char* vrbl_env = getenv("REFORM_DEB_CONFIG");
if (vrbl_env == nullptr)
const char* vrbl_env = std::getenv("REFORM_DEB_CONFIG");
if (vrbl_env == NULL)
return false;
_vrbl = vrbl_env;
#endif
......
......@@ -86,7 +86,7 @@ IOutputStream& operator<<(IOutputStream& _os, const FunctionNameFilter& _fnf)
for(;;)
{
const char* lmbd_pos = strstr(fnct, lmbd);
if (lmbd_pos == nullptr)
if (lmbd_pos == NULL)
{// print the rest of the function name
_os << fnct;
break;
......@@ -110,8 +110,8 @@ IOutputStream& operator<<(IOutputStream& _os, const CodeLink& _lnk)
const char path_sep = '/';
#endif//WIN32
auto flnm_pntr = strrchr(_lnk.file, path_sep);
if (flnm_pntr == nullptr)
const char* flnm_pntr = strrchr(_lnk.file, path_sep);
if (flnm_pntr == NULL)
flnm_pntr = _lnk.file;
else
++flnm_pntr;
......
......@@ -5,6 +5,12 @@
#include <stdarg.h>
#ifndef WIN32
#include <cstdio>
#include <cstdarg>
#include <sstream>
#endif
namespace Base {
namespace {
......@@ -14,7 +20,11 @@ int sprintf_s(char (&_bffr)[_bffr_size], const char* _frmt, ...)
{
va_list arg_ptr;
va_start(arg_ptr, _frmt);
#ifndef WIN32
int res = vsprintf(_bffr, _frmt, arg_ptr);
#else
int res = vsprintf_s(_bffr, _bffr_size, _frmt, arg_ptr);
#endif // WIN32
va_end(arg_ptr);
return res;
}
......@@ -25,7 +35,11 @@ int print(char* _bffr, const size_t _bffr_size, const char* _frmt, ...)
{
va_list arg_ptr;
va_start(arg_ptr, _frmt);
#ifndef WIN32
int res = vsprintf(_bffr, _frmt, arg_ptr);
#else
int res = vsprintf_s(_bffr, _bffr_size, _frmt, arg_ptr);
#endif
va_end(arg_ptr);
return res;
}
......@@ -38,13 +52,25 @@ IOutputStream& OStringStream::print(const char _c)
IOutputStream& OStringStream::print(const int _i)
{
#ifndef WIN32
std::stringstream ss;
ss << _i;
str.append(ss.str());
#else
str.append(std::to_string(_i));
#endif // WIN32
return *this;
}
IOutputStream& OStringStream::print(const size_t _i)
{
#ifndef WIN32
std::stringstream ss;
ss << _i;
str.append(ss.str());
#else
str.append(std::to_string(_i));
#endif // WIN32
return *this;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment