1- // v1.0 works on vs2010 or later
1+ // v1.0.1 add vs2022 17.8.0 support
2+ // v1.0.0 works on vs2010 to vs2022 17.7.x
3+
24#ifndef SIMDSOFT__NTCVT_HPP
35#define SIMDSOFT__NTCVT_HPP
46
@@ -33,7 +35,12 @@ class intrusive_string : public std::basic_string<_Elem, _Traits, _Alloc>
3335 std::_String_iter_types<
3436 _Elem, typename _Alty_traits::size_type,
3537 typename _Alty_traits::difference_type, typename _Alty_traits::pointer,
38+ # if _MSC_VER < 1938
3639 typename _Alty_traits::const_pointer, _Elem&, const _Elem&>>>;
40+ # else // VS2022 17.8.0+
41+ typename _Alty_traits::const_pointer>>>;
42+ # endif
43+
3744#endif
3845 // See also afxmfc CString::GetBufferSetLength
3946 // Why do this hack?
@@ -105,7 +112,7 @@ template <typename _StringContType>
105112inline _StringContType wcbs2a (const wchar_t * wcb, int len, UINT cp = NTCVT_CP_DEFAULT)
106113{
107114 if (len == -1 )
108- len = lstrlenW ( wcb);
115+ len = static_cast < int >( wcslen ( wcb) );
109116 _StringContType buffer;
110117 int cch;
111118 if (len > 0 && (cch = ::WideCharToMultiByte (cp, 0 , wcb, len, NULL , 0 , NULL , NULL )) > 0 )
@@ -122,7 +129,7 @@ template <typename _StringContType>
122129inline _StringContType mcbs2w (const char * mcb, int len, UINT cp = NTCVT_CP_DEFAULT)
123130{
124131 if (len == -1 )
125- len = lstrlenA ( mcb);
132+ len = static_cast < int >( strlen ( mcb) );
126133 _StringContType buffer;
127134 int cch;
128135 if (len > 0 && (cch = ::MultiByteToWideChar (cp, 0 , mcb, len, NULL , 0 )) > 0 )
@@ -139,7 +146,7 @@ inline _StringContType mcbs2w(const char* mcb, int len, UINT cp = NTCVT_CP_DEFAU
139146inline int mcbs2w (const char * mcb, int len, wchar_t * wbuf, int wbuf_len, UINT cp = NTCVT_CP_DEFAULT)
140147{
141148 if (len == -1 )
142- len = lstrlenA ( mcb);
149+ len = static_cast < int >( strlen ( mcb) );
143150 int cch;
144151 if (len > 0 && (cch = ::MultiByteToWideChar (cp, 0 , mcb, len, NULL , 0 )) > 0 )
145152 return ::MultiByteToWideChar (cp, 0 , mcb, len, wbuf, wbuf_len);
@@ -150,7 +157,7 @@ inline int mcbs2w(const char* mcb, int len, wchar_t* wbuf, int wbuf_len, UINT cp
150157inline wchar_t * mcbs2wdup (const char * mcb, int len, int * wbuf_len, UINT cp = NTCVT_CP_DEFAULT)
151158{
152159 if (len == -1 )
153- len = lstrlenA ( mcb);
160+ len = static_cast < int >( strlen ( mcb) );
154161 int cch;
155162 if (len > 0 && (cch = ::MultiByteToWideChar (cp, 0 , mcb, len, NULL , 0 )) > 0 )
156163 {
0 commit comments