|
@@ -19,14 +19,13 @@ namespace bx
|
|
|
char temp[2048];
|
|
char temp[2048];
|
|
|
|
|
|
|
|
char* out = temp;
|
|
char* out = temp;
|
|
|
- int32_t len = bx::vsnprintf(out, sizeof(temp), _format, _argList);
|
|
|
|
|
- if ( (int32_t)sizeof(temp) < len)
|
|
|
|
|
|
|
+ int32_t len = vsnprintf(out, sizeof(temp), _format, _argList);
|
|
|
|
|
+ if (int32_t(sizeof(temp) ) < len)
|
|
|
{
|
|
{
|
|
|
- out = (char*)alloca(len+1);
|
|
|
|
|
- len = bx::vsnprintf(out, len, _format, _argList);
|
|
|
|
|
|
|
+ out = (char*)alloca(len);
|
|
|
|
|
+ len = vsnprintf(out, len, _format, _argList);
|
|
|
}
|
|
}
|
|
|
- out[len] = '\0';
|
|
|
|
|
- _out.append(out);
|
|
|
|
|
|
|
+ _out.append(out, out+len);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
template <typename Ty>
|
|
template <typename Ty>
|
|
@@ -86,6 +85,12 @@ namespace bx
|
|
|
set(_ptr, _term);
|
|
set(_ptr, _term);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ template<typename Ty>
|
|
|
|
|
+ inline StringView::StringView(const Ty& _container)
|
|
|
|
|
+ {
|
|
|
|
|
+ set(_container);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
inline void StringView::set(const char* _ptr, int32_t _len)
|
|
inline void StringView::set(const char* _ptr, int32_t _len)
|
|
|
{
|
|
{
|
|
|
clear();
|
|
clear();
|
|
@@ -106,6 +111,12 @@ namespace bx
|
|
|
set(_ptr, int32_t(_term-_ptr) );
|
|
set(_ptr, int32_t(_term-_ptr) );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ template<typename Ty>
|
|
|
|
|
+ inline void StringView::set(const Ty& _container)
|
|
|
|
|
+ {
|
|
|
|
|
+ set(_container.data(), _container.length() );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
inline void StringView::set(const StringView& _str)
|
|
inline void StringView::set(const StringView& _str)
|
|
|
{
|
|
{
|
|
|
set(_str.m_ptr, _str.m_len);
|
|
set(_str.m_ptr, _str.m_len);
|