[Libreoffice-commits] core.git: include/rtl lotuswordpro/source sdext/source svx/source sw/source vcl/source
Stephan Bergmann
sbergman at redhat.com
Fri Jun 19 04:30:04 PDT 2015
include/rtl/ustring.hxx | 11 +++++++++++
lotuswordpro/source/filter/lwpfribmark.cxx | 18 +++++++++---------
sdext/source/pdfimport/tree/drawtreevisiting.cxx | 6 +++---
svx/source/tbxctrls/layctrl.cxx | 2 +-
sw/source/core/text/EnhancedPDFExportHelper.cxx | 2 +-
sw/source/ui/misc/srtdlg.cxx | 2 +-
sw/source/uibase/dbui/mmconfigitem.cxx | 2 +-
vcl/source/app/IconThemeInfo.cxx | 2 +-
8 files changed, 28 insertions(+), 17 deletions(-)
New commits:
commit cbe944e323edb20f958bb46ea644de659b75382e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 19 11:33:24 2015 +0200
Catch inadvertent uses of OUString(sal_Unicode) ctor
...with numeric values that are not meant to be characters. Inspired by
<https://gerrit.libreoffice.org/#/c/16339/> "OUString: add constructor from
single Unicode code point" and ecaf1cb3861c1b519a1495487fc796884cf37b92 "seems
to be what was meant." Found e46e8d19458fd64ff20b1013e5eeabd07e62379c "Shall
this produce a string representation of a number?" and
f2a0e4032734d6be635f14ade3dea499c29ec6c2 "Don't truncate a UTF-32 code point to
a UTF-16 code unit."
(LIBO_INTERNAL_ONLY mostly because it uses a C++11 delegating ctor for
simplicity, but also because it requires mild modifications to client code, see
additional changes in this commit and some other recent commits.)
Change-Id: I8a156f01d1b772c6052d7afaa088ae13ed234e2b
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 80d67e8..2c56443 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -172,6 +172,17 @@ public:
rtl_uString_newFromStr_WithLength( &pData, &value, 1 );
}
+#if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST_CONCAT
+ /// @cond INTERNAL
+ // Catch inadvertent conversions to the above ctor (but still allow
+ // construction from char literals):
+ OUString(int) = delete;
+ explicit OUString(char c):
+ OUString(sal_Unicode(static_cast<unsigned char>(c)))
+ {}
+ /// @endcond
+#endif
+
/**
New string from a Unicode character buffer array.
diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx
index 143a00f..fa17d01 100644
--- a/lotuswordpro/source/filter/lwpfribmark.cxx
+++ b/lotuswordpro/source/filter/lwpfribmark.cxx
@@ -666,13 +666,13 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula)
pDateStyle = new XFDateStyle;
OUString sText;
pDateStyle->AddYear();
- sText = OUString(0x5e74);
+ sText = OUString(sal_Unicode(0x5e74));
pDateStyle->AddText(sText);
pDateStyle->AddMonth(false);
- sText = OUString(0x6708);
+ sText = OUString(sal_Unicode(0x6708));
pDateStyle->AddText(sText);
pDateStyle->AddMonthDay(false);
- sText = OUString(0x65e5);
+ sText = OUString(sal_Unicode(0x65e5));
pDateStyle->AddText(sText);
}
else if (sFormula == "%FLoa" || sFormula == "%FLooaa" || sFormula == "%FLOA" )
@@ -680,10 +680,10 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula)
pDateStyle = new XFDateStyle;
OUString sText;
pDateStyle->AddMonth(false);
- sText = OUString(0x6708);
+ sText = OUString(sal_Unicode(0x6708));
pDateStyle->AddText(sText);
pDateStyle->AddMonthDay(false);
- sText = OUString(0x65e5);
+ sText = OUString(sal_Unicode(0x65e5));
pDateStyle->AddText(sText);
}
else if (sFormula == "%FLYYYY/M/D" || sFormula == "%FLGGGG/od/ad")
@@ -973,10 +973,10 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula)
pTimeStyle = new XFTimeStyle;
pTimeStyle->AddHour(false);
OUString sText;
- sText = OUString(0x70b9);
+ sText = OUString(sal_Unicode(0x70b9));
pTimeStyle->AddText(sText);
pTimeStyle->AddMinute(false);
- sText = OUString(0x5206);
+ sText = OUString(sal_Unicode(0x5206));
pTimeStyle->AddText(sText);
}
else if (sFormula == "%FLjjjF" || sFormula == "%FLJJJFF" )
@@ -985,10 +985,10 @@ void LwpFribField::RegisterDateTimeStyle(const OUString& sFormula)
pTimeStyle->SetAmPm(true);
pTimeStyle->AddHour(false);
OUString sText;
- sText = OUString(0x70b9);
+ sText = OUString(sal_Unicode(0x70b9));
pTimeStyle->AddText(sText);
pTimeStyle->AddMinute(false);
- sText = OUString(0x5206);
+ sText = OUString(sal_Unicode(0x5206));
pTimeStyle->AddText(sText);
}
//chinese version end
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 6c7235d..4d262ca 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -95,9 +95,9 @@ void DrawXmlEmitter::visit( TextElement& elem, const std::list< Element* >::cons
if( elem.Text.isEmpty() )
return;
- OUString strSpace(32);
- OUString strNbSpace(160);
- OUString tabSpace(0x09);
+ OUString strSpace(sal_Unicode(32));
+ OUString strNbSpace(sal_Unicode(160));
+ OUString tabSpace(sal_Unicode(0x09));
PropertyMap aProps;
if( elem.StyleId != -1 )
{
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index 40e1951..504bc2f 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -336,7 +336,7 @@ void TableWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
// #i95350# force RTL output
if (IsRTLEnabled())
- aText = OUString(0x202D) + aText;
+ aText = OUString(sal_Unicode(0x202D)) + aText;
rRenderContext.DrawText(Point(nTextX, nTextY), aText);
}
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index e8b787b..2a679f4 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -763,7 +763,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType )
{
OUString aActualText;
if (pPor->GetWhichPor() == POR_SOFTHYPH || pPor->GetWhichPor() == POR_HYPH)
- aActualText = OUString(0xad); // soft hyphen
+ aActualText = OUString(sal_Unicode(0xad)); // soft hyphen
else
aActualText = rInf.GetText().copy(rInf.GetIdx(), pPor->GetLen());
mpPDFExtOutDevData->SetActualText( aActualText );
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index 7692e92..3603b39 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -406,7 +406,7 @@ IMPL_LINK_NOARG(SwSortDlg, DelimCharHdl)
{
SFX_ITEMSET_ARG( pMap->GetOutputItemSet(), pItem, SfxInt32Item, SID_ATTR_CHAR, false );
if ( pItem )
- m_pDelimEdt->SetText( OUString(pItem->GetValue()) );
+ m_pDelimEdt->SetText( OUString(sal_Unicode(pItem->GetValue())) );
}
}
return 0;
diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx
index 468a54c..c5bc58e 100644
--- a/sw/source/uibase/dbui/mmconfigitem.cxx
+++ b/sw/source/uibase/dbui/mmconfigitem.cxx
@@ -392,7 +392,7 @@ static void lcl_ConvertToNumbers(OUString& rBlock, const ResStringArray& rHeader
for(sal_uInt32 i = 0; i < rHeaders.Count(); ++i)
{
OUString sHeader = "<" + rHeaders.GetString( i ) + ">";
- OUString sReplace = "<" + OUString('0' + i) + ">";
+ OUString sReplace = "<" + OUString(sal_Unicode('0' + i)) + ">";
sBlock = sBlock.replaceAll(sHeader, sReplace);
}
rBlock = sBlock;
diff --git a/vcl/source/app/IconThemeInfo.cxx b/vcl/source/app/IconThemeInfo.cxx
index da07e2c..95b47fb 100644
--- a/vcl/source/app/IconThemeInfo.cxx
+++ b/vcl/source/app/IconThemeInfo.cxx
@@ -132,7 +132,7 @@ IconThemeInfo::ThemeIdToDisplayName(const OUString& themeId)
OUString r;
sal_Unicode firstLetter = themeId[0];
if (rtl::isAsciiLowerCase(firstLetter)) {
- r = OUString(rtl::toAsciiUpperCase(firstLetter));
+ r = OUString(sal_Unicode(rtl::toAsciiUpperCase(firstLetter)));
r += themeId.copy(1);
}
else {
More information about the Libreoffice-commits
mailing list