sc/source/filter/html/htmlexp.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
New commits: commit 4dad0c5b1ee1a243fbccd45ef2fc97b78aaa30a2 Author: Muhammet Kara <[email protected]> Date: Tue Dec 27 17:29:44 2016 +0300 Refactor lcl_makeHTMLColorTriplet - Reduce the unnecessarily large buf size - Replace multiple occurences of sprinf with only one snprintf - Avoid some unnecessary variable creations Change-Id: I14f36bea8eed10a62fbf977f10b148c8c52ad2ca Reviewed-on: https://gerrit.libreoffice.org/32451 Tested-by: Jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 4177226..f3fa0cb 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -183,16 +183,12 @@ static void lcl_AddStamp( OUString& rStr, const OUString& rName, static OString lcl_makeHTMLColorTriplet(const Color& rColor) { - OStringBuffer aStr( "\"#" ); + sal_Char buf[24]; + // <font COLOR="#00FF40">hello</font> - sal_Char buf[64]; - sal_Char* p = buf; - p += sprintf( p, "%02X", rColor.GetRed() ); - p += sprintf( p, "%02X", rColor.GetGreen() ); - sprintf( p, "%02X", rColor.GetBlue() ); - aStr.append(buf); - aStr.append('\"'); - return aStr.makeStringAndClear(); + snprintf( buf, 24, "\"#%02X%02X%02X\"", rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue() ); + + return OString(buf); } ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocument* pDocP, _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
