@@ -152,15 +152,6 @@ namespace Rcpp {
152152# endif
153153#endif
154154
155- #ifdef TINYFORMAT_USE_VARIADIC_TEMPLATES
156- # include < array>
157- # if defined(_MSC_VER) && _MSC_VER <= 1800 // VS2013
158- # define TINYFORMAT_BRACED_INIT_WORKAROUND (x ) (x)
159- # else
160- # define TINYFORMAT_BRACED_INIT_WORKAROUND (x ) {x}
161- # endif
162- #endif
163-
164155#if defined(__GLIBCXX__) && __GLIBCXX__ < 20080201
165156// std::showpos is broken on old libstdc++ as provided with OSX. See
166157// http://gcc.gnu.org/ml/libstdc++/2007-11/msg00075.html
@@ -282,7 +273,7 @@ inline void formatTruncated(std::ostream& out, const T& value, int ntrunc)
282273 std::ostringstream tmp;
283274 tmp << value;
284275 std::string result = tmp.str ();
285- out.write (result.c_str (), std::min (ntrunc, static_cast <int >(result.size ())));
276+ out.write (result.c_str (), ( std::min) (ntrunc, static_cast <int >(result.size ())));
286277}
287278#define TINYFORMAT_DEFINE_FORMAT_TRUNCATED_CSTR (type ) \
288279inline void formatTruncated (std::ostream& out, type* value, int ntrunc) \
@@ -332,8 +323,8 @@ inline void formatValue(std::ostream& out, const char* /*fmtBegin*/,
332323 // void* respectively and format that instead of the value itself. For the
333324 // %p conversion it's important to avoid dereferencing the pointer, which
334325 // could otherwise lead to a crash when printing a dangling (const char*).
335- bool canConvertToChar = detail::is_convertible<T,char >::value;
336- bool canConvertToVoidPtr = detail::is_convertible<T, const void *>::value;
326+ const bool canConvertToChar = detail::is_convertible<T,char >::value;
327+ const bool canConvertToVoidPtr = detail::is_convertible<T, const void *>::value;
337328 if (canConvertToChar && *(fmtEnd-1 ) == ' c' )
338329 detail::formatValueAsType<T, char >::invoke (out, value);
339330 else if (canConvertToVoidPtr && *(fmtEnd-1 ) == ' p' )
@@ -566,15 +557,17 @@ inline const char* printFormatStringLiteral(std::ostream& out, const char* fmt)
566557 switch (*c)
567558 {
568559 case ' \0 ' :
569- out.write (fmt, static_cast <std::streamsize>( c - fmt) );
560+ out.write (fmt, c - fmt);
570561 return c;
571562 case ' %' :
572- out.write (fmt, static_cast <std::streamsize>( c - fmt) );
563+ out.write (fmt, c - fmt);
573564 if (*(c+1 ) != ' %' )
574565 return c;
575566 // for "%%", tack trailing % onto next literal section.
576567 fmt = ++c;
577568 break ;
569+ default :
570+ break ;
578571 }
579572 }
580573}
@@ -644,6 +637,8 @@ inline const char* streamStateFromFormat(std::ostream& out, bool& spacePadPositi
644637 spacePadPositive = false ;
645638 widthExtra = 1 ;
646639 continue ;
640+ default :
641+ break ;
647642 }
648643 break ;
649644 }
@@ -757,6 +752,8 @@ inline const char* streamStateFromFormat(std::ostream& out, bool& spacePadPositi
757752 TINYFORMAT_ERROR (" tinyformat: Conversion spec incorrectly "
758753 " terminated by end of string" );
759754 return c;
755+ default :
756+ break ;
760757 }
761758 if (intConversion && precisionSet && !widthSet)
762759 {
@@ -869,7 +866,7 @@ class FormatListN : public FormatList
869866 template <typename ... Args>
870867 FormatListN (const Args&... args)
871868 : FormatList(&m_formatterStore[0 ], N),
872- m_formatterStore TINYFORMAT_BRACED_INIT_WORKAROUND( { FormatArg (args)... })
869+ m_formatterStore { FormatArg (args)... }
873870 { static_assert (sizeof ...(args) == N, " Number of args must be N" ); }
874871#else // C++98 version
875872 void init (int ) {}
@@ -878,7 +875,7 @@ class FormatListN : public FormatList
878875 template <TINYFORMAT_ARGTYPES(n)> \
879876 FormatListN (TINYFORMAT_VARARGS(n)) \
880877 : FormatList(&m_formatterStore[0 ], n) \
881- {/* assert* n == N);*/ init (0 , TINYFORMAT_PASSARGS (n)); } \
878+ {/* assert( n == N);*/ init (0 , TINYFORMAT_PASSARGS (n)); } \
882879 \
883880 template <TINYFORMAT_ARGTYPES(n)> \
884881 void init (int i, TINYFORMAT_VARARGS(n)) \
@@ -892,11 +889,7 @@ class FormatListN : public FormatList
892889#endif
893890
894891 private:
895- #ifdef TINYFORMAT_USE_VARIADIC_TEMPLATES
896- std::array<FormatArg, N> m_formatterStore;
897- #else // C++98 version
898892 FormatArg m_formatterStore[N];
899- #endif
900893};
901894
902895// Special 0-arg version - MSVC says zero-sized C array in struct is nonstandard
@@ -1048,4 +1041,4 @@ TINYFORMAT_FOREACH_ARGNUM(TINYFORMAT_MAKE_FORMAT_FUNCS)
10481041
10491042} // namespace tinyformat
10501043
1051- #endif // TINYFORMAT_H_INCLUDED
1044+ #endif // TINYFORMAT_H_INCLUDED
0 commit comments