@@ -152,15 +152,6 @@ namespace Rcpp {
152
152
# endif
153
153
#endif
154
154
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
-
164
155
#if defined(__GLIBCXX__) && __GLIBCXX__ < 20080201
165
156
// std::showpos is broken on old libstdc++ as provided with OSX. See
166
157
// 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)
282
273
std::ostringstream tmp;
283
274
tmp << value;
284
275
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 ())));
286
277
}
287
278
#define TINYFORMAT_DEFINE_FORMAT_TRUNCATED_CSTR (type ) \
288
279
inline void formatTruncated (std::ostream& out, type* value, int ntrunc) \
@@ -332,8 +323,8 @@ inline void formatValue(std::ostream& out, const char* /*fmtBegin*/,
332
323
// void* respectively and format that instead of the value itself. For the
333
324
// %p conversion it's important to avoid dereferencing the pointer, which
334
325
// 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;
337
328
if (canConvertToChar && *(fmtEnd-1 ) == ' c' )
338
329
detail::formatValueAsType<T, char >::invoke (out, value);
339
330
else if (canConvertToVoidPtr && *(fmtEnd-1 ) == ' p' )
@@ -566,15 +557,17 @@ inline const char* printFormatStringLiteral(std::ostream& out, const char* fmt)
566
557
switch (*c)
567
558
{
568
559
case ' \0 ' :
569
- out.write (fmt, static_cast <std::streamsize>( c - fmt) );
560
+ out.write (fmt, c - fmt);
570
561
return c;
571
562
case ' %' :
572
- out.write (fmt, static_cast <std::streamsize>( c - fmt) );
563
+ out.write (fmt, c - fmt);
573
564
if (*(c+1 ) != ' %' )
574
565
return c;
575
566
// for "%%", tack trailing % onto next literal section.
576
567
fmt = ++c;
577
568
break ;
569
+ default :
570
+ break ;
578
571
}
579
572
}
580
573
}
@@ -644,6 +637,8 @@ inline const char* streamStateFromFormat(std::ostream& out, bool& spacePadPositi
644
637
spacePadPositive = false ;
645
638
widthExtra = 1 ;
646
639
continue ;
640
+ default :
641
+ break ;
647
642
}
648
643
break ;
649
644
}
@@ -757,6 +752,8 @@ inline const char* streamStateFromFormat(std::ostream& out, bool& spacePadPositi
757
752
TINYFORMAT_ERROR (" tinyformat: Conversion spec incorrectly "
758
753
" terminated by end of string" );
759
754
return c;
755
+ default :
756
+ break ;
760
757
}
761
758
if (intConversion && precisionSet && !widthSet)
762
759
{
@@ -869,7 +866,7 @@ class FormatListN : public FormatList
869
866
template <typename ... Args>
870
867
FormatListN (const Args&... args)
871
868
: FormatList(&m_formatterStore[0 ], N),
872
- m_formatterStore TINYFORMAT_BRACED_INIT_WORKAROUND( { FormatArg (args)... })
869
+ m_formatterStore { FormatArg (args)... }
873
870
{ static_assert (sizeof ...(args) == N, " Number of args must be N" ); }
874
871
#else // C++98 version
875
872
void init (int ) {}
@@ -878,7 +875,7 @@ class FormatListN : public FormatList
878
875
template <TINYFORMAT_ARGTYPES(n)> \
879
876
FormatListN (TINYFORMAT_VARARGS(n)) \
880
877
: FormatList(&m_formatterStore[0 ], n) \
881
- {/* assert* n == N);*/ init (0 , TINYFORMAT_PASSARGS (n)); } \
878
+ {/* assert( n == N);*/ init (0 , TINYFORMAT_PASSARGS (n)); } \
882
879
\
883
880
template <TINYFORMAT_ARGTYPES(n)> \
884
881
void init (int i, TINYFORMAT_VARARGS(n)) \
@@ -892,11 +889,7 @@ class FormatListN : public FormatList
892
889
#endif
893
890
894
891
private:
895
- #ifdef TINYFORMAT_USE_VARIADIC_TEMPLATES
896
- std::array<FormatArg, N> m_formatterStore;
897
- #else // C++98 version
898
892
FormatArg m_formatterStore[N];
899
- #endif
900
893
};
901
894
902
895
// Special 0-arg version - MSVC says zero-sized C array in struct is nonstandard
0 commit comments