@@ -82,7 +82,7 @@ template <typename T> struct literal_macro_help
82
82
{
83
83
return c;
84
84
}
85
- static CONSTEXPR const char result (const char c, const wchar_t ) NOEXCEPT
85
+ static CONSTEXPR char result (const char c, const wchar_t ) NOEXCEPT
86
86
{
87
87
return c;
88
88
}
@@ -95,7 +95,7 @@ template <> struct literal_macro_help<wchar_t>
95
95
{
96
96
return wc;
97
97
}
98
- static CONSTEXPR const wchar_t result (const char , const wchar_t wc) NOEXCEPT
98
+ static CONSTEXPR wchar_t result (const char , const wchar_t wc) NOEXCEPT
99
99
{
100
100
return wc;
101
101
}
@@ -109,10 +109,18 @@ inline std::string string_converter(const std::wstring &w) NOEXCEPT
109
109
{
110
110
std::mbstate_t state = std::mbstate_t ();
111
111
auto wstr = w.data ();
112
+ // unsafe: ignores any error handling
113
+ // and disables warning that wcsrtombs_s should be used
114
+ #ifdef WIN32
115
+ #pragma warning(push)
116
+ #pragma warning(disable : 4996)
117
+ #endif
112
118
std::size_t len = 1 + std::wcsrtombs (nullptr , &wstr, 0 , &state);
113
119
std::string mbstr (len, ' \0 ' );
114
- // unsafe: ignores any error handling
115
120
std::wcsrtombs (&mbstr[0 ], &wstr, mbstr.size (), &state);
121
+ #ifdef WIN32
122
+ #pragma warning(pop)
123
+ #endif
116
124
return mbstr;
117
125
}
118
126
@@ -258,7 +266,7 @@ std::basic_string<typename iStreamT::char_type> read_file(iStreamT &inStream)
258
266
return str;
259
267
260
268
inStream.seekg (0 , std::ios::beg);
261
- inStream.read (&str[0 ], str.size ());
269
+ inStream.read (&str[0 ], static_cast <std::streamsize>( str.size () ));
262
270
return str;
263
271
}
264
272
@@ -502,8 +510,7 @@ std::vector<std::unique_ptr<OutputT>> read_internal(
502
510
503
511
curIter = skip_whitespaces (curIter, last);
504
512
505
- auto conditional = conditional_fullfilled (curIter, last);
506
- if (!conditional)
513
+ if (!conditional_fullfilled (curIter, last))
507
514
continue ;
508
515
if (curIter == last)
509
516
throw std::runtime_error{" key declared, but no value" };
@@ -538,8 +545,7 @@ std::vector<std::unique_ptr<OutputT>> read_internal(
538
545
curIter =
539
546
valueEnd + ((*valueEnd == TYTI_L (charT, ' \" ' )) ? 1 : 0 );
540
547
541
- auto conditional = conditional_fullfilled (curIter, last);
542
- if (!conditional)
548
+ if (!conditional_fullfilled (curIter, last))
543
549
continue ;
544
550
545
551
// process value
0 commit comments