diff --git a/src/support/convert.C b/src/support/convert.C index 698365e4a7..bd8dc2ec17 100644 --- a/src/support/convert.C +++ b/src/support/convert.C @@ -53,12 +53,14 @@ string convert(int i) return lexical_cast(i); } + template<> docstring convert(int i) { return lyx::from_ascii(lexical_cast(i)); } + template<> string convert(unsigned int ui) { @@ -66,6 +68,13 @@ string convert(unsigned int ui) } +template<> +docstring convert(unsigned int ui) +{ + return lyx::from_ascii(lexical_cast(ui)); +} + + template<> string convert(unsigned long ul) { @@ -80,6 +89,13 @@ string convert(long l) } +template<> +docstring convert(long l) +{ + return lyx::from_ascii(lexical_cast(l)); +} + + template<> string convert(float f) { diff --git a/src/support/lstrings.C b/src/support/lstrings.C index f9fc6cbd00..a142dae8fb 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -705,6 +705,7 @@ docstring bformat(docstring const & fmt, docstring arg1) } +template<> docstring bformat(docstring const & fmt, char * arg1) { return (boost::basic_format(fmt) % arg1).str(); @@ -788,9 +789,11 @@ template<> docstring bformat(docstring const & fmt, char * arg1) { BOOST_ASSERT(contains(fmt, lyx::from_ascii("%1$s"))); - docstring const str = subst(fmt, lyx::from_ascii("%1$s"), arg1); + docstring const str = subst(fmt, lyx::from_ascii("%1$s"), lyx::from_ascii(arg1)); return subst(str, lyx::from_ascii("%%"), lyx::from_ascii("%")); } + + template<> docstring bformat(docstring const & fmt, docstring arg1, docstring arg2) { @@ -807,7 +810,7 @@ docstring bformat(docstring const & fmt, char const * arg1, docstring arg2) { BOOST_ASSERT(contains(fmt, lyx::from_ascii("%1$s"))); BOOST_ASSERT(contains(fmt, lyx::from_ascii("%2$s"))); - docstring str = subst(fmt, lyx::from_ascii("%1$s"), arg1); + docstring str = subst(fmt, lyx::from_ascii("%1$s"), lyx::from_ascii(arg1)); str = subst(fmt, lyx::from_ascii("%2$s"), arg2); return subst(str, lyx::from_ascii("%%"), lyx::from_ascii("%")); }