summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/dialogs/cuicharmap.cxx6
-rw-r--r--include/rtl/stringconcat.hxx97
-rw-r--r--oox/source/export/chartexport.cxx2
-rw-r--r--sc/source/core/tool/interpr7.cxx2
-rw-r--r--scaddins/source/analysis/analysishelper.cxx2
-rw-r--r--starmath/source/dialog.cxx2
-rw-r--r--svl/source/numbers/zforlist.cxx2
-rw-r--r--svl/source/numbers/zformat.cxx4
-rw-r--r--unoidl/source/sourceprovider-scanner.l3
-rw-r--r--winaccessibility/source/UAccCOM/AccTextBase.cxx2
-rw-r--r--xmloff/source/style/xmlnumfi.cxx2
11 files changed, 57 insertions, 67 deletions
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index 3f0ace55a9b4..dba595d5dd21 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -873,7 +873,7 @@ IMPL_LINK(SvxCharacterMap, CharClickHdl, SvxCharView*, rView, void)
OUString charValue = rView->GetText();
sal_Int32 tmp = 1;
sal_UCS4 cChar = charValue.iterateCodePoints(&tmp, -1);
- OUString aHexText = OUString(OUString::number(cChar, 16)).toAsciiUpperCase();
+ OUString aHexText = OUString::number(cChar, 16).toAsciiUpperCase();
// Get the decimal code
OUString aDecimalText = OUString::number(cChar);
@@ -961,7 +961,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void)
// using the new UCS4 constructor
aText = OUString( &cChar, 1 );
// Get the hexadecimal code
- aHexText = OUString(OUString::number(cChar, 16)).toAsciiUpperCase();
+ aHexText = OUString::number(cChar, 16).toAsciiUpperCase();
// Get the decimal code
aDecimalText = OUString::number(cChar);
setCharName(cChar);
@@ -1001,7 +1001,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchCharHighlightHdl, SvxShowCharSet*, void)
{
aText = OUString( &cChar, 1 );
// Get the hexadecimal code
- aHexText = OUString(OUString::number(cChar, 16)).toAsciiUpperCase();
+ aHexText = OUString::number(cChar, 16).toAsciiUpperCase();
// Get the decimal code
aDecimalText = OUString::number(cChar);
setCharName(cChar);
diff --git a/include/rtl/stringconcat.hxx b/include/rtl/stringconcat.hxx
index 50522636ea3d..eea2e7afcd47 100644
--- a/include/rtl/stringconcat.hxx
+++ b/include/rtl/stringconcat.hxx
@@ -321,62 +321,55 @@ OString::number() to OString.
template< typename T >
struct OStringNumber;
-template<>
-struct OStringNumber< int >
+template <class Derived, int nBufSize> struct OStringNumberBase
{
- OStringNumber( int i, sal_Int16 radix )
- : length( rtl_str_valueOfInt32( buf, i, radix ))
- {}
// OString::number(value).getStr() is very common (writing xml code, ...),
// so implement that one also here, to avoid having to explicitly to convert
// to OString in all such places
const char * getStr() const SAL_RETURNS_NONNULL { return buf; }
- char buf[RTL_STR_MAX_VALUEOFINT32];
- const sal_Int32 length;
+ Derived&& toAsciiUpperCase()
+ {
+ rtl_str_toAsciiUpperCase_WithLength(buf, length);
+ return std::move(*static_cast<Derived*>(this));
+ }
+ char buf[nBufSize];
+ sal_Int32 length;
+};
+
+template<>
+struct OStringNumber< int >
+ : public OStringNumberBase<OStringNumber<int>, RTL_STR_MAX_VALUEOFINT32>
+{
+ OStringNumber(int i, sal_Int16 radix) { length = rtl_str_valueOfInt32(buf, i, radix); }
};
template<>
struct OStringNumber< long long >
+ : public OStringNumberBase<OStringNumber<long long>, RTL_STR_MAX_VALUEOFINT64>
{
- OStringNumber( long long ll, sal_Int16 radix )
- : length( rtl_str_valueOfInt64( buf, ll, radix ))
- {}
- const char * getStr() const SAL_RETURNS_NONNULL { return buf; }
- char buf[RTL_STR_MAX_VALUEOFINT64];
- const sal_Int32 length;
+ OStringNumber(long long ll, sal_Int16 radix) { length = rtl_str_valueOfInt64(buf, ll, radix); }
};
template<>
struct OStringNumber< unsigned long long >
+ : public OStringNumberBase<OStringNumber<unsigned long long>, RTL_STR_MAX_VALUEOFUINT64>
{
OStringNumber( unsigned long long ll, sal_Int16 radix )
- : length( rtl_str_valueOfUInt64( buf, ll, radix ))
- {}
- const char * getStr() const SAL_RETURNS_NONNULL { return buf; }
- char buf[RTL_STR_MAX_VALUEOFUINT64];
- const sal_Int32 length;
+ { length = rtl_str_valueOfUInt64(buf, ll, radix); }
};
template<>
struct OStringNumber< float >
+ : public OStringNumberBase<OStringNumber<float>, RTL_STR_MAX_VALUEOFFLOAT>
{
- OStringNumber( float f )
- : length( rtl_str_valueOfFloat( buf, f ))
- {}
- const char * getStr() const SAL_RETURNS_NONNULL { return buf; }
- char buf[RTL_STR_MAX_VALUEOFFLOAT];
- const sal_Int32 length;
+ OStringNumber(float f) { length = rtl_str_valueOfFloat(buf, f); }
};
template<>
struct OStringNumber< double >
+ : public OStringNumberBase<OStringNumber<double>, RTL_STR_MAX_VALUEOFDOUBLE>
{
- OStringNumber( double d )
- : length( rtl_str_valueOfDouble( buf, d ))
- {}
- const char * getStr() const SAL_RETURNS_NONNULL { return buf; }
- char buf[RTL_STR_MAX_VALUEOFDOUBLE];
- const sal_Int32 length;
+ OStringNumber(double d) { length = rtl_str_valueOfDouble(buf, d); }
};
template< typename T >
@@ -400,54 +393,52 @@ OUString::number() to OUString.
template< typename T >
struct OUStringNumber;
+template <class Derived, int nBufSize> struct OUStringNumberBase
+{
+ Derived&& toAsciiUpperCase()
+ {
+ rtl_ustr_toAsciiUpperCase_WithLength(buf, length);
+ return std::move(*static_cast<Derived*>(this));
+ }
+ sal_Unicode buf[nBufSize];
+ sal_Int32 length;
+};
+
template<>
struct OUStringNumber< int >
+ : public OUStringNumberBase<OUStringNumber<int>, RTL_USTR_MAX_VALUEOFINT32>
{
- OUStringNumber( int i, sal_Int16 radix )
- : length( rtl_ustr_valueOfInt32( buf, i, radix ))
- {}
- sal_Unicode buf[RTL_USTR_MAX_VALUEOFINT32];
- const sal_Int32 length;
+ OUStringNumber(int i, sal_Int16 radix) { length = rtl_ustr_valueOfInt32(buf, i, radix); }
};
template<>
struct OUStringNumber< long long >
+ : public OUStringNumberBase<OUStringNumber<long long>, RTL_USTR_MAX_VALUEOFINT64>
{
OUStringNumber( long long ll, sal_Int16 radix )
- : length( rtl_ustr_valueOfInt64( buf, ll, radix ))
- {}
- sal_Unicode buf[RTL_USTR_MAX_VALUEOFINT64];
- const sal_Int32 length;
+ { length = rtl_ustr_valueOfInt64(buf, ll, radix); }
};
template<>
struct OUStringNumber< unsigned long long >
+ : public OUStringNumberBase<OUStringNumber<unsigned long long>, RTL_USTR_MAX_VALUEOFUINT64>
{
OUStringNumber( unsigned long long ll, sal_Int16 radix )
- : length( rtl_ustr_valueOfUInt64( buf, ll, radix ))
- {}
- sal_Unicode buf[RTL_USTR_MAX_VALUEOFUINT64];
- const sal_Int32 length;
+ { length = rtl_ustr_valueOfUInt64(buf, ll, radix); }
};
template<>
struct OUStringNumber< float >
+ : public OUStringNumberBase<OUStringNumber<float>, RTL_USTR_MAX_VALUEOFFLOAT>
{
- OUStringNumber( float f )
- : length( rtl_ustr_valueOfFloat( buf, f ))
- {}
- sal_Unicode buf[RTL_USTR_MAX_VALUEOFFLOAT];
- const sal_Int32 length;
+ OUStringNumber(float f) { length = rtl_ustr_valueOfFloat(buf, f); }
};
template<>
struct OUStringNumber< double >
+ : public OUStringNumberBase<OUStringNumber<double>, RTL_USTR_MAX_VALUEOFDOUBLE>
{
- OUStringNumber( double d )
- : length( rtl_ustr_valueOfDouble( buf, d ))
- {}
- sal_Unicode buf[RTL_USTR_MAX_VALUEOFDOUBLE];
- const sal_Int32 length;
+ OUStringNumber(double d) { length = rtl_ustr_valueOfDouble(buf, d); }
};
template< typename T >
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 3b0072838a87..c282b0d9263f 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3137,7 +3137,7 @@ void writeLabelProperties( const FSHelperPtr& pFS, ChartExport* pChartExport,
{
pFS->startElement(FSNS(XML_a, XML_solidFill));
- OString aStr = OString(OString::number(nLabelBorderColor, 16)).toAsciiUpperCase();
+ OString aStr = OString::number(nLabelBorderColor, 16).toAsciiUpperCase();
pFS->singleElement(FSNS(XML_a, XML_srgbClr), XML_val, aStr);
pFS->endElement(FSNS(XML_a, XML_solidFill));
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 4e682b531df8..908c1d20aef2 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -437,7 +437,7 @@ void ScInterpreter::ScEncodeURL()
else
{
aUrlBuf.append( '%' );
- OString convertedChar = OString( OString::number( static_cast<unsigned char>( c ), 16 )).toAsciiUpperCase();
+ OString convertedChar = OString::number( static_cast<unsigned char>( c ), 16 ).toAsciiUpperCase();
// RFC 3986 indicates:
// "A percent-encoded octet is encoded as a character triplet,
// consisting of the percent character "%" followed by the two hexadecimal digits
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index ae83afd174fb..ae4b798effa8 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -709,7 +709,7 @@ OUString ConvertFromDec( double fNum, double fMin, double fMax, sal_uInt16 nBase
if( bNeg )
nNum = sal_Int64( pow( double( nBase ), double( nMaxPlaces ) ) ) + nNum;
- OUString aRet( OUString( OUString::number( nNum, nBase )).toAsciiUpperCase() );
+ OUString aRet(OUString::number(nNum, nBase).toAsciiUpperCase());
if( bUsePlaces )
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index c8ef9c49cb5c..e33e4d114944 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1584,7 +1584,7 @@ IMPL_LINK_NOARG(SmSymDefineDialog, CharHighlightHdl, SvxShowCharSet*, void)
UpdateButtons();
// display Unicode position as symbol name while iterating over characters
- const OUString aHex(OUString(OUString::number(cChar, 16 )).toAsciiUpperCase());
+ const OUString aHex(OUString::number(cChar, 16).toAsciiUpperCase());
const OUString aPattern( (aHex.getLength() > 4) ? OUString("Ux000000") : OUString("Ux0000") );
OUString aUnicodePos( aPattern.copy( 0, aPattern.getLength() - aHex.getLength() ) );
aUnicodePos += aHex;
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 04fcc99a9772..053e195cd82a 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -4210,7 +4210,7 @@ OUString NfCurrencyEntry::BuildSymbolString(bool bBank,
if ( !bWithoutExtension && eLanguage != LANGUAGE_DONTKNOW && eLanguage != LANGUAGE_SYSTEM )
{
sal_Int32 nLang = static_cast<sal_uInt16>(eLanguage);
- aBuf.append('-').append( OUString( OUString::number(nLang, 16)).toAsciiUpperCase());
+ aBuf.append('-').append(OUString::number(nLang, 16).toAsciiUpperCase());
}
}
aBuf.append(']');
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 64505adab290..092d6b2b5908 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1165,7 +1165,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
((eLanguage = MsLangId::getRealLanguage( eLan)) == LANGUAGE_THAI) &&
NumFor[nIndex].GetNatNum().GetLang() == LANGUAGE_DONTKNOW)
{
- sStr = "[$-" + OUString(OUString::number( sal_uInt16(eLanguage), 16 )).toAsciiUpperCase() + "]" + sStr;
+ sStr = "[$-" + OUString::number( sal_uInt16(eLanguage), 16 ).toAsciiUpperCase() + "]" + sStr;
NumFor[nIndex].SetNatNumLang( eLanguage);
}
sBuff.remove(nPosOld, nPos - nPosOld);
@@ -5085,7 +5085,7 @@ static void lcl_insertLCID( OUStringBuffer& rFormatStr, sal_uInt32 nLCID, sal_In
// No format code, no locale.
return;
- OUStringBuffer aLCIDString = OUString(OUString::number( nLCID , 16 )).toAsciiUpperCase();
+ OUStringBuffer aLCIDString = OUString::number( nLCID , 16 ).toAsciiUpperCase();
// Search for only last DBNum which is the last element before insertion position
if ( bDBNumInserted && nPosInsertLCID >= 8
&& aLCIDString.getLength() > 4
diff --git a/unoidl/source/sourceprovider-scanner.l b/unoidl/source/sourceprovider-scanner.l
index d0dd5a0dc155..1700259e5878 100644
--- a/unoidl/source/sourceprovider-scanner.l
+++ b/unoidl/source/sourceprovider-scanner.l
@@ -244,8 +244,7 @@ ALNUM {DIGIT}|{ALPHA}
unsigned char c = yytext[0];
yyextra->errorMessage = c >= ' ' && c <= '~'
? OUString("invalid character \"" + OUStringLiteral1(c) + "\"")
- : OUString(
- "invalid byte x" + OUString(OUString::number(c, 16)).toAsciiUpperCase());
+ : OUString("invalid byte x" + OUString::number(c, 16).toAsciiUpperCase());
return TOK_ERROR;
}
diff --git a/winaccessibility/source/UAccCOM/AccTextBase.cxx b/winaccessibility/source/UAccCOM/AccTextBase.cxx
index 9e5c63605df0..efe10612d0b3 100644
--- a/winaccessibility/source/UAccCOM/AccTextBase.cxx
+++ b/winaccessibility/source/UAccCOM/AccTextBase.cxx
@@ -170,7 +170,7 @@ STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long
unsigned long nColor;
pValue.Value >>= nColor;
strAttrs.append('#');
- auto const hex = OUString(OUString::number(nColor, 16)).toAsciiUpperCase();
+ OUString const hex = OUString::number(nColor, 16).toAsciiUpperCase();
for (sal_Int32 j = hex.getLength(); j < 8; ++j) {
strAttrs.append('0');
}
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 133e2a4eace0..8974909a4e3f 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -1474,7 +1474,7 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport,
{
aFormatCode.append( "][$-" );
// language code in upper hex:
- aFormatCode.append(OUString(OUString::number(static_cast<sal_uInt16>(eLang), 16)).toAsciiUpperCase());
+ aFormatCode.append(OUString::number(static_cast<sal_uInt16>(eLang), 16).toAsciiUpperCase());
}
aFormatCode.append( ']' );
}