[Libreoffice-commits] core.git: 2 commits - sal/rtl

2022-02-22 Thread Mike Kaganski (via logerrit)
 sal/rtl/strtmpl.hxx |   19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 2c08104e4211594d3d06b1e4e85038276b58918a
Author: Mike Kaganski 
AuthorDate: Wed Feb 23 07:28:17 2022 +0100
Commit: Mike Kaganski 
CommitDate: Wed Feb 23 08:07:36 2022 +0100

Use rtl::isAscii

Change-Id: Iab88c3281f3dd1ba1668b3372420c97087c14da5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130381
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx
index 856fce560065..d0f8fbeb6d83 100644
--- a/sal/rtl/strtmpl.hxx
+++ b/sal/rtl/strtmpl.hxx
@@ -1210,7 +1210,7 @@ void newFromLiteral( 
IMPL_RTL_STRINGDATA** ppThi
 {
 if constexpr (sizeof(STRCODE) == 
sizeof(sal_Unicode))
 {
-assert(static_cast(*pCharStr) < 0x80); // ASCII 
range
+assert(rtl::isAscii(static_cast(*pCharStr)));
 }
 SAL_WARN_IF( (static_cast(*pCharStr)) == '\0', 
"rtl.string",
 "rtl_uString_newFromLiteral - Found embedded \\0 
character" );
commit 8dcda24026d6d803f064351b1a1df8f6b77c2fa0
Author: Mike Kaganski 
AuthorDate: Wed Feb 23 07:15:44 2022 +0100
Commit: Mike Kaganski 
CommitDate: Wed Feb 23 08:07:21 2022 +0100

Simplify NewCopy a bit; avoid direct use of memcpy

Change-Id: I197978604d0dfa997c95b907715ce891211621f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130380
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx
index eec7010117d8..856fce560065 100644
--- a/sal/rtl/strtmpl.hxx
+++ b/sal/rtl/strtmpl.hxx
@@ -1001,18 +1001,17 @@ auto* NewCopy   
   ( IMPL_RTL_STRINGDATA
  
IMPL_RTL_STRINGDATA* pStr,
  sal_Int32 nCount )
 {
-assert(nCount >= 0);
-IMPL_RTL_STRINGDATA*pData = Alloc( pStr->length );
-OSL_ASSERT(pData != nullptr);
-
-auto* pDest   = pData->buffer;
-auto* pSrc= pStr->buffer;
+assert(ppThis);
+assert(pStr);
+assert(nCount >= 0 && nCount <= pStr->length);
+*ppThis = Alloc( pStr->length );
+OSL_ASSERT(*ppThis != nullptr);
 
-memcpy( pDest, pSrc, nCount * sizeof(*pSrc) );
+auto* pDest   = (*ppThis)->buffer;
 
-*ppThis = pData;
+Copy(pDest, pStr->buffer, nCount);
 
-RTL_LOG_STRING_NEW( pData );
+RTL_LOG_STRING_NEW( *ppThis );
 return pDest + nCount;
 }
 


[Libreoffice-commits] core.git: 2 commits - sal/rtl soltools/cpp soltools/mkdepend sot/source starmath/source stoc/source svl/qa svl/source

2019-02-10 Thread Libreoffice Gerrit user
 sal/rtl/bootstrap.cxx  |   16 ---
 soltools/cpp/_include.c|2 
 soltools/cpp/_tokens.c |6 -
 soltools/mkdepend/main.c   |2 
 sot/source/base/exchange.cxx   |2 
 sot/source/sdstor/ucbstorage.cxx   |4 
 sot/source/unoolestorage/xolesimplestorage.cxx |   20 ++--
 starmath/source/cursor.cxx |2 
 starmath/source/mathmlexport.cxx   |2 
 starmath/source/mathtype.cxx   |4 
 starmath/source/smmod.cxx  |2 
 starmath/source/symbol.cxx |2 
 starmath/source/unomodel.cxx   |2 
 starmath/source/view.cxx   |   10 +-
 stoc/source/defaultregistry/defaultregistry.cxx|2 
 stoc/source/implementationregistration/implreg.cxx |9 -
 stoc/source/invocation/invocation.cxx  |2 
 svl/qa/unit/items/test_IndexedStyleSheets.cxx  |2 
 svl/source/crypto/cryptosign.cxx   |  104 ++---
 svl/source/fsstor/fsstorage.cxx|   16 +--
 svl/source/items/globalnameitem.cxx|2 
 svl/source/items/srchitem.cxx  |2 
 svl/source/items/style.cxx |4 
 23 files changed, 99 insertions(+), 120 deletions(-)

New commits:
commit f68f3b98cc47868cda3a75298a211c5735c0a4e7
Author: Noel Grandin 
AuthorDate: Fri Feb 8 13:55:44 2019 +0200
Commit: Noel Grandin 
CommitDate: Sun Feb 10 11:18:35 2019 +0100

loplugin:indentation in soltools..svl

Change-Id: I270a12cdb68920b8fa23b82dd933724e30334485
Reviewed-on: https://gerrit.libreoffice.org/67565
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/soltools/cpp/_include.c b/soltools/cpp/_include.c
index c9f20537f5eb..57ca137cb2cd 100644
--- a/soltools/cpp/_include.c
+++ b/soltools/cpp/_include.c
@@ -117,7 +117,7 @@ void
 error(FATAL, "#%s too deeply nested", import ? "import" : 
"include");
 if (Xflag)
 genimport(fname, angled, iname, import);
- if (Iflag)
+if (Iflag)
 error(INFO, "Open %s file [%s]", import ? "import" : "include", 
iname );
 
 for (i = NINCLUDE - 1; i >= 0; i--)
diff --git a/soltools/cpp/_tokens.c b/soltools/cpp/_tokens.c
index 6842de38301f..cb0beecf991d 100644
--- a/soltools/cpp/_tokens.c
+++ b/soltools/cpp/_tokens.c
@@ -429,11 +429,11 @@ void
 int nlen = (int)(ntp->len + ntp->wslen);
 
 memcpy(wbp, "if(", 3 );
- wbp += 4;
+wbp += 4;
 memcpy(wbp, np, nlen );
- wbp += nlen;
+wbp += nlen;
 memcpy(wbp, ")", 1 );
- wbp++;
+wbp++;
 
 memcpy(wbp, p, len);
 }
diff --git a/soltools/mkdepend/main.c b/soltools/mkdepend/main.c
index a32e0dd38316..ee1cfb8efc7d 100644
--- a/soltools/mkdepend/main.c
+++ b/soltools/mkdepend/main.c
@@ -227,7 +227,7 @@ int main(int argc, char**argv)
 argc = 1;
 for (p = args; argc < nargc; p += strlen(p) + 1)
 if (*p) nargv[argc++] = p;
-argv = nargv;
+argv = nargv;
 }
 for(argc--, argv++; argc; argc--, argv++) {
 /* if looking for endmarker then check before parsing */
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index cb9c502b0561..146114b8b238 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -206,7 +206,7 @@ namespace
 /*145 SotClipboardFormatId::RICHTEXT*/ { "text/richtext", 
"Richtext Format", ::UnoType>::get() },
 /*146 SotClipboardFormatId::STRING_TSVC*/{ 
"application/x-libreoffice-tsvc", "Text TSV-Calc", 
::UnoType::get() }
 };
-return [0];
+return [0];
 }
 };
 
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 6bdcffbf42b3..0f76afcfafca 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1681,7 +1681,7 @@ void UCBStorage_Impl::CreateContent()
 
 void UCBStorage_Impl::ReadContent()
 {
-   if ( m_bListCreated )
+if ( m_bListCreated )
 return;
 
 m_bListCreated = true;
@@ -2506,7 +2506,7 @@ bool UCBStorage::CopyTo( const OUString& rElemName, 
BaseStorage* pDest, const OU
 else
 {
 // for copying no optimization is useful, because in every case the 
stream data must be copied
-UCBStorageElement_Impl* pElement = FindElement_Impl( rElemName );
+UCBStorageElement_Impl* pElement = FindElement_Impl( rElemName );
 if ( pElement )
 return 

[Libreoffice-commits] core.git: 2 commits - sal/rtl

2018-07-29 Thread Libreoffice Gerrit user
 sal/rtl/strtmpl.cxx |   29 -
 1 file changed, 4 insertions(+), 25 deletions(-)

New commits:
commit 0955eb65b6302a072fd9b55b9cd09b62ab5dcd43
Author: Noel Grandin 
AuthorDate: Sun Jul 29 13:15:36 2018 +0200
Commit: Noel Grandin 
CommitDate: Sun Jul 29 19:11:13 2018 +0200

Use memmove in trim_WithLength

Change-Id: If75ac1968b8b0b3314ae36c2a7f163cb5428e9c6
Reviewed-on: https://gerrit.libreoffice.org/58277
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 421a615b7574..af3a28cbfec2 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -744,18 +744,9 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( trim_WithLength )( 
IMPL_RTL_STRCODE* pStr,
 
 if ( nPreSpaces )
 {
-IMPL_RTL_STRCODE* pNewStr = pStr+nPreSpaces;
-
 nLen -= nPreSpaces;
-nIndex = nLen;
-
-while ( nIndex )
-{
-*pStr = *pNewStr;
-pStr++;
-pNewStr++;
-nIndex--;
-}
+memmove(pStr, pStr + nPreSpaces, nLen * sizeof(IMPL_RTL_STRCODE));
+pStr += nLen;
 *pStr = 0;
 }
 
commit 034203742d43045df1a6a733a81fb929ee840aac
Author: Noel Grandin 
AuthorDate: Sun Jul 29 13:08:26 2018 +0200
Commit: Noel Grandin 
CommitDate: Sun Jul 29 19:11:01 2018 +0200

optimise newFromStr functions

use the other functions in this module so we get the compiler builtins
if available

Change-Id: Idbd9df44e057e573dd3fb243c50c5186e8edd8d8
Reviewed-on: https://gerrit.libreoffice.org/58276
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index b477e50216c0..421a615b7574 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -1313,16 +1313,12 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr )( 
IMPL_RTL_STRINGDATA** ppThis,
 SAL_THROW_EXTERN_C()
 {
 assert(ppThis);
-IMPL_RTL_STRCODE*   pBuffer;
 IMPL_RTL_STRINGDATA*pOrg;
 sal_Int32   nLen;
 
 if ( pCharStr )
 {
-const IMPL_RTL_STRCODE* pTempStr = pCharStr;
-while( *pTempStr )
-pTempStr++;
-nLen = pTempStr-pCharStr;
+nLen = IMPL_RTL_STRNAME( getLength )( pCharStr );
 }
 else
 nLen = 0;
@@ -1336,15 +1332,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr )( 
IMPL_RTL_STRINGDATA** ppThis,
 pOrg = *ppThis;
 *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen );
 OSL_ASSERT(*ppThis != nullptr);
-pBuffer = (*ppThis)->buffer;
-do
-{
-*pBuffer = *pCharStr;
-pBuffer++;
-pCharStr++;
-}
-while ( *pCharStr );
-
+rtl_str_ImplCopy( (*ppThis)->buffer, pCharStr, nLen );
 RTL_LOG_STRING_NEW( *ppThis );
 
 /* must be done last, if pCharStr == *ppThis */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sal/rtl

2017-07-22 Thread Chris Sherlock
 sal/rtl/cipher.cxx |  340 +
 1 file changed, 114 insertions(+), 226 deletions(-)

New commits:
commit 42bd4103f8591e679259f9d138d1d579fef1271d
Author: Chris Sherlock 
Date:   Sun Jul 23 01:59:19 2017 +1000

rtl: cleanup cipher.cxx equality conditions

Change-Id: I0b8084adea65f8c6a6e5e46b6628297fbd9eda9b

diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx
index cd1ffb91204c..db159dc41b71 100644
--- a/sal/rtl/cipher.cxx
+++ b/sal/rtl/cipher.cxx
@@ -135,9 +135,10 @@ rtlCipherError SAL_CALL rtl_cipher_init(
 const sal_uInt8 *pArgData, sal_Size nArgLen) SAL_THROW_EXTERN_C()
 {
 Cipher_Impl *pImpl = static_cast(Cipher);
-if (pImpl == nullptr)
+if (!pImpl)
 return rtl_Cipher_E_Argument;
-if (pImpl->m_init == nullptr)
+
+if (!pImpl->m_init)
 return rtl_Cipher_E_Unknown;
 
 return (pImpl->m_init)(
@@ -150,9 +151,10 @@ rtlCipherError SAL_CALL rtl_cipher_encode(
 sal_uInt8  *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C()
 {
 Cipher_Impl *pImpl = static_cast(Cipher);
-if (pImpl == nullptr)
+if (!pImpl)
 return rtl_Cipher_E_Argument;
-if (pImpl->m_encode == nullptr)
+
+if (!pImpl->m_encode)
 return rtl_Cipher_E_Unknown;
 
 return (pImpl->m_encode)(Cipher, pData, nDatLen, pBuffer, nBufLen);
@@ -164,9 +166,10 @@ rtlCipherError SAL_CALL rtl_cipher_decode(
 sal_uInt8  *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C()
 {
 Cipher_Impl *pImpl = static_cast(Cipher);
-if (pImpl == nullptr)
+if (!pImpl)
 return rtl_Cipher_E_Argument;
-if (pImpl->m_decode == nullptr)
+
+if (!pImpl->m_decode)
 return rtl_Cipher_E_Unknown;
 
 return (pImpl->m_decode)(Cipher, pData, nDatLen, pBuffer, nBufLen);
@@ -681,10 +684,10 @@ static rtlCipherError BF_update(
 sal_uInt8  *pBuffer, sal_Size nBufLen)
 {
 /* Check arguments. */
-if ((pData == nullptr) || (pBuffer == nullptr))
+if (!pData || !pBuffer)
 return rtl_Cipher_E_Argument;
 
-if (!((0 < nDatLen) && (nDatLen <= nBufLen)))
+if (!((nDatLen > 0) && (nDatLen <= nBufLen)))
 return rtl_Cipher_E_BufferSize;
 
 /* Update. */
@@ -939,7 +942,7 @@ rtlCipher SAL_CALL rtl_cipher_createBF(rtlCipherMode Mode) 
SAL_THROW_EXTERN_C()
 CipherBF_Impl *pImpl = nullptr;
 
 if (Mode == rtl_Cipher_ModeInvalid)
-return (nullptr);
+return nullptr;
 
 pImpl = static_cast(rtl_allocateZeroMemory(sizeof 
(CipherBF_Impl)));
 if (pImpl)
@@ -964,13 +967,13 @@ rtlCipherError SAL_CALL rtl_cipher_initBF(
 {
 CipherBF_Impl *pImpl = static_cast(Cipher);
 
-if ((pImpl == nullptr) || (pKeyData == nullptr))
+if (!pImpl || !pKeyData)
 return rtl_Cipher_E_Argument;
 
-if (!(pImpl->m_cipher.m_algorithm == rtl_Cipher_AlgorithmBF))
+if (pImpl->m_cipher.m_algorithm != rtl_Cipher_AlgorithmBF)
 return rtl_Cipher_E_Algorithm;
 
-if (!(Direction == rtl_Cipher_DirectionInvalid))
+if (Direction != rtl_Cipher_DirectionInvalid)
 pImpl->m_cipher.m_direction = Direction;
 else
 return rtl_Cipher_E_Direction;
@@ -986,14 +989,15 @@ rtlCipherError SAL_CALL rtl_cipher_encodeBF(
 sal_uInt8  *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C()
 {
 CipherBF_Impl *pImpl = static_cast(Cipher);
-if (pImpl == nullptr)
+if (!pImpl)
 return rtl_Cipher_E_Argument;
 
-if (!(pImpl->m_cipher.m_algorithm == rtl_Cipher_AlgorithmBF))
+if (pImpl->m_cipher.m_algorithm != rtl_Cipher_AlgorithmBF)
 return rtl_Cipher_E_Algorithm;
 
 if (pImpl->m_cipher.m_direction == rtl_Cipher_DirectionInvalid)
 return rtl_Cipher_E_Direction;
+
 if (pImpl->m_cipher.m_direction == rtl_Cipher_DirectionDecode)
 return rtl_Cipher_E_Direction;
 
@@ -1009,14 +1013,15 @@ rtlCipherError SAL_CALL rtl_cipher_decodeBF(
 sal_uInt8  *pBuffer, sal_Size nBufLen) SAL_THROW_EXTERN_C()
 {
 CipherBF_Impl *pImpl = static_cast(Cipher);
-if (pImpl == nullptr)
+if (!pImpl)
 return rtl_Cipher_E_Argument;
 
-if (!(pImpl->m_cipher.m_algorithm == rtl_Cipher_AlgorithmBF))
+if (pImpl->m_cipher.m_algorithm != rtl_Cipher_AlgorithmBF)
 return rtl_Cipher_E_Algorithm;
 
 if (pImpl->m_cipher.m_direction == rtl_Cipher_DirectionInvalid)
 return rtl_Cipher_E_Direction;
+
 if (pImpl->m_cipher.m_direction == rtl_Cipher_DirectionEncode)
 return rtl_Cipher_E_Direction;
 
@@ -1115,7 +1120,7 @@ static rtlCipherError rtl_cipherARCFOUR_update_Impl(
 sal_Size k;
 
 /* Check arguments. */
-if ((pData == nullptr) || (pBuffer == nullptr))
+if (!pData || !pBuffer)
 return rtl_Cipher_E_Argument;
 
 if (!((0 < nDatLen) && (nDatLen <= nBufLen)))
@@ -1156,8 +1161,8 @@ rtlCipher SAL_CALL 

[Libreoffice-commits] core.git: 2 commits - sal/rtl sc/source

2017-02-20 Thread Caolán McNamara
 sal/rtl/alloc_cache.cxx  |4 +++-
 sc/source/ui/src/scfuncs.src |   11 +--
 2 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 03eb939856a73fed6bbf3850d7dc4d58594a7d98
Author: Caolán McNamara 
Date:   Mon Feb 20 09:44:43 2017 +

update .src comment for stringarray conversion

Change-Id: Ib4518ea46acb37d97c9739ee11b6cf9777f99194

diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index ed205af..7c43b8a 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -19,13 +19,12 @@
 
 /* Resource file for the function wizard / autopilot.
  *
- *  For every function there is a sub resource with the number of the OpCode of
- *  the function.
+ *  For every function there is a StringArray with a resource id (offset by
+ *  RID_SC_FUNC_DESCRIPTIONS_START) with the OpCode of the function
  *
- *  In this sub resource, with index 1 the description of the function is
- *  given, followed by two string resources for each parameter,
- *  first the type or name of the parameter, second a description of the
- *  parameter.
+ *  In this stringarray, the description of the function is given as the first
+ *  entry, followed by two entries for each parameter, first the type or name
+ *  of the parameter, second a description of the parameter.
  */
 
 #include "scfuncs.hrc"
commit 234bc82308b00d315360073f1316700fa688a38f
Author: Caolán McNamara 
Date:   Mon Feb 20 08:56:17 2017 +

silence coverity#1202740 Bad bit shift operation

Change-Id: I88c38a1a7eae0d1e2011c40983490efef1ff6438

diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx
index fd8a8c0..1529626 100644
--- a/sal/rtl/alloc_cache.cxx
+++ b/sal/rtl/alloc_cache.cxx
@@ -130,7 +130,9 @@ rtl_cache_hash_rescale (
 
 cache->m_hash_table = new_table;
 cache->m_hash_size  = new_size;
-cache->m_hash_shift = highbit(cache->m_hash_size) - 1;
+const auto bit = highbit(cache->m_hash_size);
+assert(bit > 0);
+cache->m_hash_shift = bit - 1;
 
 for (i = 0; i < old_size; i++)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sal/rtl sd/source

2016-02-05 Thread Caolán McNamara
 sal/rtl/alloc_global.cxx|1 +
 sd/source/core/text/textapi.cxx |7 +++
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 512dd456520c10318fd65f45ec2704bdeb8c4fdb
Author: Caolán McNamara 
Date:   Fri Feb 5 15:09:29 2016 +

cppcheck: useInitializationList

Change-Id: I85488439b06fddd73074757f1149dec5d988099d
Reviewed-on: https://gerrit.libreoffice.org/22161
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sd/source/core/text/textapi.cxx b/sd/source/core/text/textapi.cxx
index 83ff45d..086a06d 100644
--- a/sd/source/core/text/textapi.cxx
+++ b/sd/source/core/text/textapi.cxx
@@ -185,11 +185,10 @@ TextApiObject* TextApiObject::getImplementation( const 
css::uno::Reference< css:
 return pImpl;
 }
 
-TextAPIEditSource::TextAPIEditSource( const TextAPIEditSource& rSource )
-: SvxEditSource( *this )
+TextAPIEditSource::TextAPIEditSource(const TextAPIEditSource& rSource)
+: SvxEditSource(*this)
+, m_xImpl(rSource.m_xImpl) // shallow copy; uses internal refcounting
 {
-// shallow copy; uses internal refcounting
-m_xImpl = rSource.m_xImpl;
 }
 
 SvxEditSource* TextAPIEditSource::Clone() const
commit 42294e47bbff63e01639a8a70daa5e93c3380bc4
Author: Caolán McNamara 
Date:   Fri Feb 5 15:09:22 2016 +

cppcheck-suppress sizeofwithsilentarraypointer

Change-Id: I794cb2f3f31e9ce48f3568bd5a4afc52abf0f934
Reviewed-on: https://gerrit.libreoffice.org/22160
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx
index ca6601b..6dd24f1 100644
--- a/sal/rtl/alloc_global.cxx
+++ b/sal/rtl/alloc_global.cxx
@@ -237,6 +237,7 @@ void rtl_memory_fini()
 int i, n;
 
 /* clear g_alloc_table */
+// cppcheck-suppress sizeofwithsilentarraypointer
 memset (g_alloc_table, 0, sizeof(g_alloc_table));
 
 /* cleanup g_alloc_caches */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sal/rtl

2015-03-02 Thread Stephan Bergmann
 sal/rtl/strtmpl.cxx |   28 
 sal/rtl/ustring.cxx |2 +-
 2 files changed, 17 insertions(+), 13 deletions(-)

New commits:
commit 92bface85dc413fc015fd651c538f580ae2da151
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Mar 2 16:37:55 2015 +0100

Turn function-like macro into true function

Change-Id: I70330b1f4844f33779f814377afaf90e0a219b1d

diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 71052bc..4a90c2e 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -1191,10 +1191,14 @@ static IMPL_RTL_STRCODE* IMPL_RTL_STRINGNAME( 
ImplNewCopy )( IMPL_RTL_STRINGDATA
 /* String-Class functions  */
 /* === */
 
-#define IMPL_RTL_ACQUIRE( pThis )   \
-{   \
-if (!SAL_STRING_IS_STATIC (pThis))  \
-osl_atomic_increment( ((pThis)-refCount) );  \
+namespace {
+
+void IMPL_RTL_ACQUIRE(IMPL_RTL_STRINGDATA * pThis)
+{
+if (!SAL_STRING_IS_STATIC (pThis))
+osl_atomic_increment( ((pThis)-refCount) );
+}
+
 }
 
 /* --- */
commit e8eec3b3979cf0626bd88db857879fd57fe7a39c
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Mar 2 16:36:23 2015 +0100

typo

Change-Id: Ifc03631b126ec19cb98cb42a258ca4880e868385

diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index bfd61de..71052bc 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -1191,7 +1191,7 @@ static IMPL_RTL_STRCODE* IMPL_RTL_STRINGNAME( ImplNewCopy 
)( IMPL_RTL_STRINGDATA
 /* String-Class functions  */
 /* === */
 
-#define IMPL_RTL_AQUIRE( pThis )\
+#define IMPL_RTL_ACQUIRE( pThis )   \
 {   \
 if (!SAL_STRING_IS_STATIC (pThis))  \
 osl_atomic_increment( ((pThis)-refCount) );  \
@@ -1202,7 +1202,7 @@ static IMPL_RTL_STRCODE* IMPL_RTL_STRINGNAME( ImplNewCopy 
)( IMPL_RTL_STRINGDATA
 void SAL_CALL IMPL_RTL_STRINGNAME( acquire )( IMPL_RTL_STRINGDATA* pThis )
 SAL_THROW_EXTERN_C()
 {
-IMPL_RTL_AQUIRE( pThis );
+IMPL_RTL_ACQUIRE( pThis );
 }
 
 /* --- */
@@ -1451,7 +1451,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( assign )( 
IMPL_RTL_STRINGDATA** ppThis,
 {
 assert(ppThis);
 /* must be done at first, if pStr == *ppThis */
-IMPL_RTL_AQUIRE( pStr );
+IMPL_RTL_ACQUIRE( pStr );
 
 if ( *ppThis )
 IMPL_RTL_STRINGNAME( release )( *ppThis );
@@ -1491,12 +1491,12 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newConcat )( 
IMPL_RTL_STRINGDATA** ppThis,
 if ( !pRight || !pRight-length )
 {
 *ppThis = pLeft;
-IMPL_RTL_AQUIRE( pLeft );
+IMPL_RTL_ACQUIRE( pLeft );
 }
 else if ( !pLeft || !pLeft-length )
 {
 *ppThis = pRight;
-IMPL_RTL_AQUIRE( pRight );
+IMPL_RTL_ACQUIRE( pRight );
 }
 else
 {
@@ -1670,7 +1670,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newReplace )( 
IMPL_RTL_STRINGDATA** ppThis,
 if ( !bChanged )
 {
 *ppThis = pStr;
-IMPL_RTL_AQUIRE( pStr );
+IMPL_RTL_ACQUIRE( pStr );
 }
 
 RTL_LOG_STRING_NEW( *ppThis );
@@ -1728,7 +1728,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiLowerCase )( 
IMPL_RTL_STRINGDATA**
 if ( !bChanged )
 {
 *ppThis = pStr;
-IMPL_RTL_AQUIRE( pStr );
+IMPL_RTL_ACQUIRE( pStr );
 }
 
 RTL_LOG_STRING_NEW( *ppThis );
@@ -1786,7 +1786,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiUpperCase )( 
IMPL_RTL_STRINGDATA**
 if ( !bChanged )
 {
 *ppThis = pStr;
-IMPL_RTL_AQUIRE( pStr );
+IMPL_RTL_ACQUIRE( pStr );
 }
 
 RTL_LOG_STRING_NEW( *ppThis );
@@ -1822,7 +1822,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newTrim )( 
IMPL_RTL_STRINGDATA** ppThis,
 if ( !nPreSpaces  !nPostSpaces )
 {
 *ppThis = pStr;
-IMPL_RTL_AQUIRE( pStr );
+IMPL_RTL_ACQUIRE( pStr );
 }
 else
 {
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index cc99812..d91aaad 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -893,7 +893,7 @@ void SAL_CALL rtl_uString_intern( rtl_uString ** newStr,
 assert(str);
 if (SAL_STRING_IS_INTERN(str))
 {
-IMPL_RTL_AQUIRE( str );
+IMPL_RTL_ACQUIRE( str );
 *newStr = str;
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sal/rtl svgio/source

2014-02-28 Thread Stephan Bergmann
 sal/rtl/uri.cxx |   21 -
 svgio/source/svgreader/svgimagenode.cxx |   15 ++-
 2 files changed, 26 insertions(+), 10 deletions(-)

New commits:
commit 51f73a9be8270487885d185eaa3dda13ec43d9b0
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Feb 28 17:49:40 2014 +0100

Simplify string construction

Change-Id: Ib46a64d8438dcaba37a234460d1a4113707e8c43

diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx
index 513fb51..774c5f7 100644
--- a/sal/rtl/uri.cxx
+++ b/sal/rtl/uri.cxx
@@ -708,20 +708,23 @@ sal_Bool SAL_CALL rtl_uriConvertRelToAbs(rtl_uString * 
pBaseUriRef,
 parseUriRef(pBaseUriRef, aBaseComponents);
 if (!aBaseComponents.aScheme.isPresent())
 {
-rtl::OUString aMessage(pBaseUriRef);
-aMessage += rtl::OUString(
- does not start with a scheme component);
-rtl_uString_assign(pException,
-   const_cast rtl::OUString  (aMessage).pData);
+rtl_uString_assign(
+pException,
+(rtl::OUString(
+ + rtl::OUString(pBaseUriRef)
++  does not start with a scheme component)
+ .pData));
 return false;
 }
 if (aBaseComponents.aPath.pBegin != aBaseComponents.aPath.pEnd
  *aBaseComponents.aPath.pBegin != '/')
 {
-rtl::OUString aMessage(pBaseUriRef);
-aMessage += rtl::OUString(
-path component does not start with slash);
-rtl_uString_assign(pException, aMessage.pData);
+rtl_uString_assign(
+pException,
+(rtl::OUString(
+ + rtl::OUString(pBaseUriRef)
++  path component does not start with a slash)
+ .pData));
 return false;
 }
 
commit 29c3bb0968cb9770f7b822f5cf466314be9db825
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Feb 28 17:43:23 2014 +0100

Handle vnd.sun.star.Package: URLs provoking MalrformedUriException

...as e.g. happens when loading an .odt containing a Pcitures/XXX.svg stream
which in turn contains an image xlink:href=logo.gif/ with relative URL, 
e.g.
when loading the .odt generated by the instructions in fdo#75582.

Change-Id: I0d275662259bba8d582e2bd4671f0f6667060132

diff --git a/svgio/source/svgreader/svgimagenode.cxx 
b/svgio/source/svgreader/svgimagenode.cxx
index 9ee155b..9cdb59a 100644
--- a/svgio/source/svgreader/svgimagenode.cxx
+++ b/svgio/source/svgreader/svgimagenode.cxx
@@ -237,7 +237,20 @@ namespace svgio
 
 if (!rPath.isEmpty())
 {
-const OUString 
aAbsUrl(rtl::Uri::convertRelToAbs(rPath, maUrl));
+OUString aAbsUrl;
+try {
+aAbsUrl = rtl::Uri::convertRelToAbs(
+rPath, maUrl);
+} catch (rtl::MalformedUriException  e) {
+// Happens for the odd maUrl =
+// vnd.sun.star.Package:Pictures/... scheme
+// using path components not starting with a
+// slash by mis-design:
+SAL_INFO(
+svg,
+caught rtl::MalformedUriException \
+ e.getMessage()  \);
+}
 
 if (!aAbsUrl.isEmpty())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sal/rtl sc/inc sd/source vcl/unx

2013-11-07 Thread Stephan Bergmann
 sal/rtl/alloc_cache.cxx |2 ++
 sc/inc/externalrefmgr.hxx   |2 +-
 sd/source/ui/remotecontrol/BluetoothServer.cxx  |2 +-
 sd/source/ui/remotecontrol/DiscoveryService.cxx |3 ++-
 vcl/unx/generic/app/sm.cxx  |1 +
 vcl/unx/generic/dtrans/X11_selection.cxx|1 +
 6 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit eacb4a71ec6801f7bec491f705151844c6bfe945
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Nov 7 09:41:24 2013 +0100

Blind MSVC fix

Change-Id: I22c316cc82c40481fa1bf93412d97d67e1f95b41

diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index b3d35f9..e7a5e79 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -381,7 +381,7 @@ public:
  * values from external references.  Interpreting formula strings is one
  * such example.
  */
-class ApiGuard
+class SC_DLLPUBLIC ApiGuard
 {
 public:
 ApiGuard(ScDocument* pDoc);
commit ebf5e56e2020359b648b0fec7bd64befe466e4b4
Author: Arnaud Versini arnaud.vers...@libreoffice.org
Date:   Fri Oct 18 18:11:33 2013 +0200

Name threads for debug purpose

Change-Id: Id99ba394b898b7da0057d4a145ce8dce46122782
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx
index 1383155..561880f 100644
--- a/sal/rtl/alloc_cache.cxx
+++ b/sal/rtl/alloc_cache.cxx
@@ -23,6 +23,7 @@
 #include internal/rtllifecycle.h
 #include sal/macros.h
 #include osl/diagnose.h
+#include osl/thread.hxx
 
 #include cassert
 #include string.h
@@ -1507,6 +1508,7 @@ static DWORD WINAPI
 #endif /* SAL_UNX || SAL_W32 */
 rtl_cache_wsupdate_all (void * arg)
 {
+osl::Thread::setName(rtl_cache_wsupdate_all);
 unsigned int seconds = sal::static_int_cast unsigned int (
 reinterpret_cast sal_uIntPtr (arg));
 
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx 
b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index 9797f39..54bc85a 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -684,7 +684,7 @@ void BluetoothServer::cleanupCommunicators()
 void SAL_CALL BluetoothServer::run()
 {
 SAL_INFO( sdremote.bluetooth, BluetoothServer::run called );
-
+osl::Thread::setName(BluetoothServer);
 #ifdef LINUX_BLUETOOTH
 DBusConnection *pConnection = dbusConnectToNameOnBus();
 if( !pConnection )
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx 
b/sd/source/ui/remotecontrol/DiscoveryService.cxx
index f72c3b8..26da311 100644
--- a/sd/source/ui/remotecontrol/DiscoveryService.cxx
+++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx
@@ -128,7 +128,8 @@ DiscoveryService::~DiscoveryService()
 
 void SAL_CALL DiscoveryService::run()
 {
-  // Kept for backwrad compatibility
+osl::Thread::setName(DiscoveryService);
+// Kept for backwrad compatibility
 char aBuffer[BUFFER_SIZE];
 while ( true )
 {
diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx
index bc5c0e7..5ff4273 100644
--- a/vcl/unx/generic/app/sm.cxx
+++ b/vcl/unx/generic/app/sm.cxx
@@ -603,6 +603,7 @@ void ICEConnectionObserver::terminate(oslThread iceThread)
 
 void ICEConnectionWorker(void * data)
 {
+osl::Thread::setName(ICEConnectionWorker);
 ICEConnectionObserver * pThis = static_cast ICEConnectionObserver * (
 data);
 for (;;)
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx 
b/vcl/unx/generic/dtrans/X11_selection.cxx
index 8a90cd9..11560fa 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -3734,6 +3734,7 @@ void SelectionManager::run( void* pThis )
 #if OSL_DEBUG_LEVEL  1
 fprintf(stderr, SelectionManager::run\n );
 #endif
+osl::Thread::setName(SelectionManager);
 // dispatch until the cows come home
 
 SelectionManager* This = (SelectionManager*)pThis;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits