connectivity/source/drivers/postgresql/pq_statement.cxx | 4 cppuhelper/source/typemanager.cxx | 37 ++-- extensions/source/logging/loggerconfig.cxx | 41 +---- l10ntools/source/localize.cxx | 68 +++------ sal/rtl/math.cxx | 10 - sd/source/core/stlsheet.cxx | 55 +++---- svtools/source/config/colorcfg.cxx | 120 +++++++--------- 7 files changed, 145 insertions(+), 190 deletions(-)
New commits: commit 1ba76fa81eb64c56c31379f678345a6667c47aa5 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Feb 8 07:57:36 2017 +0100 Use OUStringLiteral Change-Id: I76b83140222cfd7e313736936b2803997c43836d diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 7e98f64..55e3c5f 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -54,6 +54,7 @@ #include "ViewShellBase.hxx" #include <editeng/boxitem.hxx> +#include <cstddef> #include <memory> using ::osl::MutexGuard; @@ -624,44 +625,40 @@ void SdStyleSheet::SetHelpId( const OUString& r, sal_uLong nId ) { static struct ApiNameMap { - const sal_Char* mpApiName; - sal_uInt32 mnApiNameLength; + OUStringLiteral mpApiName; sal_uInt32 mnHelpId; } - pApiNameMap[] = + const pApiNameMap[] = { - { RTL_CONSTASCII_STRINGPARAM( "title" ), HID_PSEUDOSHEET_TITLE }, - { RTL_CONSTASCII_STRINGPARAM( "subtitle" ), HID_PSEUDOSHEET_SUBTITLE }, - { RTL_CONSTASCII_STRINGPARAM( "background" ), HID_PSEUDOSHEET_BACKGROUND }, - { RTL_CONSTASCII_STRINGPARAM( "backgroundobjects" ),HID_PSEUDOSHEET_BACKGROUNDOBJECTS }, - { RTL_CONSTASCII_STRINGPARAM( "notes" ), HID_PSEUDOSHEET_NOTES }, - { RTL_CONSTASCII_STRINGPARAM( "standard" ), HID_STANDARD_STYLESHEET_NAME }, - { RTL_CONSTASCII_STRINGPARAM( "objectwitharrow" ), HID_POOLSHEET_OBJWITHARROW }, - { RTL_CONSTASCII_STRINGPARAM( "objectwithshadow" ), HID_POOLSHEET_OBJWITHSHADOW }, - { RTL_CONSTASCII_STRINGPARAM( "objectwithoutfill" ),HID_POOLSHEET_OBJWITHOUTFILL }, - { RTL_CONSTASCII_STRINGPARAM( "text" ), HID_POOLSHEET_TEXT }, - { RTL_CONSTASCII_STRINGPARAM( "textbody" ), HID_POOLSHEET_TEXTBODY }, - { RTL_CONSTASCII_STRINGPARAM( "textbodyjustfied" ), HID_POOLSHEET_TEXTBODY_JUSTIFY }, - { RTL_CONSTASCII_STRINGPARAM( "textbodyindent" ), HID_POOLSHEET_TEXTBODY_INDENT }, - { RTL_CONSTASCII_STRINGPARAM( "title" ), HID_POOLSHEET_TITLE }, - { RTL_CONSTASCII_STRINGPARAM( "title1" ), HID_POOLSHEET_TITLE1 }, - { RTL_CONSTASCII_STRINGPARAM( "title2" ), HID_POOLSHEET_TITLE2 }, - { RTL_CONSTASCII_STRINGPARAM( "headline" ), HID_POOLSHEET_HEADLINE }, - { RTL_CONSTASCII_STRINGPARAM( "headline1" ), HID_POOLSHEET_HEADLINE1 }, - { RTL_CONSTASCII_STRINGPARAM( "headline2" ), HID_POOLSHEET_HEADLINE2 }, - { RTL_CONSTASCII_STRINGPARAM( "measure" ), HID_POOLSHEET_MEASURE }, - { nullptr, 0, 0 } + { "title", HID_PSEUDOSHEET_TITLE }, + { "subtitle", HID_PSEUDOSHEET_SUBTITLE }, + { "background", HID_PSEUDOSHEET_BACKGROUND }, + { "backgroundobjects",HID_PSEUDOSHEET_BACKGROUNDOBJECTS }, + { "notes", HID_PSEUDOSHEET_NOTES }, + { "standard", HID_STANDARD_STYLESHEET_NAME }, + { "objectwitharrow", HID_POOLSHEET_OBJWITHARROW }, + { "objectwithshadow", HID_POOLSHEET_OBJWITHSHADOW }, + { "objectwithoutfill",HID_POOLSHEET_OBJWITHOUTFILL }, + { "text", HID_POOLSHEET_TEXT }, + { "textbody", HID_POOLSHEET_TEXTBODY }, + { "textbodyjustfied", HID_POOLSHEET_TEXTBODY_JUSTIFY }, + { "textbodyindent", HID_POOLSHEET_TEXTBODY_INDENT }, + { "title", HID_POOLSHEET_TITLE }, + { "title1", HID_POOLSHEET_TITLE1 }, + { "title2", HID_POOLSHEET_TITLE2 }, + { "headline", HID_POOLSHEET_HEADLINE }, + { "headline1", HID_POOLSHEET_HEADLINE1 }, + { "headline2", HID_POOLSHEET_HEADLINE2 }, + { "measure", HID_POOLSHEET_MEASURE } }; - ApiNameMap* p = pApiNameMap; - while( p->mpApiName ) + for (std::size_t i = 0; i != SAL_N_ELEMENTS(pApiNameMap); ++i) { - if( nId == p->mnHelpId ) + if( nId == pApiNameMap[i].mnHelpId ) { - msApiName = OUString( p->mpApiName, p->mnApiNameLength, RTL_TEXTENCODING_ASCII_US ); + msApiName = pApiNameMap[i].mpApiName; break; } - p++; } } } commit fc51789ad0eafc41460e67773d11609d366fc4b7 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Feb 7 23:06:45 2017 +0100 Solaris C++ 5.2 compiler is no longer relevant Change-Id: I520a58438e156661d3e01a899e97ee33d9f19102 diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx index 95df820..4d0ecb1 100644 --- a/sal/rtl/math.cxx +++ b/sal/rtl/math.cxx @@ -171,10 +171,8 @@ bool isRepresentableInteger(double fAbsValue) return false; } -// Solaris C++ 5.2 compiler has problems when "StringT ** pResult" is -// "typename T::String ** pResult" instead: -template< typename T, typename StringT > -inline void doubleToString(StringT ** pResult, +template< typename T > +inline void doubleToString(typename T::String ** pResult, sal_Int32 * pResultCapacity, sal_Int32 nResultOffset, double fValue, rtl_math_StringFormat eFormat, sal_Int32 nDecPlaces, typename T::Char cDecSeparator, @@ -628,7 +626,7 @@ void SAL_CALL rtl_math_doubleToString(rtl_String ** pResult, sal_Bool bEraseTrailingDecZeros) SAL_THROW_EXTERN_C() { - doubleToString< StringTraits, StringTraits::String >( + doubleToString< StringTraits >( pResult, pResultCapacity, nResultOffset, fValue, eFormat, nDecPlaces, cDecSeparator, pGroups, cGroupSeparator, bEraseTrailingDecZeros); } @@ -644,7 +642,7 @@ void SAL_CALL rtl_math_doubleToUString(rtl_uString ** pResult, sal_Bool bEraseTrailingDecZeros) SAL_THROW_EXTERN_C() { - doubleToString< UStringTraits, UStringTraits::String >( + doubleToString< UStringTraits >( pResult, pResultCapacity, nResultOffset, fValue, eFormat, nDecPlaces, cDecSeparator, pGroups, cGroupSeparator, bEraseTrailingDecZeros); } commit 07b51bc2830e6035c29894e30006b61489c6fa4f Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Feb 7 22:59:33 2017 +0100 Use OUStringLiteral Change-Id: I6fd5f86288b303c8e3ce1cd072368df578e5e6a9 diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 1edf0a0..4a52300 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -148,26 +148,24 @@ bool handleFile( const OString& rPotDir, bool bInitPoFile ) { struct Command { - char const * extension; - sal_Int32 extensionLength; + OUString extension; OString executable; bool positive; }; static Command const commands[] = { - { RTL_CONSTASCII_STRINGPARAM(".src"), "transex3", false }, - { RTL_CONSTASCII_STRINGPARAM(".hrc"), "transex3", true }, - { RTL_CONSTASCII_STRINGPARAM(".ulf"), "ulfex", false }, - { RTL_CONSTASCII_STRINGPARAM(".xcu"), "cfgex", false }, - { RTL_CONSTASCII_STRINGPARAM(".xrm"), "xrmex", false }, - { RTL_CONSTASCII_STRINGPARAM("description.xml"), "xrmex", true }, - { RTL_CONSTASCII_STRINGPARAM(".xhp"), "helpex", false }, - { RTL_CONSTASCII_STRINGPARAM(".properties"), "propex", false }, - { RTL_CONSTASCII_STRINGPARAM(".ui"), "uiex", false }, - { RTL_CONSTASCII_STRINGPARAM(".tree"), "treex", false } }; + { ".src", "transex3", false }, + { ".hrc", "transex3", true }, + { ".ulf", "ulfex", false }, + { ".xcu", "cfgex", false }, + { ".xrm", "xrmex", false }, + { "description.xml", "xrmex", true }, + { ".xhp", "helpex", false }, + { ".properties", "propex", false }, + { ".ui", "uiex", false }, + { ".tree", "treex", false } }; for (size_t i = 0; i != SAL_N_ELEMENTS(commands); ++i) { - if (rUrl.endsWithAsciiL( - commands[i].extension, commands[i].extensionLength) && + if (rUrl.endsWith(commands[i].extension) && (commands[i].executable != "propex" || rUrl.indexOf("en_US") != -1)) { if (commands[i].positive ? passesPositiveList(rUrl) : passesNegativeList(rUrl)) commit d7a2e94e653f1b164eeeffd32f328b7eb69a0c77 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Feb 7 22:57:39 2017 +0100 Use OUStringLiteral Change-Id: I720f70f81db92d75cdd83aa20a1cbf5a311b092b diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index e9130af..1edf0a0 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -45,16 +45,11 @@ using namespace std; namespace { -struct AsciiString { - char const * string; - sal_Int32 length; -}; - bool matchList( - const OUString& rUrl, const AsciiString* pList, size_t nLength) + const OUString& rUrl, const OUStringLiteral* pList, size_t nLength) { for (size_t i = 0; i != nLength; ++i) { - if (rUrl.endsWithAsciiL(pList[i].string, pList[i].length)) { + if (rUrl.endsWith(pList[i])) { return true; } } @@ -62,31 +57,24 @@ bool matchList( } bool passesNegativeList(const OUString& rUrl) { - static const AsciiString list[] = { - { RTL_CONSTASCII_STRINGPARAM("/dictionaries.xcu") }, - { RTL_CONSTASCII_STRINGPARAM( - "/dictionaries/da_DK/help/da/help.tree") }, - { RTL_CONSTASCII_STRINGPARAM( - "/dictionaries/da_DK/help/da/" - "org.openoffice.da.hunspell.dictionaries/page1.xhp") }, - { RTL_CONSTASCII_STRINGPARAM( - "/dictionaries/da_DK/help/da/" - "org.openoffice.da.hunspell.dictionaries/page2.xhp") }, - { RTL_CONSTASCII_STRINGPARAM( - "/dictionaries/hu_HU/help/hu/help.tree") }, - { RTL_CONSTASCII_STRINGPARAM( - "/dictionaries/hu_HU/help/hu/" - "org.openoffice.hu.hunspell.dictionaries/page1.xhp") }, - { RTL_CONSTASCII_STRINGPARAM( - "/officecfg/registry/data/org/openoffice/Office/" - "Accelerators.xcu") } + static const OUStringLiteral list[] = { + "/dictionaries.xcu", + "/dictionaries/da_DK/help/da/help.tree", + ("/dictionaries/da_DK/help/da/" + "org.openoffice.da.hunspell.dictionaries/page1.xhp"), + ("/dictionaries/da_DK/help/da/" + "org.openoffice.da.hunspell.dictionaries/page2.xhp"), + "/dictionaries/hu_HU/help/hu/help.tree", + ("/dictionaries/hu_HU/help/hu/" + "org.openoffice.hu.hunspell.dictionaries/page1.xhp"), + "/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu" }; return !matchList(rUrl, list, SAL_N_ELEMENTS(list)); } bool passesPositiveList(const OUString& rUrl) { - static const AsciiString list[] = { - { RTL_CONSTASCII_STRINGPARAM("/description.xml") } + static const OUStringLiteral list[] = { + "/description.xml" }; return matchList(rUrl, list, SAL_N_ELEMENTS(list)); } commit 3c5c11bf631b92ebe46b4f061e8673d8de98e40a Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Feb 7 22:48:00 2017 +0100 Use OUStringLiteral Change-Id: I20685c733b12ef2a7efc894091a6e40d1347ac84 diff --git a/cppuhelper/source/typemanager.cxx b/cppuhelper/source/typemanager.cxx index 54e5cd9..123a4fa 100644 --- a/cppuhelper/source/typemanager.cxx +++ b/cppuhelper/source/typemanager.cxx @@ -1811,30 +1811,27 @@ cppuhelper::TypeManager::TypeManager(): css::uno::Any cppuhelper::TypeManager::find(rtl::OUString const & name) { //TODO: caching? (here or in unoidl::Manager?) struct Simple { - char const * name; sal_Int32 length; + OUStringLiteral name; css::uno::TypeClass typeClass; }; static Simple const simple[] = { - { RTL_CONSTASCII_STRINGPARAM("void"), css::uno::TypeClass_VOID }, - { RTL_CONSTASCII_STRINGPARAM("boolean"), css::uno::TypeClass_BOOLEAN }, - { RTL_CONSTASCII_STRINGPARAM("byte"), css::uno::TypeClass_BYTE }, - { RTL_CONSTASCII_STRINGPARAM("short"), css::uno::TypeClass_SHORT }, - { RTL_CONSTASCII_STRINGPARAM("unsigned short"), - css::uno::TypeClass_UNSIGNED_SHORT }, - { RTL_CONSTASCII_STRINGPARAM("long"), css::uno::TypeClass_LONG }, - { RTL_CONSTASCII_STRINGPARAM("unsigned long"), - css::uno::TypeClass_UNSIGNED_LONG }, - { RTL_CONSTASCII_STRINGPARAM("hyper"), css::uno::TypeClass_HYPER }, - { RTL_CONSTASCII_STRINGPARAM("unsigned hyper"), - css::uno::TypeClass_UNSIGNED_HYPER }, - { RTL_CONSTASCII_STRINGPARAM("float"), css::uno::TypeClass_FLOAT }, - { RTL_CONSTASCII_STRINGPARAM("double"), css::uno::TypeClass_DOUBLE }, - { RTL_CONSTASCII_STRINGPARAM("char"), css::uno::TypeClass_CHAR }, - { RTL_CONSTASCII_STRINGPARAM("string"), css::uno::TypeClass_STRING }, - { RTL_CONSTASCII_STRINGPARAM("type"), css::uno::TypeClass_TYPE }, - { RTL_CONSTASCII_STRINGPARAM("any"), css::uno::TypeClass_ANY } }; + { "void", css::uno::TypeClass_VOID }, + { "boolean", css::uno::TypeClass_BOOLEAN }, + { "byte", css::uno::TypeClass_BYTE }, + { "short", css::uno::TypeClass_SHORT }, + { "unsigned short", css::uno::TypeClass_UNSIGNED_SHORT }, + { "long", css::uno::TypeClass_LONG }, + { "unsigned long", css::uno::TypeClass_UNSIGNED_LONG }, + { "hyper", css::uno::TypeClass_HYPER }, + { "unsigned hyper", css::uno::TypeClass_UNSIGNED_HYPER }, + { "float", css::uno::TypeClass_FLOAT }, + { "double", css::uno::TypeClass_DOUBLE }, + { "char", css::uno::TypeClass_CHAR }, + { "string", css::uno::TypeClass_STRING }, + { "type", css::uno::TypeClass_TYPE }, + { "any", css::uno::TypeClass_ANY } }; for (std::size_t i = 0; i != SAL_N_ELEMENTS(simple); ++i) { - if (name.equalsAsciiL(simple[i].name, simple[i].length)) { + if (name == simple[i].name) { return css::uno::makeAny< css::uno::Reference< css::reflection::XTypeDescription > >( new SimpleTypeDescription(simple[i].typeClass, name)); commit 3783df202783bd0a3ac5bb1a53b1ee58806bd7d6 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Feb 7 22:43:10 2017 +0100 rtl_str_shortenedCompare_WithLength -> OString::startsWith Change-Id: I3eabdeba10d8d1064f00b817b04f03aad8a6b352 diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx index 9d8b623..4dc51f9 100644 --- a/connectivity/source/drivers/postgresql/pq_statement.cxx +++ b/connectivity/source/drivers/postgresql/pq_statement.cxx @@ -777,9 +777,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert( value = OStringToOUString(j->second, RTL_TEXTENCODING_ASCII_US ); // check, whether it is a sequence - if( rtl_str_shortenedCompare_WithLength( - j->second.getStr(), j->second.getLength(), - RTL_CONSTASCII_STRINGPARAM( "nextval(" ), 8 ) == 0 ) + if( j->second.startsWith("nextval(") ) { // retrieve current sequence value: OUStringBuffer myBuf(128 ); commit dd1cdac272f98b0bacb5bb9ee6cb89852a50d31f Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Feb 7 22:34:55 2017 +0100 Clean up curious by-4/by-2 loop indices ...that had been like that ever since ff09f8d6ef2c613037f039dbcafcad6b76243a48, "MWS_SRX644: migrate branch mws_srx644 -> HEAD" at least, for no apparent reason. Change-Id: I6f8bd44179b232b7b39e493d443a443a60522a5c diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index d09962e..86ff2ce 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -164,13 +164,12 @@ uno::Sequence< OUString> GetPropertyNames(const OUString& rScheme) OUString sBase = "ColorSchemes/" + utl::wrapConfigurationElementName(rScheme); const int nCount = ColorConfigEntryCount; - for(sal_Int32 i = 0; i < 4 * nCount; i+= 4) + for(sal_Int32 i = 0; i < nCount; ++i) { - sal_Int32 nPos = i / 4; - OUString sBaseName = sBase + cNames[nPos].cName; + OUString sBaseName = sBase + cNames[i].cName; pNames[nIndex] += sBaseName; pNames[nIndex++] += "/Color"; - if(cNames[nPos].bCanBeVisible) + if(cNames[i].bCanBeVisible) { pNames[nIndex] += sBaseName; pNames[nIndex++] += g_sIsVisible; @@ -221,18 +220,18 @@ void ColorConfig_Impl::Load(const OUString& rScheme) const uno::Any* pColors = aColors.getConstArray(); const OUString* pColorNames = aColorNames.getConstArray(); sal_Int32 nIndex = 0; - for(int i = 0; i < 2 * ColorConfigEntryCount && aColors.getLength() > nIndex; i+= 2) + for(int i = 0; i < ColorConfigEntryCount && aColors.getLength() > nIndex; ++i) { if(pColors[nIndex].hasValue()) - pColors[nIndex] >>= m_aConfigValues[i / 2].nColor; + pColors[nIndex] >>= m_aConfigValues[i].nColor; else - m_aConfigValues[i/2].nColor = COL_AUTO; + m_aConfigValues[i].nColor = COL_AUTO; nIndex++; if(nIndex >= aColors.getLength()) break; //test for visibility property if(pColorNames[nIndex].endsWith(g_sIsVisible)) - m_aConfigValues[i / 2].bIsVisible = Any2Bool(pColors[nIndex++]); + m_aConfigValues[i].bIsVisible = Any2Bool(pColors[nIndex++]); } // fdo#71511: check if we are running in a11y autodetect { @@ -259,12 +258,12 @@ void ColorConfig_Impl::ImplCommit() beans::PropertyValue* pPropValues = aPropValues.getArray(); const OUString* pColorNames = aColorNames.getConstArray(); sal_Int32 nIndex = 0; - for(int i = 0; i < 2 * ColorConfigEntryCount && aColorNames.getLength() > nIndex; i+= 2) + for(int i = 0; i < ColorConfigEntryCount && aColorNames.getLength() > nIndex; ++i) { pPropValues[nIndex].Name = pColorNames[nIndex]; //save automatic colors as void value - if(COL_AUTO != sal::static_int_cast<ColorData>(m_aConfigValues[i/2].nColor)) - pPropValues[nIndex].Value <<= m_aConfigValues[i/2].nColor; + if(COL_AUTO != sal::static_int_cast<ColorData>(m_aConfigValues[i].nColor)) + pPropValues[nIndex].Value <<= m_aConfigValues[i].nColor; nIndex++; if(nIndex >= aColorNames.getLength()) @@ -273,7 +272,7 @@ void ColorConfig_Impl::ImplCommit() if(pColorNames[nIndex].endsWith(g_sIsVisible)) { pPropValues[nIndex].Name = pColorNames[nIndex]; - pPropValues[nIndex].Value <<= m_aConfigValues[i/2].bIsVisible; + pPropValues[nIndex].Value <<= m_aConfigValues[i].bIsVisible; nIndex++; } } commit 9123dda5c4d27268fa4f2dcb5a02cd3870965195 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Feb 7 22:23:07 2017 +0100 Use OUStringLiteral Change-Id: I905fe6553f0ad7f0d2dd1ac1bc771b2d42f35fe2 diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index ca7c3fc..d09962e 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -108,59 +108,57 @@ uno::Sequence< OUString> GetPropertyNames(const OUString& rScheme) OUString* pNames = aNames.getArray(); struct ColorConfigEntryData_Impl { - const sal_Char* cName; - sal_Int32 nLength; - rtl_TextEncoding eEncoding; + OUStringLiteral cName; bool bCanBeVisible; }; static const ColorConfigEntryData_Impl cNames[] = { - { RTL_CONSTASCII_USTRINGPARAM("/DocColor") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/DocBoundaries") ,true }, - { RTL_CONSTASCII_USTRINGPARAM("/AppBackground") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/ObjectBoundaries"),true }, - { RTL_CONSTASCII_USTRINGPARAM("/TableBoundaries") ,true }, - { RTL_CONSTASCII_USTRINGPARAM("/FontColor") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/Links") ,true }, - { RTL_CONSTASCII_USTRINGPARAM("/LinksVisited") ,true }, - { RTL_CONSTASCII_USTRINGPARAM("/Spell") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/SmartTags") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/Shadow") , true }, - { RTL_CONSTASCII_USTRINGPARAM("/WriterTextGrid") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/WriterFieldShadings"),true }, - { RTL_CONSTASCII_USTRINGPARAM("/WriterIdxShadings") ,true }, - { RTL_CONSTASCII_USTRINGPARAM("/WriterDirectCursor") ,true }, - { RTL_CONSTASCII_USTRINGPARAM("/WriterScriptIndicator") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/WriterSectionBoundaries") ,true }, - { RTL_CONSTASCII_USTRINGPARAM("/WriterHeaderFooterMark") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/WriterPageBreaks") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/HTMLSGML") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/HTMLComment") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/HTMLKeyword") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/HTMLUnknown") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/CalcGrid") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/CalcPageBreak"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/CalcPageBreakManual"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/CalcPageBreakAutomatic"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/CalcDetective") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/CalcDetectiveError") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/CalcReference") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/CalcNotesBackground") ,false }, - { RTL_CONSTASCII_USTRINGPARAM("/DrawGrid") ,true }, - { RTL_CONSTASCII_USTRINGPARAM("/BASICIdentifier"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/BASICComment") , false }, - { RTL_CONSTASCII_USTRINGPARAM("/BASICNumber") , false }, - { RTL_CONSTASCII_USTRINGPARAM("/BASICString") , false }, - { RTL_CONSTASCII_USTRINGPARAM("/BASICOperator") , false }, - { RTL_CONSTASCII_USTRINGPARAM("/BASICKeyword") , false }, - { RTL_CONSTASCII_USTRINGPARAM("/BASICError"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/SQLIdentifier"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/SQLNumber"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/SQLString"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/SQLOperator"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/SQLKeyword"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/SQLParameter"), false }, - { RTL_CONSTASCII_USTRINGPARAM("/SQLComment"), false } + { "/DocColor" ,false }, + { "/DocBoundaries" ,true }, + { "/AppBackground" ,false }, + { "/ObjectBoundaries",true }, + { "/TableBoundaries" ,true }, + { "/FontColor" ,false }, + { "/Links" ,true }, + { "/LinksVisited" ,true }, + { "/Spell" ,false }, + { "/SmartTags" ,false }, + { "/Shadow" , true }, + { "/WriterTextGrid" ,false }, + { "/WriterFieldShadings",true }, + { "/WriterIdxShadings" ,true }, + { "/WriterDirectCursor" ,true }, + { "/WriterScriptIndicator" ,false }, + { "/WriterSectionBoundaries" ,true }, + { "/WriterHeaderFooterMark" ,false }, + { "/WriterPageBreaks" ,false }, + { "/HTMLSGML" ,false }, + { "/HTMLComment" ,false }, + { "/HTMLKeyword" ,false }, + { "/HTMLUnknown" ,false }, + { "/CalcGrid" ,false }, + { "/CalcPageBreak", false }, + { "/CalcPageBreakManual", false }, + { "/CalcPageBreakAutomatic", false }, + { "/CalcDetective" ,false }, + { "/CalcDetectiveError" ,false }, + { "/CalcReference" ,false }, + { "/CalcNotesBackground" ,false }, + { "/DrawGrid" ,true }, + { "/BASICIdentifier", false }, + { "/BASICComment" , false }, + { "/BASICNumber" , false }, + { "/BASICString" , false }, + { "/BASICOperator" , false }, + { "/BASICKeyword" , false }, + { "/BASICError", false }, + { "/SQLIdentifier", false }, + { "/SQLNumber", false }, + { "/SQLString", false }, + { "/SQLOperator", false }, + { "/SQLKeyword", false }, + { "/SQLParameter", false }, + { "/SQLComment", false } }; int nIndex = 0; OUString sBase = "ColorSchemes/" @@ -169,8 +167,7 @@ uno::Sequence< OUString> GetPropertyNames(const OUString& rScheme) for(sal_Int32 i = 0; i < 4 * nCount; i+= 4) { sal_Int32 nPos = i / 4; - OUString sBaseName = sBase - + OUString(cNames[nPos].cName, cNames[nPos].nLength, cNames[nPos].eEncoding); + OUString sBaseName = sBase + cNames[nPos].cName; pNames[nIndex] += sBaseName; pNames[nIndex++] += "/Color"; if(cNames[nPos].bCanBeVisible) commit ccc2b4ec0e51af180b30a1f2198d5a44fba3e778 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Feb 7 22:14:06 2017 +0100 Use OUStringLiteral Change-Id: I15580bd0395145f9554cd3a155c4825ba95005b3 diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index cdf6df5..8bb8fdb 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -79,19 +79,8 @@ namespace logging { struct Variable { - const sal_Char* pVariablePattern; - const sal_Int32 nPatternLength; - rtl_TextEncoding eEncoding; - const OUString sVariableValue; - - Variable( const sal_Char* _pVariablePattern, const sal_Int32 _nPatternLength, rtl_TextEncoding _eEncoding, - const OUString& _rVariableValue ) - :pVariablePattern( _pVariablePattern ) - ,nPatternLength( _nPatternLength ) - ,eEncoding( _eEncoding ) - ,sVariableValue( _rVariableValue ) - { - } + OUStringLiteral pVariablePattern; + OUString sVariableValue; }; OUString sLoggerName; @@ -132,22 +121,21 @@ namespace logging aProcessId = info.Ident; rtl::OUString aPID = OUString::number( aProcessId ); - Variable aVariables[] = + Variable const aVariables[] = { - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(loggername)" ), sLoggerName ), - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(date)" ), sDate ), - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(time)" ), sTime ), - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(datetime)" ), sDateTime ), - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(pid)" ), aPID ) + {"$(loggername)", sLoggerName}, + {"$(date)", sDate}, + {"$(time)", sTime}, + {"$(datetime)", sDateTime}, + {"$(pid)", aPID} }; - for (Variable & aVariable : aVariables) + for (Variable const & aVariable : aVariables) { - OUString sPattern( aVariable.pVariablePattern, aVariable.nPatternLength, aVariable.eEncoding ); - sal_Int32 nVariableIndex = _inout_rFileURL.indexOf( sPattern ); + sal_Int32 nVariableIndex = _inout_rFileURL.indexOf( aVariable.pVariablePattern ); if (nVariableIndex >= 0) { - _inout_rFileURL = _inout_rFileURL.replaceAt( nVariableIndex, sPattern.getLength(), aVariable.sVariableValue ); + _inout_rFileURL = _inout_rFileURL.replaceAt( nVariableIndex, aVariable.pVariablePattern.size, aVariable.sVariableValue ); } } } commit 40035bbbbc4b81a285905fb26eeb5e68640ef508 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Feb 7 21:58:28 2017 +0100 Drop bogus check for escaped $ This apparently wanted to check whether the $ starting a potential pattern occurrence was escaped by a preceding $. However: * The check itself was broken, erratically looking into sPattern instead of _inout_rFileURL for the $. * The check was bogus, as it would have misinterpreted e.g. "$$$(loggername)". * The resulting string is documented (in officecfg/registry/schema/org/openoffice/Office/Logging.xcs) to be passed through css.util.PathSubstitution. However, neither the PathSubstitution service's documentation (in offapi/com/sun/star/util/PathSubstitution.idl) nor its implementation (SubstitutePathVariables::impl_substituteVariable in framework/source/services/substitutepathvars.cxx) appear to support esacping $ with a preceding $. So it looks more reasonable to remove the check completely here. Change-Id: I445493d444904cd54f166adcbf870a918d1f9982 diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index 71f14c6..cdf6df5 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -145,13 +145,8 @@ namespace logging { OUString sPattern( aVariable.pVariablePattern, aVariable.nPatternLength, aVariable.eEncoding ); sal_Int32 nVariableIndex = _inout_rFileURL.indexOf( sPattern ); - if ( ( nVariableIndex == 0 ) - || ( ( nVariableIndex > 0 ) - && ( sPattern[ nVariableIndex - 1 ] != '$' ) - ) - ) + if (nVariableIndex >= 0) { - // found an (unescaped) variable _inout_rFileURL = _inout_rFileURL.replaceAt( nVariableIndex, sPattern.getLength(), aVariable.sVariableValue ); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits