[Libreoffice-commits] core.git: sot/source

2023-11-01 Thread Andrea Gelmini (via logerrit)
 sot/source/sdstor/ucbstorage.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2f9a6802793467823ce47a255591ff9e023a6dec
Author: Andrea Gelmini 
AuthorDate: Wed Nov 1 07:34:13 2023 +0100
Commit: Julien Nabet 
CommitDate: Wed Nov 1 12:52:55 2023 +0100

Fix typo

Change-Id: I25685976a4cd4549ab6448bcba179d5c4e7185bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158745
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index fa203acc1178..fbfafe9727f9 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -777,7 +777,7 @@ void UCBStorageStream_Impl::ReadSourceWriteTemporary()
 
 sal_uInt64 UCBStorageStream_Impl::ReadSourceWriteTemporary(sal_uInt64 aLength)
 {
-// read aLength bite from the source stream and copy them to the current
+// read aLength byte from the source stream and copy them to the current
 // position of the temporary stream
 
 sal_uInt64 aResult = 0;


[Libreoffice-commits] core.git: sot/source

2023-02-24 Thread Noel Grandin (via logerrit)
 sot/source/unoolestorage/xolesimplestorage.cxx |   47 +
 sot/source/unoolestorage/xolesimplestorage.hxx |8 ++--
 2 files changed, 22 insertions(+), 33 deletions(-)

New commits:
commit 2f72de90f8a27b06aae0bf9ede93ed640764498b
Author: Noel Grandin 
AuthorDate: Wed Feb 22 15:03:49 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Feb 24 10:07:39 2023 +

osl::Mutex->std::mutex in OLESimpleStorage

Change-Id: I3ff011fa4829bd7230ddaa8fc2d34ade47f09b0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147466
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx 
b/sot/source/unoolestorage/xolesimplestorage.cxx
index 49a785ed5ff9..d64937d9b4e0 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -46,7 +46,6 @@ OLESimpleStorage::OLESimpleStorage(
 css::uno::Reference xContext,
 css::uno::Sequence const )
 : m_bDisposed( false )
-, m_pListenersContainer( nullptr )
 , m_xContext(std::move( xContext ))
 , m_bNoTemporaryCopy( false )
 {
@@ -145,12 +144,6 @@ OLESimpleStorage::~OLESimpleStorage()
 dispose();
 } catch( uno::Exception& )
 {}
-
-if ( m_pListenersContainer )
-{
-delete m_pListenersContainer;
-m_pListenersContainer = nullptr;
-}
 }
 
 void OLESimpleStorage::UpdateOriginal_Impl()
@@ -263,7 +256,7 @@ void OLESimpleStorage::InsertNameAccessToStorage_Impl( 
BaseStorage* pStorage, co
 
 void SAL_CALL OLESimpleStorage::insertByName( const OUString& aName, const 
uno::Any& aElement )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -312,7 +305,7 @@ void SAL_CALL OLESimpleStorage::insertByName( const 
OUString& aName, const uno::
 
 void SAL_CALL OLESimpleStorage::removeByName( const OUString& aName )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -338,7 +331,7 @@ void SAL_CALL OLESimpleStorage::removeByName( const 
OUString& aName )
 
 void SAL_CALL OLESimpleStorage::replaceByName( const OUString& aName, const 
uno::Any& aElement )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -362,7 +355,7 @@ void SAL_CALL OLESimpleStorage::replaceByName( const 
OUString& aName, const uno:
 
 uno::Any SAL_CALL OLESimpleStorage::getByName( const OUString& aName )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -463,7 +456,7 @@ uno::Any SAL_CALL OLESimpleStorage::getByName( const 
OUString& aName )
 
 uno::Sequence< OUString > SAL_CALL OLESimpleStorage::getElementNames()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -491,7 +484,7 @@ uno::Sequence< OUString > SAL_CALL 
OLESimpleStorage::getElementNames()
 
 sal_Bool SAL_CALL OLESimpleStorage::hasByName( const OUString& aName )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -513,7 +506,7 @@ sal_Bool SAL_CALL OLESimpleStorage::hasByName( const 
OUString& aName )
 
 uno::Type SAL_CALL OLESimpleStorage::getElementType()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -524,7 +517,7 @@ uno::Type SAL_CALL OLESimpleStorage::getElementType()
 
 sal_Bool SAL_CALL OLESimpleStorage::hasElements()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -550,15 +543,15 @@ sal_Bool SAL_CALL OLESimpleStorage::hasElements()
 
 void SAL_CALL OLESimpleStorage::dispose()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
 
-if ( m_pListenersContainer )
+if ( m_aListenersContainer.getLength(aGuard) )
 {
 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) );
-m_pListenersContainer->disposeAndClear( aSource );
+m_aListenersContainer.disposeAndClear( aGuard, aSource );
 }
 
 m_pStorage.reset();
@@ -574,28 +567,24 @@ void SAL_CALL OLESimpleStorage::dispose()
 void SAL_CALL OLESimpleStorage::addEventListener(
 const uno::Reference< lang::XEventListener >& xListener )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
 
-

[Libreoffice-commits] core.git: sot/source

2022-08-28 Thread Caolán McNamara (via logerrit)
 sot/source/sdstor/stg.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit f4ccf5da912a8cb33971cfd2f2276e90a0571d0b
Author: Caolán McNamara 
AuthorDate: Sun Aug 28 14:55:51 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sun Aug 28 21:12:21 2022 +0200

cid#1500658 silence Resource leak

Change-Id: I799c44990d2a2cca3b843c3c64774d4d49e4a8b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138946
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 08af343092fa..cebade94f654 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -579,6 +579,7 @@ BaseStorage* Storage::OpenStorage( const OUString& rName, 
StreamMode m, bool bDi
 if( p && p->m_aEntry.GetType() != STG_STORAGE )
 {
 pIo->SetError( SVSTREAM_FILE_NOT_FOUND );
+// coverity[overwrite_var] - ownership is not here, but with StgDirStrm
 p = nullptr;
 }
 


[Libreoffice-commits] core.git: sot/source

2022-06-03 Thread Stephan Bergmann (via logerrit)
 sot/source/sdstor/stgole.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit ae5b06e346ca01bfbc0370632750e5a7c6154e46
Author: Stephan Bergmann 
AuthorDate: Fri Jun 3 13:48:58 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 3 15:11:05 2022 +0200

Use o3tl::make_unsigned, nStrLen is known to be non-negative here

Change-Id: Ibb51c5b47edefe3f22a3d4335bc3136988c65486
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135355
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx
index bee4feb8842d..ac23f7a14555 100644
--- a/sot/source/sdstor/stgole.cxx
+++ b/sot/source/sdstor/stgole.cxx
@@ -22,6 +22,7 @@
 
 #include "stgelem.hxx"
 #include "stgole.hxx"
+#include 
 #include 
 
 / class StgInternalStream
@@ -116,7 +117,7 @@ bool StgCompObjStream::Load()
 
 std::unique_ptr p(new char[ nStrLen+1 ]);
 p[nStrLen] = 0;
-if (static_cast(ReadBytes( p.get(), nStrLen )) == 
nStrLen)
+if (ReadBytes( p.get(), nStrLen ) == o3tl::make_unsigned(nStrLen))
 {
 //The encoding here is "ANSI", which is pretty useless seeing 
as
 //the actual codepage used doesn't seem to be specified/stored


[Libreoffice-commits] core.git: sot/source

2022-05-19 Thread Noel Grandin (via logerrit)
 sot/source/sdstor/stgcache.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5cafa5a378bd18b7136aa178a267e3f5e386964a
Author: Noel Grandin 
AuthorDate: Thu May 19 09:29:43 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu May 19 15:37:42 2022 +0200

reserve vector in StgCache::Commit()

Change-Id: I7d1253c9c8bba5801f942cb79f63d56d26481c54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134601
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 2a7e9493f5bf..93f7d3090c93 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -206,6 +206,7 @@ bool StgCache::Commit()
 if ( Good() ) // otherwise Write does nothing
 {
 std::vector< StgPage * > aToWrite;
+aToWrite.reserve(maDirtyPages.size());
 for (const auto& rEntry : maDirtyPages)
 aToWrite.push_back( rEntry.second.get() );
 


[Libreoffice-commits] core.git: sot/source

2022-05-04 Thread Stephan Bergmann (via logerrit)
 sot/source/sdstor/storage.cxx|2 +-
 sot/source/sdstor/ucbstorage.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6d6b84db61eda9eb7d8d6a0b08c911af5927d38d
Author: Stephan Bergmann 
AuthorDate: Tue May 3 21:48:59 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 4 08:10:23 2022 +0200

Just use Any ctor instead of makeAny in sot

Change-Id: I43830efeb1671838317c5667f77c609a319a4aea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133776
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 0381aa477a9e..f1ff0455c0cb 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -678,7 +678,7 @@ SotStorage* SotStorage::OpenOLEStorage( const 
css::uno::Reference < css::embed::
 {
 uno::Reference < beans::XPropertySet > xStreamProps( xStream, 
uno::UNO_QUERY_THROW );
 xStreamProps->setPropertyValue( "MediaType",
-uno::makeAny( OUString(  
"application/vnd.sun.star.oleobject"  ) ) );
+uno::Any( OUString(  
"application/vnd.sun.star.oleobject"  ) ) );
 }
 
 pStream = utl::UcbStreamHelper::CreateStream( xStream );
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 3f35c0b95b20..f94556edbafc 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1996,7 +1996,7 @@ sal_Int16 UCBStorage_Impl::Commit()
 // first remove all open stream handles
 if (pContent && (!pElement->m_xStream.is() || 
pElement->m_xStream->Clear()))
 {
-pContent->executeCommand( "delete", makeAny( true 
) );
+pContent->executeCommand( "delete", Any( true ) );
 nRet = COMMIT_RESULT_SUCCESS;
 }
 else


[Libreoffice-commits] core.git: sot/source

2022-02-27 Thread Julien Nabet (via logerrit)
 sot/source/sdstor/stg.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit b457e8df493aa3ccd380eba481d6996ae342b931
Author: Julien Nabet 
AuthorDate: Sun Feb 27 14:27:18 2022 +0100
Commit: Julien Nabet 
CommitDate: Sun Feb 27 16:02:35 2022 +0100

cid#1500380: silence Resource leak

Change-Id: Ib938b921343359b91f42fc68d89bf9eda32132d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130626
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 3bf969f5150e..a874b199a856 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -625,6 +625,8 @@ BaseStorageStream* Storage::OpenStream( const OUString& 
rName, StreamMode m, boo
 }
 else if( !ValidateMode( m, p ) )
 p = nullptr;
+// coverity[Resource leak : FALSE] - "Create" method is called with 
STG_STREAM line 620,
+// so we won't enter into this "if" block here.
 if( p && p->m_aEntry.GetType() != STG_STREAM )
 {
 pIo->SetError( SVSTREAM_FILE_NOT_FOUND );


[Libreoffice-commits] core.git: sot/source vcl/source

2021-12-03 Thread Mike Kaganski (via logerrit)
 sot/source/base/exchange.cxx |2 -
 sot/source/base/formats.cxx  |8 ++---
 vcl/source/treelist/transfer.cxx |   56 ---
 3 files changed, 40 insertions(+), 26 deletions(-)

New commits:
commit f586839956d6937920aa377fe95854c1a0518d96
Author: Mike Kaganski 
AuthorDate: Fri Dec 3 11:51:03 2021 +0300
Commit: Mike Kaganski 
CommitDate: Fri Dec 3 12:01:39 2021 +0100

Windows format name is FileGroupDescriptorW for Unicode strings

See also commit 5fb9f4ffa9284c7248e2e82210506babaad4044d
tdf#145964: Windows format name is FileNameW for Unicode strings
and commit 52e1d0ca6ad38b4b4fdc77b0951ad26f0ac18ec5
Windows format name is UniformResourceLocatorW for Unicode strings

We don't use other standard clipboard formats which have W variants.

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

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 3138d89de0aa..582ca49c5598 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -141,7 +141,7 @@ const DataFlavorRepresentation* FormatArray_Impl()
 /* 86 SotClipboardFormatId::LINK_SOURCE*/{ 
"application/x-openoffice-link-source-xml;windows_formatname=\"Star Link Source 
(XML)\"", "Star Link Source (XML)", ::UnoType>::get() },
 /* 87 SotClipboardFormatId::EMBEDDED_OBJ*/   { 
"application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded 
Object (XML)\"", "Star Embedded Object (XML)", 
::UnoType>::get() },
 /* 88 SotClipboardFormatId::FILECONTENT*/{ 
"application/x-openoffice-filecontent;windows_formatname=\"FileContents\"", 
"FileContents", ::UnoType>::get() },
-/* 89 SotClipboardFormatId::FILEGRPDESCRIPTOR*/  { 
"application/x-openoffice-filegrpdescriptor;windows_formatname=\"FileGroupDescriptor\"",
 "FileGroupDescriptor", ::UnoType>::get() },
+/* 89 SotClipboardFormatId::FILEGRPDESCRIPTOR*/  { 
"application/x-openoffice-filegrpdescriptor;windows_formatname=\"FileGroupDescriptorW\"",
 "FileGroupDescriptor", ::UnoType>::get() },
 /* 90 SotClipboardFormatId::FILENAME*/   { 
"application/x-openoffice-filename;windows_formatname=\"FileNameW\"", 
"FileName", ::UnoType::get() },
 /* 91 SotClipboardFormatId::SD_OLE*/ { 
"application/x-openoffice-sd-ole;windows_formatname=\"SD-OLE\"", "SD-OLE", 
::UnoType>::get() },
 /* 92 SotClipboardFormatId::EMBEDDED_OBJ_OLE*/   { 
"application/x-openoffice-embedded-obj-ole;windows_formatname=\"Embedded 
Object\"", "Embedded Object", ::UnoType>::get() },
diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index 8901064d6901..0b3d80120022 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -23,7 +23,7 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
 #include 
 #include 
@@ -1359,12 +1359,12 @@ static bool CheckTransferableContext_Impl( const 
Reference< XTransferable >* pxT
 
 if( aSeq.getLength() )
 {
-FILEGROUPDESCRIPTOR const * pFDesc = 
reinterpret_cast(aSeq.getConstArray());
+FILEGROUPDESCRIPTORW const * pFDesc = 
reinterpret_cast(aSeq.getConstArray());
 
 if( pFDesc->cItems )
 {
-OString sDesc( pFDesc->fgd[ 0 ].cFileName 
);
-bRet = 4 < sDesc.getLength() && 
sDesc.copy(sDesc.getLength()-4).equalsIgnoreAsciiCase(".URL");
+OUString sDesc( o3tl::toU(pFDesc->fgd[ 0 
].cFileName) );
+bRet = 4 < sDesc.getLength() && 
sDesc.endsWithIgnoreAsciiCase(".URL");
 }
 }
 }
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 4561535d0291..260e3ba65613 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #endif
+#include 
 #include 
 #include 
 #include 
@@ -76,6 +77,7 @@ using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::datatransfer;
 using namespace ::com::sun::star::datatransfer::clipboard;
 using namespace ::com::sun::star::datatransfer::dnd;
+using namespace std::literals::string_view_literals;
 
 
 #define TOD_SIG1 0x01234567
@@ -797,23 +799,21 @@ bool TransferableHelper::SetINetBookmark( const 
INetBookmark& rBmk,
 #ifdef _WIN32
 case SotClipboardFormatId::FILEGRPDESCRIPTOR:
 {
-Sequence< sal_Int8 >aSeq( sizeof( FILEGROUPDESCRIPTOR ) );
-FILEGROUPDESCRIPTOR*pFDesc = 

[Libreoffice-commits] core.git: sot/source vcl/source vcl/win

2021-12-02 Thread Mike Kaganski (via logerrit)
 sot/source/base/exchange.cxx |2 +-
 vcl/source/treelist/transfer.cxx |   10 +-
 vcl/win/dtrans/ftransl.cxx   |5 +++--
 3 files changed, 5 insertions(+), 12 deletions(-)

New commits:
commit 52e1d0ca6ad38b4b4fdc77b0951ad26f0ac18ec5
Author: Mike Kaganski 
AuthorDate: Thu Dec 2 08:50:41 2021 +0300
Commit: Mike Kaganski 
CommitDate: Fri Dec 3 08:13:24 2021 +0100

Windows format name is UniformResourceLocatorW for Unicode strings

See also commit 5fb9f4ffa9284c7248e2e82210506babaad4044d
tdf#145964: Windows format name is FileNameW for Unicode strings

TODO: replace one remaining format from CFSTR_* family that we use (see
https://www.codeproject.com/Reference/1091137/Windows-Clipboard-Formats):
FileGroupDescriptor -> FileGroupDescriptorW. That one needs more complex
handling.

Change-Id: I4d4ad83099854768cf36c7b3d89059d79c8e77f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126213
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 2d26887557a6..3138d89de0aa 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -156,7 +156,7 @@ const DataFlavorRepresentation* FormatArray_Impl()
 /*101 SotClipboardFormatId::NETSCAPE_IMAGE*/ { 
"application/x-openoffice-netscape-image;windows_formatname=\"Netscape Image 
Format\"", "Netscape Image Format", ::UnoType>::get() },
 /*102 SotClipboardFormatId::SBA_FORMEXCHANGE*/   { 
"application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"",
 "SBA_FORMEXCHANGE", ::UnoType>::get() },
 /*103 SotClipboardFormatId::SBA_REPORTEXCHANGE*/ { 
"application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\"",
 "SBA_REPORTEXCHANGE", ::UnoType>::get() },
-/*104 SotClipboardFormatId::UNIFORMRESOURCELOCATOR*/ { 
"application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocator\"",
 "UniformResourceLocator", ::UnoType>::get() },
+/*104 SotClipboardFormatId::UNIFORMRESOURCELOCATOR*/ { 
"application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocatorW\"",
 "UniformResourceLocator", ::UnoType::get() },
 /*105 SotClipboardFormatId::STARCHARTDOCUMENT_50*/   { 
"application/x-openoffice-starchartdocument-50;windows_formatname=\"StarChartDocument
 5.0\"", "StarChartDocument 5.0", ::UnoType>::get() },
 /*106 SotClipboardFormatId::GRAPHOBJ*/   { 
"application/x-openoffice-graphobj;windows_formatname=\"Graphic Object\"", 
"Graphic Object", ::UnoType>::get() },
 /*107 SotClipboardFormatId::STARWRITER_60*/  { 
MIMETYPE_VND_SUN_XML_WRITER_ASCII, "Writer 6.0", 
::UnoType>::get() },
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index bb245767cb63..81c99653578f 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -777,18 +777,10 @@ bool TransferableHelper::SetINetBookmark( const 
INetBookmark& rBmk,
 break;
 
 case SotClipboardFormatId::STRING:
+case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
 maAny <<= rBmk.GetURL();
 break;
 
-case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
-{
-OString sURL(OUStringToOString(rBmk.GetURL(), eSysCSet));
-Sequence< sal_Int8 > aSeq( sURL.getLength() );
-memcpy( aSeq.getArray(), sURL.getStr(), sURL.getLength() );
-maAny <<= aSeq;
-}
-break;
-
 case SotClipboardFormatId::NETSCAPE_BOOKMARK:
 {
 Sequence< sal_Int8 > aSeq( 2048 );
diff --git a/vcl/win/dtrans/ftransl.cxx b/vcl/win/dtrans/ftransl.cxx
index 0fc4aa53f804..2d5ecd492754 100644
--- a/vcl/win/dtrans/ftransl.cxx
+++ b/vcl/win/dtrans/ftransl.cxx
@@ -302,10 +302,11 @@ const std::vector< FormatEntry > g_TranslTable {
 //SotClipboardFormatId::NETSCAPE_IMAGE
 
FormatEntry("application/x-openoffice-netscape-image;windows_formatname=\"Netscape
 Image Format\"", "Netscape Image Format", nullptr, CF_INVALID, 
CPPUTYPE_DEFAULT),
 //SotClipboardFormatId::SBA_FORMEXCHANGE
-
FormatEntry("application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"",
 "SBA_FORMEXCHANGE", nullptr, CF_INVALID, CPPUTYPE_DEFAULT),  
//SotClipboardFormatId::SBA_REPORTEXCHANGE
+
FormatEntry("application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"",
 "SBA_FORMEXCHANGE", nullptr, CF_INVALID, CPPUTYPE_DEFAULT),
+//SotClipboardFormatId::SBA_REPORTEXCHANGE
 
FormatEntry("application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\"",
 "SBA_REPORTEXCHANGE", nullptr, CF_INVALID, CPPUTYPE_DEFAULT),
 //SotClipboardFormatId::UNIFORMRESOURCELOCATOR
-

[Libreoffice-commits] core.git: sot/source vcl/win

2021-11-30 Thread Mike Kaganski (via logerrit)
 sot/source/base/exchange.cxx |4 ++--
 vcl/win/dtrans/ftransl.cxx   |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5fb9f4ffa9284c7248e2e82210506babaad4044d
Author: Mike Kaganski 
AuthorDate: Tue Nov 30 23:11:50 2021 +0200
Commit: Mike Kaganski 
CommitDate: Wed Dec 1 06:51:20 2021 +0100

tdf#145964: Windows format name is FileNameW for Unicode strings

Otherwise SIMPLE_FILE clipboard format arrives encoded in ACP,
and fails for any characters not representable in ACP.

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

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 18c5cd291f9a..2d26887557a6 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -57,7 +57,7 @@ const DataFlavorRepresentation* FormatArray_Impl()
 /*  2 SotClipboardFormatId::BITMAP*/   { 
"application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", "Bitmap", 
::UnoType>::get() },
 /*  3 SotClipboardFormatId::GDIMETAFILE*/  { 
"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"", 
"GDIMetaFile", ::UnoType>::get() },
 /*  4 SotClipboardFormatId::PRIVATE*/  { 
"application/x-openoffice-private;windows_formatname=\"Private\"", "Private", 
::UnoType>::get() },
-/*  5 SotClipboardFormatId::SIMPLE_FILE*/ { 
"application/x-openoffice-file;windows_formatname=\"FileName\"", "FileName", 
::UnoType>::get() },
+/*  5 SotClipboardFormatId::SIMPLE_FILE*/ { 
"application/x-openoffice-file;windows_formatname=\"FileNameW\"", "FileName", 
::UnoType::get() },
 /*  6 SotClipboardFormatId::FILE_LIST*/{ 
"application/x-openoffice-filelist;windows_formatname=\"FileList\"", 
"FileList", ::UnoType>::get() },
 /*  7 EMPTY*/   { "", "", 
::UnoType>::get() },
 /*  8 EMPTY*/   { "", "", 
::UnoType>::get() },
@@ -142,7 +142,7 @@ const DataFlavorRepresentation* FormatArray_Impl()
 /* 87 SotClipboardFormatId::EMBEDDED_OBJ*/   { 
"application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded 
Object (XML)\"", "Star Embedded Object (XML)", 
::UnoType>::get() },
 /* 88 SotClipboardFormatId::FILECONTENT*/{ 
"application/x-openoffice-filecontent;windows_formatname=\"FileContents\"", 
"FileContents", ::UnoType>::get() },
 /* 89 SotClipboardFormatId::FILEGRPDESCRIPTOR*/  { 
"application/x-openoffice-filegrpdescriptor;windows_formatname=\"FileGroupDescriptor\"",
 "FileGroupDescriptor", ::UnoType>::get() },
-/* 90 SotClipboardFormatId::FILENAME*/   { 
"application/x-openoffice-filename;windows_formatname=\"FileName\"", 
"FileName", ::UnoType>::get() },
+/* 90 SotClipboardFormatId::FILENAME*/   { 
"application/x-openoffice-filename;windows_formatname=\"FileNameW\"", 
"FileName", ::UnoType::get() },
 /* 91 SotClipboardFormatId::SD_OLE*/ { 
"application/x-openoffice-sd-ole;windows_formatname=\"SD-OLE\"", "SD-OLE", 
::UnoType>::get() },
 /* 92 SotClipboardFormatId::EMBEDDED_OBJ_OLE*/   { 
"application/x-openoffice-embedded-obj-ole;windows_formatname=\"Embedded 
Object\"", "Embedded Object", ::UnoType>::get() },
 /* 93 SotClipboardFormatId::EMBED_SOURCE_OLE*/   { 
"application/x-openoffice-embed-source-ole;windows_formatname=\"Embed 
Source\"", "Embed Source", ::UnoType>::get() },
diff --git a/vcl/win/dtrans/ftransl.cxx b/vcl/win/dtrans/ftransl.cxx
index ea3735832e93..0fc4aa53f804 100644
--- a/vcl/win/dtrans/ftransl.cxx
+++ b/vcl/win/dtrans/ftransl.cxx
@@ -118,7 +118,7 @@ const std::vector< FormatEntry > g_TranslTable {
 // SotClipboardFormatId::PRIVATE
 
FormatEntry("application/x-openoffice-private;windows_formatname=\"Private\"", 
"Private", nullptr, CF_INVALID, CPPUTYPE_DEFAULT),
 // SotClipboardFormatId::SIMPLE_FILE
-
FormatEntry("application/x-openoffice-file;windows_formatname=\"FileName\"", 
"FileName", nullptr, CF_INVALID, CPPUTYPE_DEFAULT),
+
FormatEntry("application/x-openoffice-file;windows_formatname=\"FileNameW\"", 
"FileName", nullptr, CF_INVALID, CppuType_String),
 // SotClipboardFormatId::RTF
 FormatEntry("text/rtf", "Rich Text Format", nullptr, CF_INVALID, 
CPPUTYPE_DEFAULT),
 // SotClipboardFormatId::DRAWING


[Libreoffice-commits] core.git: sot/source starmath/source stoc/source store/source svgio/source

2021-09-02 Thread Noel Grandin (via logerrit)
 sot/source/sdstor/stgdir.cxx   |4 ++--
 sot/source/sdstor/stgio.cxx|2 +-
 sot/source/sdstor/ucbstorage.cxx   |3 ---
 starmath/source/cfgitem.cxx|4 
 starmath/source/node.cxx   |1 -
 starmath/source/parse5.cxx |3 +--
 stoc/source/corereflection/crefl.cxx   |1 -
 store/source/lockbyte.cxx  |4 ++--
 store/source/stordir.cxx   |3 +--
 store/source/storlckb.cxx  |4 +---
 svgio/source/svgreader/svgcharacternode.cxx|   11 +--
 svgio/source/svgreader/svgdocument.cxx |5 +
 svgio/source/svgreader/svgdocumenthandler.cxx  |1 -
 svgio/source/svgreader/svggradientnode.cxx |   10 --
 svgio/source/svgreader/svggradientstopnode.cxx |3 +--
 svgio/source/svgreader/svgimagenode.cxx|7 +--
 svgio/source/svgreader/svgmarkernode.cxx   |2 --
 svgio/source/svgreader/svgnode.cxx |2 --
 svgio/source/svgreader/svgpathnode.cxx |3 +--
 svgio/source/svgreader/svgpatternnode.cxx  |7 ---
 svgio/source/svgreader/svgstyleattributes.cxx  |   20 
 svgio/source/svgreader/svgstylenode.cxx|1 -
 svgio/source/svgreader/svgsvgnode.cxx  |6 --
 svgio/source/svgreader/svgsymbolnode.cxx   |3 +--
 svgio/source/svgreader/svgtextnode.cxx |3 +--
 svgio/source/svgreader/svgtextpathnode.cxx |5 +
 svgio/source/svgreader/svgtitledescnode.cxx|3 +--
 svgio/source/svgreader/svgtrefnode.cxx |3 +--
 svgio/source/svgreader/svgtspannode.cxx|3 +--
 svgio/source/svgreader/svgusenode.cxx  |5 -
 30 files changed, 19 insertions(+), 113 deletions(-)

New commits:
commit b1af7083b469eec48783b7a1aaff6d080901fc7f
Author: Noel Grandin 
AuthorDate: Thu Sep 2 09:16:09 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 2 13:05:05 2021 +0200

clang-tidy:readability-redundant-member-init

Change-Id: I39b9ac81d65f4a269293824642c1b2ec593c0584
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121490
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index 312b07870952..b12feb594482 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -45,14 +45,14 @@
 // Problem of implementation: No hierarchical commits. Therefore only
 // overall transaction-oriented or direct.
 
-StgDirEntry::StgDirEntry( const void* pBuffer, sal_uInt32 nBufferLen, 
sal_uInt64 nUnderlyingStreamSize, bool * pbOk ) : StgAvlNode()
+StgDirEntry::StgDirEntry( const void* pBuffer, sal_uInt32 nBufferLen, 
sal_uInt64 nUnderlyingStreamSize, bool * pbOk )
 {
 *pbOk = m_aEntry.Load( pBuffer, nBufferLen, nUnderlyingStreamSize );
 
 InitMembers();
 }
 
-StgDirEntry::StgDirEntry( const StgEntry& r ) : StgAvlNode(), m_aEntry( r )
+StgDirEntry::StgDirEntry( const StgEntry& r ) :  m_aEntry( r )
 {
 InitMembers();
 }
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index 304be0e35d92..604d082828f7 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -33,7 +33,7 @@
 
 // This class holds the storage header and all internal streams.
 
-StgIo::StgIo() : StgCache()
+StgIo::StgIo()
 {
 m_pTOC  = nullptr;
 m_pDataFAT  = nullptr;
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 09b435550feb..6a14ce1dc4e1 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1440,7 +1440,6 @@ UCBStorage_Impl::UCBStorage_Impl( const 
::ucbhelper::Content& rContent, const OU
 , m_bIsLinked( true )
 , m_bListCreated( false )
 , m_nFormat( SotClipboardFormatId::NONE )
-, m_aClassId( SvGlobalName() )
 , m_bRepairPackage( bIsRepair )
 , m_xProgressHandler( xProgressHandler )
 {
@@ -1469,7 +1468,6 @@ UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, 
StreamMode nMode, UCBSt
 , m_bIsLinked( false )
 , m_bListCreated( false )
 , m_nFormat( SotClipboardFormatId::NONE )
-, m_aClassId( SvGlobalName() )
 , m_bRepairPackage( bIsRepair )
 , m_xProgressHandler( xProgressHandler )
 {
@@ -1515,7 +1513,6 @@ UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, 
UCBStorage* pStorage, bool
 , m_bIsLinked( false )
 , m_bListCreated( false )
 , m_nFormat( SotClipboardFormatId::NONE )
-, m_aClassId( SvGlobalName() )
 , m_bRepairPackage( false )
 {
 // opening in direct mode is too fuzzy because the data is transferred to 
the stream in the Commit() call,
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index ce765f09a7d7..814e4101ed29 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -340,10 +340,6 @@ OUString 

[Libreoffice-commits] core.git: sot/source

2021-08-01 Thread Noel Grandin (via logerrit)
 sot/source/sdstor/ucbstorage.cxx |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 983d0898b25f195258bb4934a62ae196d436fb0a
Author: Noel Grandin 
AuthorDate: Sun Aug 1 18:51:22 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 22:36:31 2021 +0200

osl::Mutex->std::mutex in FileStreamWrapper_Impl

Change-Id: Id4488b7722c9cf14157ed9333a0eb74de96834d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119830
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 31db79361f5c..cf75b1cf63cf 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -62,6 +62,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 namespace com::sun::star::ucb { class XCommandEnvironment; }
@@ -86,7 +87,7 @@ namespace {
 class FileStreamWrapper_Impl : public FileInputStreamWrapper_Base
 {
 protected:
-::osl::Mutexm_aMutex;
+std::mutexm_aMutex;
 OUStringm_aURL;
 std::unique_ptr m_pSvStream;
 
@@ -145,7 +146,7 @@ sal_Int32 SAL_CALL 
FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData
 if (nBytesToRead < 0)
 throw 
BufferSizeExceededException(OUString(),static_cast(this));
 
-::osl::MutexGuard aGuard( m_aMutex );
+std::lock_guard aGuard( m_aMutex );
 
 if (aData.getLength() < nBytesToRead)
 aData.realloc(nBytesToRead);
@@ -189,7 +190,7 @@ void SAL_CALL FileStreamWrapper_Impl::skipBytes(sal_Int32 
nBytesToSkip)
 if ( m_aURL.isEmpty() )
 return;
 
-::osl::MutexGuard aGuard( m_aMutex );
+std::lock_guard aGuard( m_aMutex );
 checkError();
 
 m_pSvStream->SeekRel(nBytesToSkip);
@@ -202,7 +203,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::available()
 if ( m_aURL.isEmpty() )
 return 0;
 
-::osl::MutexGuard aGuard( m_aMutex );
+std::lock_guard aGuard( m_aMutex );
 checkConnected();
 
 sal_Int64 nAvailable = m_pSvStream->remainingSize();
@@ -217,7 +218,7 @@ void SAL_CALL FileStreamWrapper_Impl::closeInput()
 if ( m_aURL.isEmpty() )
 return;
 
-::osl::MutexGuard aGuard( m_aMutex );
+std::lock_guard aGuard( m_aMutex );
 checkConnected();
 m_pSvStream.reset();
 #if OSL_DEBUG_LEVEL > 0
@@ -233,7 +234,7 @@ void SAL_CALL FileStreamWrapper_Impl::seek( sal_Int64 
_nLocation )
 if ( m_aURL.isEmpty() )
 return;
 
-::osl::MutexGuard aGuard( m_aMutex );
+std::lock_guard aGuard( m_aMutex );
 checkConnected();
 
 m_pSvStream->Seek(static_cast(_nLocation));
@@ -246,7 +247,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getPosition(  )
 if ( m_aURL.isEmpty() )
 return 0;
 
-::osl::MutexGuard aGuard( m_aMutex );
+std::lock_guard aGuard( m_aMutex );
 checkConnected();
 
 sal_uInt32 nPos = m_pSvStream->Tell();
@@ -260,7 +261,7 @@ sal_Int64 SAL_CALL FileStreamWrapper_Impl::getLength(  )
 if ( m_aURL.isEmpty() )
 return 0;
 
-::osl::MutexGuard aGuard( m_aMutex );
+std::lock_guard aGuard( m_aMutex );
 checkConnected();
 
 checkError();


[Libreoffice-commits] core.git: sot/source stoc/test svl/source svtools/source svx/source

2021-06-10 Thread Julien Nabet (via logerrit)
 sot/source/sdstor/ucbstorage.cxx   |   10 +---
 stoc/test/testregistry.cxx |7 -
 svl/source/passwordcontainer/passwordcontainer.cxx |   26 -
 svtools/source/control/inettbc.cxx |   15 +---
 svx/source/accessibility/charmapacc.cxx|8 +-
 svx/source/fmcomp/gridcell.cxx |   15 
 svx/source/form/formcontroller.cxx |   13 +-
 svx/source/xml/xmleohlp.cxx|2 -
 8 files changed, 25 insertions(+), 71 deletions(-)

New commits:
commit 159030991c70fc3c4018ef28abf1814902a0aebb
Author: Julien Nabet 
AuthorDate: Wed Jun 9 23:17:41 2021 +0200
Commit: Julien Nabet 
CommitDate: Thu Jun 10 08:30:12 2021 +0200

Simplify Sequences initializations (sot/stock/svl/svtools/svx)

Change-Id: Iec21851d69f4a8d5f557e9ed2d30e5f680cd62c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116943
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 162748e5b5d2..460b3c650fe3 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1670,20 +1670,14 @@ void UCBStorage_Impl::ReadContent()
 
 m_bListCreated = true;
 
-// create cursor for access to children
-Sequence< OUString > aProps(4);
-aProps[0] = "Title";
-aProps[1] = "IsFolder";
-aProps[2] = "MediaType";
-aProps[3] = "Size";
-
 try
 {
 GetContent();
 if ( !m_pContent )
 return;
 
-Reference< XResultSet > xResultSet = m_pContent->createCursor( aProps, 
::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS );
+// create cursor for access to children
+Reference< XResultSet > xResultSet = m_pContent->createCursor( { 
"Title", "IsFolder", "MediaType", "Size" }, 
::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS );
 Reference< XRow > xRow( xResultSet, UNO_QUERY );
 if ( xResultSet.is() )
 {
diff --git a/stoc/test/testregistry.cxx b/stoc/test/testregistry.cxx
index d81328ac6f37..ef0d0a91d551 100644
--- a/stoc/test/testregistry.cxx
+++ b/stoc/test/testregistry.cxx
@@ -513,12 +513,7 @@ void test_DefaultRegistry(
 OSL_ENSURE( seqValue.getArray()[2] == "come",
   "test_DefaultRegistry error 13" );
 
-Sequence seqLong(3);
-seqLong.getArray()[0] = 1234;
-seqLong.getArray()[1] = 4567;
-seqLong.getArray()[2] = 7890;
-
-xKey->setLongListValue(seqLong);
+xKey->setLongListValue({ 1234, 4567, 7890 });
 
 Sequence seqLongValue = xKey->getLongListValue();
 
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx 
b/svl/source/passwordcontainer/passwordcontainer.cxx
index 596a6e413db3..99f94c5eb809 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -231,15 +231,11 @@ PassMap StorageItem::getInfo()
 
 void StorageItem::setUseStorage( bool bUse )
 {
-Sequence< OUString > sendNames(1);
 Sequence< uno::Any > sendVals(1);
-
-sendNames[0] = "UseStorage";
-
 sendVals[0] <<= bUse;
 
 ConfigItem::SetModified();
-ConfigItem::PutProperties( sendNames, sendVals );
+ConfigItem::PutProperties( { "UseStorage" }, sendVals );
 }
 
 
@@ -293,18 +289,14 @@ bool StorageItem::getEncodedMP( OUString& aResult )
 
 void StorageItem::setEncodedMP( const OUString& aEncoded, bool bAcceptEmpty )
 {
-Sequence< OUString > sendNames(2);
 Sequence< uno::Any > sendVals(2);
 
-sendNames[0] = "HasMaster";
-sendNames[1] = "Master";
-
 bool bHasMaster = ( !aEncoded.isEmpty() || bAcceptEmpty );
 sendVals[0] <<= bHasMaster;
 sendVals[1] <<= aEncoded;
 
 ConfigItem::SetModified();
-ConfigItem::PutProperties( sendNames, sendVals );
+ConfigItem::PutProperties( { "HasMaster", "Master" }, sendVals );
 
 hasEncoded = bHasMaster;
 mEncoded = aEncoded;
@@ -313,13 +305,8 @@ void StorageItem::setEncodedMP( const OUString& aEncoded, 
bool bAcceptEmpty )
 
 void StorageItem::remove( const OUString& aURL, const OUString& aName )
 {
-std::vector < OUString > forIndex;
-forIndex.push_back( aURL );
-forIndex.push_back( aName );
-
-Sequence< OUString > sendSeq(1);
-
-sendSeq[0] = createIndex( forIndex );
+std::vector < OUString > forIndex { aURL, aName };
+Sequence< OUString > sendSeq { createIndex( forIndex ) };
 
 ConfigItem::ClearNodeElements( "Store", sendSeq );
 }
@@ -673,18 +660,15 @@ UrlRecord SAL_CALL PasswordContainer::findForName( const 
OUString& aURL, const O
 
 Sequence< UserRecord > PasswordContainer::FindUsr( const std::vector< 
NamePassRecord >& userlist, std::u16string_view aName, const Reference< 
XInteractionHandler >& aHandler )
 {
-sal_uInt32 nInd = 0;
 for (auto const& aNPIter : userlist)
 {
  

[Libreoffice-commits] core.git: sot/source

2021-03-18 Thread Miklos Vajna (via logerrit)
 sot/source/base/formats.cxx |   14 --
 1 file changed, 14 deletions(-)

New commits:
commit c08271500f6a13e80f739e2609b86ca8351f681e
Author: Miklos Vajna 
AuthorDate: Wed Mar 17 21:04:16 2021 +0100
Commit: Miklos Vajna 
CommitDate: Thu Mar 18 09:07:30 2021 +0100

sot: clean up not needed HAVE_FEATURE_PDFIUM ifdefs

Now that pdfium is an impl detail of vcl, sot can just assume pdfium is
always there. If the build disabled pdfium (which would lead to e.g.
broken pdf signatures, so it's more just a debug option), then we can
still call into the pdf import filter, it will just fail.

Towards completely avoiding the HAVE_FEATURE_PDFIUM ifdef forest.

Change-Id: I6479644d97c48161bb01e2a7dc5b865adeaebfa1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112657
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index ac1f5e5c550d..8901064d6901 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
 #include 
 #include 
 #include 
@@ -335,9 +333,7 @@ SotAction_Impl const aEXCHG_DEST_DOC_GRAPHOBJ_Def[] =
 {
 { SotClipboardFormatId::GDIMETAFILE, EXCHG_IN_ACTION_COPY },
 { SotClipboardFormatId::DRAWING, EXCHG_IN_ACTION_COPY },
-#if HAVE_FEATURE_PDFIUM
 { SotClipboardFormatId::PDF, EXCHG_IN_ACTION_COPY },
-#endif
 { SotClipboardFormatId::PNG, EXCHG_IN_ACTION_COPY },
 { SotClipboardFormatId::JPEG, EXCHG_IN_ACTION_COPY },
 { SotClipboardFormatId::BITMAP, EXCHG_IN_ACTION_COPY },
@@ -358,9 +354,7 @@ SotAction_Impl const aEXCHG_DEST_DOC_GRAPHOBJ_Move[] =
 { SotClipboardFormatId::DRAWING, EXCHG_OUT_ACTION_REPLACE_DRAWOBJ, 
SotExchangeActionFlags::InsertImageMap  | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::SVXB, EXCHG_OUT_ACTION_REPLACE_SVXB, 
SotExchangeActionFlags::InsertImageMap  | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::GDIMETAFILE, EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE, 
SotExchangeActionFlags::InsertImageMap  | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
-#if HAVE_FEATURE_PDFIUM
 { SotClipboardFormatId::PDF, EXCHG_OUT_ACTION_INSERT_GRAPH, 
SotExchangeActionFlags::InsertImageMap  | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
-#endif
 { SotClipboardFormatId::PNG, EXCHG_OUT_ACTION_REPLACE_BITMAP, 
SotExchangeActionFlags::InsertImageMap  | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::JPEG, EXCHG_OUT_ACTION_REPLACE_BITMAP, 
SotExchangeActionFlags::InsertImageMap  | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::BITMAP, EXCHG_OUT_ACTION_REPLACE_BITMAP, 
SotExchangeActionFlags::InsertImageMap  | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
@@ -376,9 +370,7 @@ SotAction_Impl const aEXCHG_DEST_DOC_GRAPHOBJ_Copy[] =
 { SotClipboardFormatId::DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::SVXB, EXCHG_OUT_ACTION_INSERT_SVXB, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
-#if HAVE_FEATURE_PDFIUM
 { SotClipboardFormatId::PDF, EXCHG_OUT_ACTION_INSERT_GRAPH, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
-#endif
 { SotClipboardFormatId::PNG, EXCHG_OUT_ACTION_INSERT_BITMAP, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::JPEG, EXCHG_OUT_ACTION_INSERT_BITMAP, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
@@ -836,9 +828,7 @@ SotAction_Impl const aEXCHG_DEST_SWDOC_FREE_AREA_Def[] =
 { SotClipboardFormatId::DRAWING, EXCHG_IN_ACTION_COPY },
 { SotClipboardFormatId::SVXB, EXCHG_IN_ACTION_COPY },
 { SotClipboardFormatId::GDIMETAFILE, EXCHG_IN_ACTION_COPY },
-#if HAVE_FEATURE_PDFIUM
 { SotClipboardFormatId::PDF, EXCHG_IN_ACTION_COPY },
-#endif
 { SotClipboardFormatId::PNG, EXCHG_IN_ACTION_COPY },
 { SotClipboardFormatId::JPEG, EXCHG_IN_ACTION_COPY },
 { SotClipboardFormatId::BITMAP, EXCHG_IN_ACTION_COPY },
@@ -869,9 +859,7 @@ SotAction_Impl const aEXCHG_DEST_SWDOC_FREE_AREA_Move[] =
 { SotClipboardFormatId::RICHTEXT, EXCHG_IN_ACTION_COPY, 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::STRING, EXCHG_OUT_ACTION_INSERT_STRING },
 { SotClipboardFormatId::GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE, 

[Libreoffice-commits] core.git: sot/source

2021-02-20 Thread Noel (via logerrit)
 sot/source/sdstor/ucbstorage.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 85a74ebd929d6396daf591a01f7975fd7e4f
Author: Noel 
AuthorDate: Sat Feb 20 12:49:59 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Feb 20 17:48:23 2021 +0100

loplugin:refcounting in sot

Change-Id: I29d50f536779c28570c8920ad34d0770934af0c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111261
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index ee6576c6b87c..bb936124a2ff 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1577,18 +1577,17 @@ void UCBStorage_Impl::Init()
 {
 if ( !pStream->GetError() )
 {
-::utl::OInputStreamWrapper* pHelper = new 
::utl::OInputStreamWrapper( *pStream );
-css::uno::Reference < css::io::XInputStream > 
xInputStream( pHelper );
+rtl::Reference<::utl::OInputStreamWrapper> pHelper 
= new ::utl::OInputStreamWrapper( *pStream );
 
 // create a manifest reader object that will read 
in the manifest from the stream
 Reference < 
css::packages::manifest::XManifestReader > xReader =
 
css::packages::manifest::ManifestReader::create(
 ::comphelper::getProcessComponentContext() 
) ;
-Sequence < Sequence < PropertyValue > > aProps = 
xReader->readManifestSequence( xInputStream );
+Sequence < Sequence < PropertyValue > > aProps = 
xReader->readManifestSequence( pHelper );
 
 // cleanup
 xReader = nullptr;
-xInputStream = nullptr;
+pHelper = nullptr;
 SetProps( aProps, OUString() );
 }
 }
@@ -2125,8 +2124,7 @@ sal_Int16 UCBStorage_Impl::Commit()
 
 // get the stream from the temp file and create an 
output stream wrapper
 SvStream* pStream = pTempFile->GetStream( 
StreamMode::STD_READWRITE );
-::utl::OOutputStreamWrapper* pHelper = new 
::utl::OOutputStreamWrapper( *pStream );
-css::uno::Reference < css::io::XOutputStream > 
xOutputStream( pHelper );
+rtl::Reference<::utl::OOutputStreamWrapper> 
xOutputStream = new ::utl::OOutputStreamWrapper( *pStream );
 
 // create a manifest writer object that will fill 
the stream
 Reference < 
css::packages::manifest::XManifestWriter > xWriter =
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2021-01-14 Thread Tor Lillqvist (via logerrit)
 sot/source/base/exchange.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit ba1cd4964259221549f3671f89a701e67d7deb71
Author: Tor Lillqvist 
AuthorDate: Thu Jan 14 02:57:35 2021 +0200
Commit: Tor Lillqvist 
CommitDate: Thu Jan 14 18:07:59 2021 +0100

Make SotExchange::GetFormat() accept a MIME type with additional parameters

For instance, if SotExchange::GetFormat() is passed a flavor with MIME
type
"application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star
Object Descriptor (XML)\";typename=\"LibreOffice 7.2 Spreadsheet\"" we
do want to recognize it as SotClipboardFormatId::OBJECTDESCRIPTOR,
even if the MIME type in the entry for it in the array in
ImplFormatArray_Impl only has the windows_formatname parameter.

This is part of fixing
https://github.com/CollaboraOnline/online/issues/849, but it will help
for corresponding problems with LibreOffice on macOS, too.

Note that on Linux, SotExchange::GetFormat() gets called with a flavor
with a MIME type that does *not* have all the extra parameters
(classname, typename, displayname, viewaspect, width, height, posx,
posy) (See the GitHub issue mentioned above.) This change does not
remove any checks for classname, typename, etc. There are/were no such
checks in SotExchange::GetFormat().

But, in the (much different) code path for macOS (and iOS), with my
work in process in vcl, SotExchange::GetFormat() gets called with a
flavor with a MIME type that *does* contain those extra parameters. I
don't see the point in introducing checks of the "sanity" of those
into SotExchange::GetFormat().

Change-Id: Ie65ed1ab922cdaa6557eb65d980b9e886d3c6971
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109254
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index ff7b8add31bd..84a2427d334b 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -439,10 +439,16 @@ SotClipboardFormatId SotExchange::GetFormat( const 
DataFlavor& rFlavor )
 // only into 5.1 chart documents - in 5.0 and 5.2 it was 42 ("StarChart 
5.0")
 // The registry only contains the entry for the 42 format id.
 for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i <= 
SotClipboardFormatId::USER_END;  ++i )
-if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast(i) 
].pMimeType ) )
+{
+const char* const pFormatMimeType = pFormatArray_Impl[ 
static_cast(i) ].pMimeType;
+const sal_Int32 nFormatMimeTypeLen = rtl_str_getLength( 
pFormatMimeType );
+if( rMimeType.startsWithAsciiL( pFormatMimeType, nFormatMimeTypeLen ) 
&&
+( rMimeType.getLength() == nFormatMimeTypeLen ||
+  rMimeType[ nFormatMimeTypeLen ] == ';' ) )
 return ( (i == SotClipboardFormatId::STARCHARTDOCUMENT_50)
  ? SotClipboardFormatId::STARCHART_50
  : i );
+}
 
 // then in the dynamic list
 tDataFlavorList& rL = InitFormats_Impl();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2021-01-14 Thread Noel Grandin (via logerrit)
 sot/source/base/exchange.cxx |   55 +--
 1 file changed, 23 insertions(+), 32 deletions(-)

New commits:
commit 52db69ed08a011c16673bc6d45834347e83a5bbf
Author: Noel Grandin 
AuthorDate: Wed Jan 13 14:31:00 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Jan 14 11:18:42 2021 +0100

flatten formats data in SotStorage

there is no need for all this indirection.

Change-Id: Ie44723b54313b1103fe33a00ed014e2b28a59638
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109225
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 4888a366ec71..ff7b8add31bd 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -213,22 +213,14 @@ struct DataFlavorRepresentation
 const DataFlavorRepresentation, ImplFormatArray_Impl > {};
 
 
-typedef std::vector> 
tDataFlavorList;
+typedef std::vector tDataFlavorList;
 
-struct SotData_Impl
-{
-std::unique_ptr pDataFlavorList;
-};
-
-struct ImplData : public rtl::Static {};
+struct ImplData : public rtl::Static {};
 }
 
 static tDataFlavorList& InitFormats_Impl()
 {
-SotData_Impl *pSotData = ::get();
-if( !pSotData->pDataFlavorList )
-pSotData->pDataFlavorList.reset(new tDataFlavorList);
-return *pSotData->pDataFlavorList;
+return ImplData::get();
 }
 
 /*
@@ -258,17 +250,17 @@ SotClipboardFormatId SotExchange::RegisterFormatName( 
const OUString& rName )
 tDataFlavorList& rL = InitFormats_Impl();
 for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ )
 {
-auto const& pFlavor = rL[ i ];
-if( pFlavor && rName == pFlavor->HumanPresentableName )
+auto const& rFlavor = rL[ i ];
+if( rName == rFlavor.HumanPresentableName )
 return static_cast(i + 
static_cast(SotClipboardFormatId::USER_END) + 1);
 }
 
-std::unique_ptr pNewFlavor(new DataFlavor);
-pNewFlavor->MimeType = rName;
-pNewFlavor->HumanPresentableName = rName;
-pNewFlavor->DataType = cppu::UnoType::get();
+DataFlavor aNewFlavor;
+aNewFlavor.MimeType = rName;
+aNewFlavor.HumanPresentableName = rName;
+aNewFlavor.DataType = cppu::UnoType::get();
 
-rL.push_back( std::move(pNewFlavor) );
+rL.push_back( std::move(aNewFlavor) );
 
 return static_cast(static_cast(rL.size()-1) + 
static_cast(SotClipboardFormatId::USER_END) + 1);
 }
@@ -289,17 +281,17 @@ SotClipboardFormatId SotExchange::RegisterFormatMimeType( 
const OUString& rMimeT
 tDataFlavorList& rL = InitFormats_Impl();
 for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ )
 {
-auto const& pFlavor = rL[ i ];
-if( pFlavor && rMimeType == pFlavor->MimeType )
+auto const& rFlavor = rL[ i ];
+if( rMimeType == rFlavor.MimeType )
 return static_cast(i + 
static_cast(SotClipboardFormatId::USER_END) + 1);
 }
 
-std::unique_ptr pNewFlavor(new DataFlavor);
-pNewFlavor->MimeType = rMimeType;
-pNewFlavor->HumanPresentableName = rMimeType;
-pNewFlavor->DataType = cppu::UnoType::get();
+DataFlavor aNewFlavor;
+aNewFlavor.MimeType = rMimeType;
+aNewFlavor.HumanPresentableName = rMimeType;
+aNewFlavor.DataType = cppu::UnoType::get();
 
-rL.push_back( std::move(pNewFlavor) );
+rL.push_back( std::move(aNewFlavor) );
 
 return static_cast(static_cast(rL.size()-1) + 
static_cast(SotClipboardFormatId::USER_END) + 1);
 }
@@ -318,7 +310,7 @@ SotClipboardFormatId SotExchange::RegisterFormat( const 
DataFlavor& rFlavor )
 {
 tDataFlavorList& rL = InitFormats_Impl();
 nRet = static_cast(rL.size() + 
static_cast(SotClipboardFormatId::USER_END) + 1);
-rL.emplace_back( new DataFlavor( rFlavor ) );
+rL.emplace_back( rFlavor );
 }
 
 return nRet;
@@ -351,7 +343,7 @@ bool SotExchange::GetFormatDataFlavor( SotClipboardFormatId 
nFormat, DataFlavor&
 
 if( rL.size() > i )
 {
-rFlavor = *rL[ i ];
+rFlavor = rL[ i ];
 bRet = true;
 }
 else
@@ -384,7 +376,7 @@ OUString SotExchange::GetFormatMimeType( 
SotClipboardFormatId nFormat )
 unsigned i = static_cast(nFormat) - 
static_cast(SotClipboardFormatId::USER_END) - 1;
 
 if( rL.size() > i )
-sMimeType = rL[ i ]->MimeType;
+sMimeType = rL[ i ].MimeType;
 }
 
 DBG_ASSERT( !sMimeType.isEmpty(), "SotExchange::GetFormatMimeType(): 
DataFlavor not initialized" );
@@ -419,8 +411,8 @@ SotClipboardFormatId SotExchange::GetFormatIdFromMimeType( 
const OUString& rMime
 
 for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ )
 {
-auto const& pFlavor = rL[ i ];
-if( pFlavor && rMimeType == pFlavor->MimeType )
+auto const& rFlavor = rL[ i ];
+if( 

[Libreoffice-commits] core.git: sot/source

2020-12-22 Thread Caolán McNamara (via logerrit)
 sot/source/sdstor/stgelem.cxx |4 ++--
 sot/source/sdstor/stgio.cxx   |   12 +++-
 2 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 974ffa79b0fef4ca76558bb8b16bce84af3aaf6c
Author: Caolán McNamara 
AuthorDate: Tue Dec 22 10:09:17 2020 +
Commit: Caolán McNamara 
CommitDate: Tue Dec 22 13:20:20 2020 +0100

oss-fuzz: xlsxfuzzer doesn't pass sanity check

Step #5: #6 0xc1f47cf in __cxa_throw (/tmp/not-out/xlsxfuzzer+0xc1f47cf)
Step #5: #7 0x4602309 in SvStream::ReadUInt32(unsigned int&) 
(/tmp/not-out/xlsxfuzzer+0x4602309)
Step #5: #8 0x33d288f in ReadClsId(SvStream&, SvGUID&) 
(/tmp/not-out/xlsxfuzzer+0x33d288f)
Step #5: #9 0x33d328d in StgHeader::Load(SvStream&) 
(/tmp/not-out/xlsxfuzzer+0x33d328d)
Step #5: #10 0x33d3204 in StgHeader::Load(StgIo&) 
(/tmp/not-out/xlsxfuzzer+0x33d3204)
Step #5: #11 0x33d5d8d in StgIo::Load() 
(/tmp/not-out/xlsxfuzzer+0x33d5d8d)
Step #5: #12 0x33b2e01 in Storage::Init(bool) 
(/tmp/not-out/xlsxfuzzer+0x33b2e01)
Step #5: #13 0x33b33c8 in Storage::Storage(SvStream&, bool) 
(/tmp/not-out/xlsxfuzzer+0x33b33c8)
Step #5: #14 0x9b3d5b1 in 
OLESimpleStorage::OLESimpleStorage(com::sun::star::uno::Reference
 const&,

Change-Id: Ibc03107373f5558f47894fffc34169218e4aff12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108151
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index ff41d8d70f9c..3b946f4c77b4 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -126,9 +126,9 @@ bool StgHeader::Load( SvStream& r )
 {
 r.Seek( 0 );
 r.ReadBytes( m_cSignature, 8 );
-ReadClsId( r, m_aClsId ); // 08 Class ID
+ReadClsId( r, m_aClsId );   // 08 Class ID
 r.ReadInt32( m_nVersion )   // 1A version number
- .ReadUInt16( m_nByteOrder ) // 1C Unicode byte order 
indicator
+ .ReadUInt16( m_nByteOrder )// 1C Unicode byte order 
indicator
  .ReadInt16( m_nPageSize )  // 1E 1 << nPageSize = block 
size
  .ReadInt16( m_nDataPageSize ); // 20 1 << this size == data 
block size
 if (!r.good())
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index 7d90c490c634..c4294924697a 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -55,7 +55,17 @@ bool StgIo::Load()
 {
 if( GetStrm() )
 {
-if( m_aHdr.Load( *this ) )
+bool bLoaded;
+try
+{
+bLoaded = m_aHdr.Load(*this);
+}
+catch (const SvStreamEOFException&)
+{
+SAL_WARN("sot", "EOF");
+bLoaded = false;
+}
+if (bLoaded)
 {
 if( m_aHdr.Check() )
 SetupStreams();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2020-07-01 Thread Stephan Bergmann (via logerrit)
 sot/source/sdstor/stgelem.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d72e9cc0d1a91bf6283dcc5d3d96ae16e7014454
Author: Stephan Bergmann 
AuthorDate: Wed Jul 1 23:49:54 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jul 2 07:11:15 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: sot

Change-Id: I3e751a59eb6d5f95a331627d0fcd776b193b05b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97667
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 43f4faf0251d..ff41d8d70f9c 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -28,9 +28,9 @@
 #include "stgelem.hxx"
 #include "stgio.hxx"
 
-static const sal_uInt16 nMaxLegalStr = 31;
+const sal_uInt16 nMaxLegalStr = 31;
 
-static const sal_uInt8 cStgSignature[ 8 ] = { 
0xD0,0xCF,0x11,0xE0,0xA1,0xB1,0x1A,0xE1 };
+const sal_uInt8 cStgSignature[ 8 ] = { 0xD0,0xCF,0x11,0xE0,0xA1,0xB1,0x1A,0xE1 
};
 
 // struct ClsId
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source svx/source

2020-01-02 Thread Yusuf Keten (via logerrit)
 sot/source/sdstor/stgdir.cxx|2 +-
 svx/source/form/fmshimp.cxx |2 +-
 svx/source/sdr/contact/viewcontactofvirtobj.cxx |2 +-
 svx/source/svdraw/svdobj.cxx|2 +-
 svx/source/svdraw/svdocapt.cxx  |2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 9ef226c581ddf025e36aebefaa48c051354c520b
Author: Yusuf Keten 
AuthorDate: Sun Dec 29 02:52:10 2019 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jan 2 19:58:48 2020 +0100

tdf#96505 Get rid of cargo cult long integer literals

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

diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index f31488fd07c2..4002d637230d 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -478,7 +478,7 @@ sal_Int32 StgDirEntry::Write( const void* p, sal_Int32 nLen 
)
 if( nNew > m_pStgStrm->GetSize() )
 {
 if( !SetSize( nNew ) )
-return 0L;
+return 0;
 m_pStgStrm->Pos2Page( m_nPos );
 }
 nLen = m_pStgStrm->Write( p, nLen );
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 845fbf030b85..ca14eef60bd8 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -2461,7 +2461,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest_Lock, 
FmSearchContext&, rfmscCont
 rfmscContextInfo.arrFields.clear();
 rfmscContextInfo.xCursor = nullptr;
 rfmscContextInfo.strUsedFields.clear();
-return 0L;
+return 0;
 }
 
 rfmscContextInfo.xCursor = xIter;
diff --git a/svx/source/sdr/contact/viewcontactofvirtobj.cxx 
b/svx/source/sdr/contact/viewcontactofvirtobj.cxx
index c78670aa03fb..4efb3d65797d 100644
--- a/svx/source/sdr/contact/viewcontactofvirtobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofvirtobj.cxx
@@ -56,7 +56,7 @@ sal_uInt32 ViewContactOfVirtObj::GetObjectCount() const
 
 // As can be seen, with primitives, the problem will be solved using
 // a transformPrimitive, so this solution can stay with primitives.
-return 0L;
+return 0;
 }
 
 drawinglayer::primitive2d::Primitive2DContainer 
ViewContactOfVirtObj::createViewIndependentPrimitive2DSequence() const
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 76338b2a144e..db6238c704ba 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1691,7 +1691,7 @@ bool SdrObject::IsPolyObj() const
 
 sal_uInt32 SdrObject::GetPointCount() const
 {
-return 0L;
+return 0;
 }
 
 Point SdrObject::GetPoint(sal_uInt32 /*i*/) const
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 81b34988f0bc..dc7bdaf3aa4d 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -654,7 +654,7 @@ void SdrCaptionObj::NbcSetTailPos(const Point& rPos)
 sal_uInt32 SdrCaptionObj::GetSnapPointCount() const
 {
 // TODO: Implementation missing.
-return 0L;
+return 0;
 }
 
 Point SdrCaptionObj::GetSnapPoint(sal_uInt32 /*i*/) const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source svl/qa svl/source svtools/source svx/source

2019-11-23 Thread Julien Nabet (via logerrit)
 sot/source/sdstor/stgio.cxx |3 -
 svl/qa/unit/svl.cxx |4 --
 svl/source/numbers/zforlist.cxx |2 -
 svl/source/svdde/ddestrg.cxx|5 +-
 svtools/source/config/slidesorterbaropt.cxx |4 --
 svtools/source/control/calendar.cxx |7 +---
 svtools/source/control/ctrltool.cxx |3 -
 svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx |   27 ++--
 svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx |3 -
 svx/source/svdraw/svdocapt.cxx  |   13 ++-
 svx/source/unodraw/unoctabl.cxx |6 +--
 11 files changed, 28 insertions(+), 49 deletions(-)

New commits:
commit d002d3e8c241f32ac931c1998d7820d5b7b97e64
Author: Julien Nabet 
AuthorDate: Sat Nov 23 19:17:30 2019 +0100
Commit: Julien Nabet 
CommitDate: Sun Nov 24 00:26:41 2019 +0100

cppcheck: performing init in init list (sot/svl/svtools/svx)

order had been changed in 
svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
so initialization list was fine
Indeed mpActLineDistFld depends on mpLineDistAtMetricBox

Change-Id: I974e68892fe7ab900774bbe912c51ec56ba4ee43
Reviewed-on: https://gerrit.libreoffice.org/83577
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index 08f023c5f52a..7d90c490c634 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -175,9 +175,8 @@ public:
 }
 
 EasyFat::EasyFat( StgIo& rIo, StgStrm* pFatStream, sal_Int32 nPSize )
+   : nPages(pFatStream->GetSize() >> 2), nPageSize(nPSize)
 {
-nPages = pFatStream->GetSize() >> 2;
-nPageSize = nPSize;
 pFat.reset( new sal_Int32[ nPages ] );
 pFree.reset( new bool[ nPages ] );
 
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index d30a7b6279ec..8eb3cf4b6dfa 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -101,10 +101,8 @@ private:
 std::unique_ptr m_pDefaultTimeZone;
 };
 
-Test::Test()
+Test::Test() : m_xContext(cppu::defaultBootstrap_InitialComponentContext())
 {
-m_xContext = cppu::defaultBootstrap_InitialComponentContext();
-
 uno::Reference 
xFactory(m_xContext->getServiceManager());
 uno::Reference xSM(xFactory, 
uno::UNO_QUERY_THROW);
 
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 04e32464d8b2..7243d0f7105c 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -196,8 +196,8 @@ public:
 };
 
 SvNumberFormatterRegistry_Impl::SvNumberFormatterRegistry_Impl()
+: eSysLanguage(MsLangId::getRealLanguage( LANGUAGE_SYSTEM ))
 {
-eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM );
 aSysLocaleOptions.AddListener( this );
 }
 
diff --git a/svl/source/svdde/ddestrg.cxx b/svl/source/svdde/ddestrg.cxx
index 43fbe5b6d9e4..6789dc1e172f 100644
--- a/svl/source/svdde/ddestrg.cxx
+++ b/svl/source/svdde/ddestrg.cxx
@@ -23,10 +23,9 @@
 #include 
 
 DdeString::DdeString( DWORD hDdeInst, const OUString& r)
-: m_aString(r)
+: m_aString(r), hString(DdeCreateStringHandleW( hDdeInst, 
o3tl::toW(r.getStr()), CP_WINUNICODE )),
+  hInst(hDdeInst)
 {
-hString = DdeCreateStringHandleW( hDdeInst, o3tl::toW(r.getStr()), 
CP_WINUNICODE );
-hInst = hDdeInst;
 }
 
 DdeString::~DdeString()
diff --git a/svtools/source/config/slidesorterbaropt.cxx 
b/svtools/source/config/slidesorterbaropt.cxx
index ecf29453c765..83b10595869c 100644
--- a/svtools/source/config/slidesorterbaropt.cxx
+++ b/svtools/source/config/slidesorterbaropt.cxx
@@ -120,7 +120,7 @@ class SvtSlideSorterBarOptions_Impl : public ConfigItem
 SvtSlideSorterBarOptions_Impl::SvtSlideSorterBarOptions_Impl()
 // Init baseclasses first
 : ConfigItem( ROOTNODE_SLIDESORTERBAR )
-
+, m_seqPropertyNames(GetPropertyNames())
 , m_bVisibleImpressView( false )
 , m_bVisibleOutlineView( false )
 , m_bVisibleNotesView( false )
@@ -129,8 +129,6 @@ 
SvtSlideSorterBarOptions_Impl::SvtSlideSorterBarOptions_Impl()
 , m_bVisibleDrawView( false )
 
 {
-m_seqPropertyNames = GetPropertyNames( );
-
 // Use our static list of configuration keys to get his values.
 Sequence< Any > seqValues = GetProperties( m_seqPropertyNames  );
 
diff --git a/svtools/source/control/calendar.cxx 
b/svtools/source/control/calendar.cxx
index 023af05b18bc..d1b7f5d119c9 100644
--- a/svtools/source/control/calendar.cxx
+++ b/svtools/source/control/calendar.cxx
@@ -57,12 +57,9 @@ public:
 };
 
 ImplCFieldFloatWin::ImplCFieldFloatWin( vcl::Window* pParent ) :
-FloatingWindow( pParent, WB_BORDER | WB_SYSTEMWINDOW | WB_NOSHADOW  )
+FloatingWindow( pParent, WB_BORDER | WB_SYSTEMWINDOW | WB_NOSHADOW  ),
+mpCalendar(nullptr), mpTodayBtn(nullptr), mpNoneBtn(nullptr), 
mpFixedLine(nullptr)
 {
-

[Libreoffice-commits] core.git: sot/source

2019-09-27 Thread Jan Holesovsky (via logerrit)
 sot/source/base/formats.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e9e6d4b058e13165f3dde1ca7822eec97dfe8aa7
Author: Jan Holesovsky 
AuthorDate: Thu Sep 26 13:35:55 2019 +0200
Commit: Jan Holesovsky 
CommitDate: Fri Sep 27 09:54:06 2019 +0200

tdf#116685: Make the RICHTEXT take precedence over EMBED_SOURCE.

Before this patch, copy in Calc, Paste in Writer produced an embedded
sheet.  I suspect is it not what the people usually want; working with
the embedded sheets in Writer is non-intuitive, I suspect people will be
happier with a normal table which they can style etc. appropriately.

OTOH - this is a general change, so it might have some unwanted
side-effects; let's see what if we get bugreports :-)

tdf#127673 was related; but in my view, we shouldn't create the embedded
objects in the first place.

Change-Id: I73710168d8924fdd6275d65e20cf55f38971a3f9
Reviewed-on: https://gerrit.libreoffice.org/79606
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky 

diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index d26521fd31e8..51c6b157496f 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -894,6 +894,7 @@ SotAction_Impl const aEXCHG_DEST_SWDOC_FREE_AREA_Copy[] =
 { SotClipboardFormatId::DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::SVXB, EXCHG_OUT_ACTION_INSERT_SVXB, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
+{ SotClipboardFormatId::RICHTEXT, EXCHG_IN_ACTION_COPY, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE, 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE, 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 #ifndef MACOSX
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: sot/source

2019-06-17 Thread Andrea Gelmini (via logerrit)
 sot/source/sdstor/ucbstorage.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f359ee6e88fdfa5d78de4dfe0d94f07b54a5559b
Author: Andrea Gelmini 
AuthorDate: Mon Jun 17 15:58:28 2019 +0200
Commit: Julien Nabet 
CommitDate: Mon Jun 17 16:08:51 2019 +0200

Fix typo

Change-Id: Ia129c401366d63a588875a84fc7a7cc46f299fba
Reviewed-on: https://gerrit.libreoffice.org/74174
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index c746fd25f5e9..b732faef2734 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1007,7 +1007,7 @@ BaseStorage* UCBStorageStream_Impl::CreateStorage()
 UCBStorageStream* pNewStorageStream = new UCBStorageStream( this );
 Storage *pStorage = new Storage( *pNewStorageStream, m_bDirect );
 
-// GetError() call cleares error code for OLE storages, must be changed in 
future
+// GetError() call clears error code for OLE storages, must be changed in 
future
 const ErrCode nTmpErr = pStorage->GetError();
 pStorage->SetError( nTmpErr );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: sot/source

2019-02-22 Thread Libreoffice Gerrit user
 sot/source/sdstor/stg.cxx|2 --
 sot/source/sdstor/stgio.cxx  |   15 ---
 sot/source/sdstor/stgio.hxx  |7 ---
 sot/source/sdstor/ucbstorage.cxx |7 +++
 4 files changed, 3 insertions(+), 28 deletions(-)

New commits:
commit 6f4ad52d4cad5093e72120decea31066a419665f
Author: Noel Grandin 
AuthorDate: Fri Feb 22 11:09:53 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Feb 22 18:02:28 2019 +0100

loplugin:unusedfields in sot

and simplify, the ErrorLink functionality in StgIo is actually unused

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

diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index d22bbbe6a465..2bf3ac2d8113 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -880,9 +880,7 @@ OUString Storage::GetUserName()
 
 bool Storage::ValidateFAT()
 {
-Link aLink = StgIo::GetErrorLink();
 FatError nErr = pIo->ValidateFATs();
-StgIo::SetErrorLink( aLink );
 return nErr == FatError::Ok;
 }
 
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index 2a82c0731b52..8ec356d20699 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -355,18 +355,6 @@ FatError Validator::FindUnrefedChains() const
 return FatError::Ok;
 }
 
-namespace { struct ErrorLink : public rtl::Static, 
ErrorLink > {}; }
-
-void StgIo::SetErrorLink( const Link& rLink )
-{
-ErrorLink::get() = rLink;
-}
-
-const Link& StgIo::GetErrorLink()
-{
-return ErrorLink::get();
-}
-
 FatError StgIo::ValidateFATs()
 {
 if( m_bFile )
@@ -395,9 +383,6 @@ FatError StgIo::ValidateFATs()
 else nErr = bRet1 ? FatError::Ok : FatError::BothError;
 if( nErr != FatError::Ok && !m_bCopied )
 {
-StgLinkArg aArg;
-aArg.aFile = pFileStrm->GetFileName();
-ErrorLink::get().Call( aArg );
 m_bCopied = true;
 }
 //  DBG_ASSERT( nErr == FatError::Ok ,"Storage broken");
diff --git a/sot/source/sdstor/stgio.hxx b/sot/source/sdstor/stgio.hxx
index d73db29cfb01..8e09c6ae1c09 100644
--- a/sot/source/sdstor/stgio.hxx
+++ b/sot/source/sdstor/stgio.hxx
@@ -41,11 +41,6 @@ enum class FatError
 BothError
 };
 
-struct StgLinkArg
-{
-OUString aFile;
-};
-
 class StgIo : public StgCache {
 void SetupStreams();// load all internal streams
 bool m_bCopied;
@@ -62,8 +57,6 @@ public:
 bool Init();// set up an empty file
 bool CommitAll();   // commit everything (root commit)
 
-static void SetErrorLink( const Link& );
-static const Link& GetErrorLink();
 FatError ValidateFATs( );
 };
 
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 0f76afcfafca..59b9f97f1e85 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -450,7 +450,6 @@ class UCBStorage_Impl : public SvRefBase
 public:
 UCBStorage* m_pAntiImpl;// only valid if external 
references exists
 
-OUStringm_aOriginalName;// the original name before 
accessing the storage
 OUStringm_aName;// the actual name ( changed 
with a Rename command at the parent )
 OUStringm_aURL; // the full path name to 
create the content
 OUStringm_aContentType;
@@ -1463,7 +1462,7 @@ UCBStorage_Impl::UCBStorage_Impl( const 
::ucbhelper::Content& rContent, const OU
 DBG_ASSERT( m_bIsRoot, "SubStorage must have a name!" );
 m_pTempFile.reset(new ::utl::TempFile);
 m_pTempFile->EnableKillingFile();
-m_aName = m_aOriginalName = aName = m_pTempFile->GetURL();
+m_aName = aName = m_pTempFile->GetURL();
 }
 
 m_aURL = rName;
@@ -1492,7 +1491,7 @@ UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, 
StreamMode nMode, UCBSt
 DBG_ASSERT( m_bIsRoot, "SubStorage must have a name!" );
 m_pTempFile.reset(new ::utl::TempFile);
 m_pTempFile->EnableKillingFile();
-m_aName = m_aOriginalName = aName = m_pTempFile->GetURL();
+m_aName = aName = m_pTempFile->GetURL();
 }
 
 if ( m_bIsRoot )
@@ -1568,7 +1567,7 @@ void UCBStorage_Impl::Init()
 INetURLObject aObj( m_aURL );
 if ( m_aName.isEmpty() )
 // if the name was not already set to a temp name
-m_aName = m_aOriginalName = aObj.GetLastName();
+m_aName = aObj.GetLastName();
 
 if ( !m_pContent )
 CreateContent();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: sot/source

2019-02-05 Thread Libreoffice Gerrit user
 sot/source/sdstor/stg.cxx  |   20 +--
 sot/source/sdstor/stgdir.cxx   |  165 -
 sot/source/sdstor/stgio.cxx|   24 +--
 sot/source/sdstor/ucbstorage.cxx   |   82 ++--
 sot/source/unoolestorage/xolesimplestorage.cxx |   34 ++---
 5 files changed, 162 insertions(+), 163 deletions(-)

New commits:
commit 8a7a93b3f24b95bfcffc25e58f9e43c7be4cc1f1
Author: Noel Grandin 
AuthorDate: Tue Feb 5 14:03:13 2019 +0200
Commit: Noel Grandin 
CommitDate: Tue Feb 5 14:45:08 2019 +0100

loplugin:flatten in sot

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

diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 435cfa2e80c4..d22bbbe6a465 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -518,19 +518,19 @@ const OUString& Storage::GetName() const
 
 void Storage::FillInfoList( SvStorageInfoList* pList ) const
 {
-if( Validate() && pList )
+if( !(Validate() && pList) )
+return;
+
+StgIterator aIter( *pEntry );
+StgDirEntry* p = aIter.First();
+while( p )
 {
-StgIterator aIter( *pEntry );
-StgDirEntry* p = aIter.First();
-while( p )
+if( !p->m_bInvalid )
 {
-if( !p->m_bInvalid )
-{
-SvStorageInfo aInfo( *p );
-pList->push_back( aInfo );
-}
-p = aIter.Next();
+SvStorageInfo aInfo( *p );
+pList->push_back( aInfo );
 }
+p = aIter.Next();
 }
 }
 
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index df077cf1d911..71a1268cb84d 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -148,20 +148,19 @@ void StgDirEntry::DelTemp( bool bForce )
 bForce = true;
 m_pDown->DelTemp( bForce );
 }
-if( ( bForce || m_bInvalid )
- && ( m_aEntry.GetType() != STG_ROOT ) /* && ( nRefCnt <= 1 ) */ )
+if( !( bForce || m_bInvalid ) || ( m_aEntry.GetType() == STG_ROOT ) )
+return;
+
+Close();
+if( m_pUp )
 {
-Close();
-if( m_pUp )
+// this deletes the element if refcnt == 0!
+bool bDel = m_nRefCnt == 0;
+StgAvlNode::Remove( reinterpret_cast(_pUp->m_pDown), 
this, bDel );
+if( !bDel )
 {
-// this deletes the element if refcnt == 0!
-bool bDel = m_nRefCnt == 0;
-StgAvlNode::Remove( 
reinterpret_cast(_pUp->m_pDown), this, bDel );
-if( !bDel )
-{
-m_pLeft = m_pRight = m_pDown = nullptr;
-m_bInvalid = m_bZombie = true;
-}
+m_pLeft = m_pRight = m_pDown = nullptr;
+m_bInvalid = m_bZombie = true;
 }
 }
 }
@@ -494,26 +493,26 @@ sal_Int32 StgDirEntry::Write( const void* p, sal_Int32 
nLen )
 void StgDirEntry::Copy( BaseStorageStream& rDest )
 {
 sal_Int32 n = GetSize();
-if( rDest.SetSize( n ) && n )
-{
-sal_uLong Pos = rDest.Tell();
-sal_uInt8 aTempBytes[ 4096 ];
-void* p = static_cast( aTempBytes );
-Seek( 0 );
-rDest.Seek( 0 );
-while( n )
-{
-sal_Int32 nn = n;
-if( nn > 4096 )
-nn = 4096;
-if( Read( p, nn ) != nn )
-break;
-if( sal::static_int_cast(rDest.Write( p, nn )) != nn )
-break;
-n -= nn;
-}
-rDest.Seek( Pos ); // ?! Seems to be undocumented !
+if( !(rDest.SetSize( n ) && n) )
+return;
+
+sal_uLong Pos = rDest.Tell();
+sal_uInt8 aTempBytes[ 4096 ];
+void* p = static_cast( aTempBytes );
+Seek( 0 );
+rDest.Seek( 0 );
+while( n )
+{
+sal_Int32 nn = n;
+if( nn > 4096 )
+nn = 4096;
+if( Read( p, nn ) != nn )
+break;
+if( sal::static_int_cast(rDest.Write( p, nn )) != nn )
+break;
+n -= nn;
 }
+rDest.Seek( Pos ); // ?! Seems to be undocumented !
 }
 
 // Commit this entry
@@ -733,71 +732,71 @@ StgDirStrm::~StgDirStrm()
 void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
 {
 void* p = ( n == STG_FREE ) ? nullptr : GetEntry( n, false );
-if( p )
+if( !p )
+return;
+
+SvStream *pUnderlyingStream = m_rIo.GetStrm();
+sal_uInt64 nUnderlyingStreamSize = pUnderlyingStream->TellEnd();
+
+bool bOk(false);
+std::unique_ptr pCur(new StgDirEntry( p, STGENTRY_SIZE, 
nUnderlyingStreamSize,  ));
+
+if( !bOk )
 {
-SvStream *pUnderlyingStream = m_rIo.GetStrm();
-sal_uInt64 nUnderlyingStreamSize = pUnderlyingStream->TellEnd();
+m_rIo.SetError( SVSTREAM_GENERALERROR );
+// an error occurred
+ 

[Libreoffice-commits] core.git: sot/source

2018-12-04 Thread Libreoffice Gerrit user
 sot/source/sdstor/ucbstorage.cxx |   27 +++
 1 file changed, 11 insertions(+), 16 deletions(-)

New commits:
commit 73d667e3a0db5f0d3ee1f9d001b6220190c02bfa
Author: Noel Grandin 
AuthorDate: Tue Dec 4 14:56:10 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Dec 5 07:50:21 2018 +0100

use unique_ptr in UCBStorage_Impl

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

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 98633c9fec72..c4136ade6ddf 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -455,8 +455,8 @@ public:
 OUStringm_aURL; // the full path name to 
create the content
 OUStringm_aContentType;
 OUStringm_aOriginalContentType;
-::ucbhelper::Content*   m_pContent; // the content that provides 
the storage elements
-::utl::TempFile*m_pTempFile;// temporary file, only for 
storages on stream
+std::unique_ptr<::ucbhelper::Content> m_pContent; // the content that 
provides the storage elements
+std::unique_ptr<::utl::TempFile>  m_pTempFile;// temporary file, 
only for storages on stream
 SvStream*   m_pSource;  // original stream, only for 
storages on a stream
 ErrCode m_nError;
 StreamMode  m_nMode;// open mode ( 
read/write/trunc/nocreate/sharing )
@@ -496,7 +496,7 @@ public:
 {
 if ( !m_pContent )
 CreateContent();
-return m_pContent;
+return m_pContent.get();
 }
 UCBStorageElementList_Impl& GetChildrenList()
 {
@@ -1442,7 +1442,6 @@ UCBStorage::~UCBStorage()
 UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const 
OUString& rName, StreamMode nMode, UCBStorage* pStorage, bool bDirect, bool 
bIsRoot, bool bIsRepair, Reference< XProgressHandler > const & xProgressHandler 
 )
 : m_pAntiImpl( pStorage )
 , m_pContent( new ::ucbhelper::Content( rContent ) )
-, m_pTempFile( nullptr )
 , m_pSource( nullptr )
 //, m_pStream( NULL )
 , m_nError( ERRCODE_NONE )
@@ -1462,7 +1461,7 @@ UCBStorage_Impl::UCBStorage_Impl( const 
::ucbhelper::Content& rContent, const OU
 {
 // no name given = use temporary name!
 DBG_ASSERT( m_bIsRoot, "SubStorage must have a name!" );
-m_pTempFile = new ::utl::TempFile;
+m_pTempFile.reset(new ::utl::TempFile);
 m_pTempFile->EnableKillingFile();
 m_aName = m_aOriginalName = aName = m_pTempFile->GetURL();
 }
@@ -1472,8 +1471,6 @@ UCBStorage_Impl::UCBStorage_Impl( const 
::ucbhelper::Content& rContent, const OU
 
 UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, StreamMode nMode, 
UCBStorage* pStorage, bool bDirect, bool bIsRoot, bool bIsRepair, Reference< 
XProgressHandler > const & xProgressHandler )
 : m_pAntiImpl( pStorage )
-, m_pContent( nullptr )
-, m_pTempFile( nullptr )
 , m_pSource( nullptr )
 //, m_pStream( NULL )
 , m_nError( ERRCODE_NONE )
@@ -1493,7 +1490,7 @@ UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, 
StreamMode nMode, UCBSt
 {
 // no name given = use temporary name!
 DBG_ASSERT( m_bIsRoot, "SubStorage must have a name!" );
-m_pTempFile = new ::utl::TempFile;
+m_pTempFile.reset(new ::utl::TempFile);
 m_pTempFile->EnableKillingFile();
 m_aName = m_aOriginalName = aName = m_pTempFile->GetURL();
 }
@@ -1522,7 +1519,6 @@ UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, 
StreamMode nMode, UCBSt
 
 UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, 
bool bDirect )
 : m_pAntiImpl( pStorage )
-, m_pContent( nullptr )
 , m_pTempFile( new ::utl::TempFile )
 , m_pSource(  )
 , m_nError( ERRCODE_NONE )
@@ -1669,7 +1665,7 @@ void UCBStorage_Impl::CreateContent()
 aTemp += "?repairpackage";
 }
 
-m_pContent = new ::ucbhelper::Content( aTemp, xComEnv, 
comphelper::getProcessComponentContext() );
+m_pContent.reset(new ::ucbhelper::Content( aTemp, xComEnv, 
comphelper::getProcessComponentContext() ));
 }
 catch (const ContentCreationException&)
 {
@@ -1940,8 +1936,8 @@ UCBStorage_Impl::~UCBStorage_Impl()
 {
 m_aChildrenList.clear();
 
-delete m_pContent;
-delete m_pTempFile;
+m_pContent.reset();
+m_pTempFile.reset();
 }
 
 bool UCBStorage_Impl::Insert( ::ucbhelper::Content *pContent )
@@ -1980,8 +1976,7 @@ bool UCBStorage_Impl::Insert( ::ucbhelper::Content 
*pContent )
 

[Libreoffice-commits] core.git: sot/source

2018-11-04 Thread Libreoffice Gerrit user
 sot/source/sdstor/stgdir.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 5340c53443fc2b2056146799a1156748433be078
Author: Caolán McNamara 
AuthorDate: Sun Nov 4 16:02:27 2018 +
Commit: Caolán McNamara 
CommitDate: Sun Nov 4 22:03:38 2018 +0100

coverity#1440843 help coverity out wrt Wrapper object use after free

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

diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index 6f52a38475d6..83c3f69f62fc 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -658,10 +658,9 @@ bool StgDirEntry::Tmp2Strm()
 {
 m_pStgStrm->SetSize( 0 );
 delete m_pStgStrm;
-m_pStgStrm = pNewStrm.get();
-pNewStrm->SetEntry( *this );
-pNewStrm->Pos2Page( m_nPos );
-pNewStrm.release();
+m_pStgStrm = pNewStrm.release();
+m_pStgStrm->SetEntry(*this);
+m_pStgStrm->Pos2Page(m_nPos);
 delete m_pTmpStrm;
 delete m_pCurStrm;
 m_pTmpStrm = m_pCurStrm = nullptr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2018-11-02 Thread Libreoffice Gerrit user
 sot/source/sdstor/stg.cxx  |   16 ++--
 sot/source/sdstor/stgdir.cxx   |   37 +++--
 sot/source/sdstor/stgio.cxx|8 
 sot/source/sdstor/stgstrms.cxx |5 ++---
 4 files changed, 27 insertions(+), 39 deletions(-)

New commits:
commit e04f01abca1b7bc2cf8d643628a9dd31d476897f
Author: Noel Grandin 
AuthorDate: Mon Oct 29 14:26:48 2018 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 2 11:53:17 2018 +0100

loplugin:useuniqueptr in sot

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

diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 60147cd319ee..169c7cb84138 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -673,8 +673,8 @@ bool Storage::CopyTo( const OUString& rElem, BaseStorage* 
pDest, const OUString&
 if( pElem->m_aEntry.GetType() == STG_STORAGE )
 {
 // copy the entire storage
-BaseStorage* p1 = OpenStorage( rElem, INTERNAL_MODE );
-BaseStorage* p2 = pDest->OpenOLEStorage( rNew, StreamMode::WRITE | 
StreamMode::SHARE_DENYALL, pEntry->m_bDirect );
+tools::SvRef p1 = OpenStorage( rElem, INTERNAL_MODE );
+tools::SvRef p2 = pDest->OpenOLEStorage( rNew, 
StreamMode::WRITE | StreamMode::SHARE_DENYALL, pEntry->m_bDirect );
 
 if ( p2 )
 {
@@ -682,7 +682,7 @@ bool Storage::CopyTo( const OUString& rElem, BaseStorage* 
pDest, const OUString&
 if( !nTmpErr )
 {
 p2->SetClassId( p1->GetClassId() );
-p1->CopyTo( p2 );
+p1->CopyTo( p2.get() );
 SetError( p1->GetError() );
 
 nTmpErr = p2->GetError();
@@ -695,22 +695,20 @@ bool Storage::CopyTo( const OUString& rElem, BaseStorage* 
pDest, const OUString&
 pDest->SetError( nTmpErr );
 }
 
-delete p1;
-delete p2;
 return Good() && pDest->Good();
 }
 else
 {
 // stream copy
-BaseStorageStream* p1 = OpenStream( rElem, INTERNAL_MODE );
-BaseStorageStream* p2 = pDest->OpenStream( rNew, StreamMode::WRITE 
| StreamMode::SHARE_DENYALL, pEntry->m_bDirect );
+tools::SvRef p1 = OpenStream( rElem, 
INTERNAL_MODE );
+tools::SvRef p2 = pDest->OpenStream( rNew, 
StreamMode::WRITE | StreamMode::SHARE_DENYALL, pEntry->m_bDirect );
 
 if ( p2 )
 {
 ErrCode nTmpErr = p2->GetError();
 if( !nTmpErr )
 {
-p1->CopyTo( p2 );
+p1->CopyTo( p2.get() );
 SetError( p1->GetError() );
 
 nTmpErr = p2->GetError();
@@ -723,8 +721,6 @@ bool Storage::CopyTo( const OUString& rElem, BaseStorage* 
pDest, const OUString&
 pDest->SetError( nTmpErr );
 }
 
-delete p1;
-delete p2;
 return Good() && pDest->Good();
 }
 }
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index da729a9031ef..6f52a38475d6 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -626,13 +626,13 @@ bool StgDirEntry::Tmp2Strm()
 if ( !m_pStgStrm )
 return false;
 sal_uInt64 n = m_pTmpStrm->GetSize();
-StgStrm* pNewStrm;
+std::unique_ptr pNewStrm;
 StgIo& rIo = m_pStgStrm->GetIo();
 sal_uLong nThreshold = 
static_cast(rIo.m_aHdr.GetThreshold());
 if( n < nThreshold )
-pNewStrm = new StgSmallStrm( rIo, STG_EOF );
+pNewStrm.reset(new StgSmallStrm( rIo, STG_EOF ));
 else
-pNewStrm = new StgDataStrm( rIo, STG_EOF );
+pNewStrm.reset(new StgDataStrm( rIo, STG_EOF ));
 if( pNewStrm->SetSize( n ) )
 {
 sal_uInt8 p[ 4096 ];
@@ -652,16 +652,16 @@ bool StgDirEntry::Tmp2Strm()
 {
 m_pTmpStrm->Seek( m_nPos );
 m_pStgStrm->GetIo().SetError( m_pTmpStrm->GetError() );
-delete pNewStrm;
 return false;
 }
 else
 {
 m_pStgStrm->SetSize( 0 );
 delete m_pStgStrm;
-m_pStgStrm = pNewStrm;
+m_pStgStrm = pNewStrm.get();
 pNewStrm->SetEntry( *this );
 pNewStrm->Pos2Page( m_nPos );
+pNewStrm.release();
 delete m_pTmpStrm;
 delete m_pCurStrm;
 m_pTmpStrm = m_pCurStrm = nullptr;
@@ -741,11 +741,10 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* 
pUpper )
 sal_uInt64 nUnderlyingStreamSize = pUnderlyingStream->TellEnd();
 
 bool 

[Libreoffice-commits] core.git: sot/source

2018-10-19 Thread Libreoffice Gerrit user
 sot/source/sdstor/stgio.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit b739827f996262fb3719c25a622a0482cdb4c626
Author: Caolán McNamara 
AuthorDate: Fri Oct 19 10:02:37 2018 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 19 12:56:43 2018 +0200

simplify expression

Change-Id: I57c7df50040737656c2a68e5fdc0d069ad21f833
Reviewed-on: https://gerrit.libreoffice.org/61975
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index bcfff0d51118..803ab3761b68 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -211,8 +211,9 @@ FatError EasyFat::Mark( sal_Int32 nPage, sal_Int32 nCount, 
sal_Int32 nExpect )
 {
 if( nCount > 0 )
 {
---nCount /= GetPageSize();
-nCount++;
+--nCount;
+nCount /= GetPageSize();
+++nCount;
 }
 
 sal_Int32 nCurPage = nPage;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2018-08-17 Thread Libreoffice Gerrit user
 sot/source/sdstor/stgavl.cxx |   12 ++--
 sot/source/sdstor/stgavl.hxx |4 ++--
 sot/source/sdstor/stgdir.cxx |4 ++--
 sot/source/sdstor/stgdir.hxx |2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 4cb69cf33b5bf17030bcd263fe31258177c76d5e
Author: Stephan Bergmann 
AuthorDate: Fri Aug 17 20:09:19 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Aug 17 22:47:32 2018 +0200

Avoid further downstream overflow

...after 004304eb2fd1703d22dec0abf0170bb2ce493d0c "try to avoid overflows in
some compare functions" had changed the return type of just one function, 
but
not its callers.  Found with Clang's new -fsanitize=implicit-conversion 
during
CppunitTest_sd_filters_test:

> Testing 
file:///home/sbergman/lo/core/sd/qa/unit/data/ppt/pass/hang-17.ppt:
[...]
> sot/source/sdstor/stgdir.cxx:101:19: runtime error: implicit conversion 
from type 'sal_Int32' (aka 'int') of value -57120 (32-bit, signed) to type 
'short' changed the value to 8416 (16-bit, signed)
>  #0 in StgDirEntry::Compare(StgAvlNode const*) const at 
sot/source/sdstor/stgdir.cxx:101:19 (instdir/program/libsotlo.so +0x217699)
>  #1 in StgAvlNode::Find(StgAvlNode const*) at 
sot/source/sdstor/stgavl.cxx:43:29 (instdir/program/libsotlo.so +0x1db72b)
>  #2 in StgDirStrm::Find(StgDirEntry&, rtl::OUString const&) at 
sot/source/sdstor/stgdir.cxx:907:57 (instdir/program/libsotlo.so +0x22f2dc)
>  #3 in Storage::IsStream(rtl::OUString const&) const at 
sot/source/sdstor/stg.cxx:773:39 (instdir/program/libsotlo.so +0x1d2cdf)
>  #4 in SotStorage::IsStream(rtl::OUString const&) const at 
sot/source/sdstor/storage.cxx:654:27 (instdir/program/libsotlo.so +0x29ebdb)
>  #5 in PropRead::PropRead(SotStorage&, rtl::OUString const&) at 
sd/source/filter/ppt/propread.cxx:543:19 (instdir/program/libsdfiltlo.so 
+0x6b72ee)
>  #6 in ImplSdPPTImport::Import() at sd/source/filter/ppt/pptin.cxx:262:32 
(instdir/program/libsdfiltlo.so +0x5d0dc4)
>  #7 in SdPPTImport::Import() at sd/source/filter/ppt/pptin.cxx:167:21 
(instdir/program/libsdfiltlo.so +0x5cf733)
>  #8 in ImportPPT at sd/source/filter/ppt/pptin.cxx:2761:26 
(instdir/program/libsdfiltlo.so +0x618f64)
>  #9 in SdPPTFilter::Import() at sd/source/filter/sdpptwrp.cxx:106:32 
(instdir/program/libsdlo.so +0x2877ed3)
>  #10 in sd::DrawDocShell::ConvertFrom(SfxMedium&) at 
sd/source/ui/docshell/docshel4.cxx:474:46 (instdir/program/libsdlo.so 
+0x2e1607c)
>  #11 in SfxObjectShell::DoLoad(SfxMedium*) at 
sfx2/source/doc/objstor.cxx:786:23 (instdir/program/libsfxlo.so +0x2c8c762)
>  #12 in SdFiltersTest::load(rtl::OUString const&, rtl::OUString const&, 
rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at 
sd/qa/unit/filters-test.cxx:75:31 
(workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x19771)
>  #13 in test::FiltersTest::recursiveScan(test::filterStatus, 
rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, 
SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at 
unotest/source/cpp/filters-test.cxx:130:20 
(workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x5724c)
>  #14 in test::FiltersTest::testDir(rtl::OUString const&, rtl::OUString 
const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned 
int, bool) at unotest/source/cpp/filters-test.cxx:155:5 
(workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x57ec9)
>  #15 in SdFiltersTest::testCVEs() at sd/qa/unit/filters-test.cxx:83:5 
(workdir/LinkTarget/CppunitTest/libtest_sd_filters_test.so +0x19d6d)

Change-Id: Iaffd35d33f0e1109195e3bd56538104d395af01b
Reviewed-on: https://gerrit.libreoffice.org/59274
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sot/source/sdstor/stgavl.cxx b/sot/source/sdstor/stgavl.cxx
index d488eec69130..0c78054045f0 100644
--- a/sot/source/sdstor/stgavl.cxx
+++ b/sot/source/sdstor/stgavl.cxx
@@ -40,7 +40,7 @@ StgAvlNode* StgAvlNode::Find( StgAvlNode const * pFind )
 StgAvlNode* p = this;
 while( p )
 {
-short nRes = p->Compare( pFind );
+sal_Int32 nRes = p->Compare( pFind );
 if( !nRes )
 return p;
 else p = ( nRes < 0 ) ? p->m_pLeft : p->m_pRight;
@@ -52,11 +52,11 @@ StgAvlNode* StgAvlNode::Find( StgAvlNode const * pFind )
 // find point to add node to AVL tree and returns
 // +/0/- for >/=/< previous
 
-short StgAvlNode::Locate
+sal_Int32 StgAvlNode::Locate
 ( StgAvlNode const * pFind,
   StgAvlNode** pPivot, StgAvlNode **pParent, StgAvlNode** pPrev )
 {
-short nRes = 0;
+sal_Int32 nRes = 0;
 StgAvlNode* pCur = this;
 
 OSL_ENSURE( pPivot && pParent && pPrev, "The pointers may not be NULL!" );
@@ -98,7 +98,7 @@ short StgAvlNode::Adjust( StgAvlNode** pHeavy, StgAvlNode 
const * pNew )
 if( pCur == pNew || !pNew )
 return m_nBalance;
 
-

[Libreoffice-commits] core.git: sot/source

2018-07-23 Thread Libreoffice Gerrit user
 sot/source/sdstor/stgcache.hxx |2 +-
 sot/source/sdstor/stgio.cxx|6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 810eed8646eacd665004d95359f21ce5e23fc795
Author: Noel Grandin 
AuthorDate: Mon Jul 23 11:52:54 2018 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 23 13:28:10 2018 +0200

make some fields in StgCache private

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

diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx
index b4262c80a1bc..f0bd2e1d25a3 100644
--- a/sot/source/sdstor/stgcache.hxx
+++ b/sot/source/sdstor/stgcache.hxx
@@ -56,9 +56,9 @@ class StgCache
 
 void Erase( const rtl::Reference< StgPage >& ); // delete a cache element
 rtl::Reference< StgPage > Create( sal_Int32  ); // create a cached page
-protected:
 SvStream* m_pStrm;// physical stream
 bool  m_bMyStream;// true: delete stream in dtor
+protected:
 bool  m_bFile;// true: file stream
 sal_Int32 Page2Pos( sal_Int32 ) const;// page address --> file position
 public:
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index a7e8863c6efd..e05460f4ae39 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -54,7 +54,7 @@ StgIo::~StgIo()
 
 bool StgIo::Load()
 {
-if( m_pStrm )
+if( GetStrm() )
 {
 if( m_aHdr.Load( *this ) )
 {
@@ -141,8 +141,8 @@ bool StgIo::CommitAll()
 m_aHdr.SetTOCStart( m_pTOC->GetStart() );
 if( m_aHdr.Store( *this ) )
 {
-m_pStrm->Flush();
-const ErrCode n = m_pStrm->GetError();
+GetStrm()->Flush();
+const ErrCode n = GetStrm()->GetError();
 SetError( n );
 #ifdef DBG_UTIL
 if( n==ERRCODE_NONE ) ValidateFATs();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2018-02-06 Thread Caolán McNamara
 sot/source/sdstor/stgstrms.cxx |   10 --
 sot/source/sdstor/stgstrms.hxx |2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 523fc71115071b6f74c8f05c1f8ad775f8af
Author: Caolán McNamara 
Date:   Tue Feb 6 09:22:50 2018 +

pOptionalCalcSize is never null

Change-Id: I830d02cbac6d281ab7fbeaf43e7af6136896b503

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 17958544d880..8e5093fe9a91 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -353,7 +353,7 @@ void StgStrm::SetEntry( StgDirEntry& r )
  * for this each time build a simple flat in-memory vector list
  * of pages.
  */
-void StgStrm::scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize)
+sal_Int32 StgStrm::scanBuildPageChainCache()
 {
 if (m_nSize > 0)
 m_aPagesCache.reserve(m_nSize/m_nPageSize);
@@ -384,12 +384,10 @@ void StgStrm::scanBuildPageChainCache(sal_Int32 
*pOptionalCalcSize)
 if (bError)
 {
 SAL_WARN("sot", "returning wrong format error");
-if (pOptionalCalcSize)
-m_rIo.SetError( ERRCODE_IO_WRONGFORMAT );
+m_rIo.SetError( ERRCODE_IO_WRONGFORMAT );
 m_aPagesCache.clear();
 }
-if (pOptionalCalcSize)
-*pOptionalCalcSize = nOptSize;
+return nOptSize;
 }
 
 // Compute page number and offset for the given byte position.
@@ -851,7 +849,7 @@ void StgDataStrm::Init( sal_Int32 nBgn, sal_Int32 nLen )
 {
 // determine the actual size of the stream by scanning
 // the FAT chain and counting the # of pages allocated
-scanBuildPageChainCache( _nSize );
+m_nSize = scanBuildPageChainCache();
 }
 }
 
diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx
index 0a6589f204f7..a2c8ca6de383 100644
--- a/sot/source/sdstor/stgstrms.hxx
+++ b/sot/source/sdstor/stgstrms.hxx
@@ -73,7 +73,7 @@ protected:
 short m_nOffset;  // offset into current page
 short m_nPageSize;// logical page size
 std::vector m_aPagesCache;
-void scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize);
+sal_Int32 scanBuildPageChainCache();
 bool  Copy( sal_Int32 nFrom, sal_Int32 nBytes );
 explicit StgStrm( StgIo& );
 public:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2018-01-28 Thread Caolán McNamara
 sot/source/sdstor/stgstrms.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit fdd41c995d1f719e92c6f083e780226114762f05
Author: Caolán McNamara 
Date:   Sat Jan 27 19:38:12 2018 +

ofz#5747 short->sal_Int32 like in StgDataStrm

Change-Id: I254c00b1142d7187beabe5d18532efec036de494
Reviewed-on: https://gerrit.libreoffice.org/48751
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 00a1a53c4314..efa03cd14d20 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -1066,7 +1066,7 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n )
 // small stream is likely to be < 64 KBytes.
 if( ( m_nPos + n ) > m_nSize )
 n = m_nSize - m_nPos;
-short nDone = 0;
+sal_Int32 nDone = 0;
 while( n )
 {
 short nBytes = m_nPageSize - m_nOffset;
@@ -1083,7 +1083,7 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n )
 break;
 // all reading through the stream
 short nRes = static_cast(m_pData->Read( 
static_cast(pBuf) + nDone, nBytes ));
-nDone = nDone + nRes;
+nDone += nRes;
 m_nPos += nRes;
 n -= nRes;
 m_nOffset = m_nOffset + nRes;
@@ -1102,7 +1102,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, 
sal_Int32 n )
 {
 // you can safely assume that reads are not huge, since the
 // small stream is likely to be < 64 KBytes.
-short nDone = 0;
+sal_Int32 nDone = 0;
 if( ( m_nPos + n ) > m_nSize )
 {
 sal_Int32 nOld = m_nPos;
@@ -1126,7 +1126,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, 
sal_Int32 n )
 if( !m_pData->Pos2Page( nDataPos ) )
 break;
 short nRes = static_cast(m_pData->Write( 
static_cast(pBuf) + nDone, nBytes ));
-nDone = nDone + nRes;
+nDone += nRes;
 m_nPos += nRes;
 n -= nRes;
 m_nOffset = m_nOffset + nRes;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-11-29 Thread Caolán McNamara
 sot/source/sdstor/stgstrms.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit d02e49d9b946277b4797526ed43a96d39757816f
Author: Caolán McNamara 
Date:   Wed Nov 29 09:02:16 2017 +

ofz#4476 Integer-overflow

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

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 0feebb3107cf..d8327399 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -913,8 +913,9 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n )
 if ( n < 0 )
 return 0;
 
-if( ( m_nPos + n ) > m_nSize )
-n = m_nSize - m_nPos;
+const auto nAvailable = m_nSize - m_nPos;
+if (n > nAvailable)
+n = nAvailable;
 sal_Int32 nDone = 0;
 while( n )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-11-20 Thread Takeshi Abe
 sot/source/sdstor/ucbstorage.cxx |   45 +--
 1 file changed, 16 insertions(+), 29 deletions(-)

New commits:
commit c40c0a2773cee5402801926bc08db92a94527712
Author: Takeshi Abe 
Date:   Tue Nov 14 15:17:28 2017 +0900

sot: Simplify UCBStorageElement_Impl with std::unique_ptr

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

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 6568d5c20f56..e60fc2f97a45 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -455,7 +455,7 @@ public:
 typedef tools::SvRef UCBStorageStream_ImplRef;
 
 struct UCBStorageElement_Impl;
-typedef ::std::vector< UCBStorageElement_Impl* > UCBStorageElementList_Impl;
+typedef std::vector 
UCBStorageElementList_Impl;
 
 class UCBStorage_Impl : public SvRefBase
 {
@@ -1736,7 +1736,7 @@ void UCBStorage_Impl::ReadContent()
 bool bIsFolder( xRow->getBoolean(2) );
 sal_Int64 nSize = xRow->getLong(4);
 UCBStorageElement_Impl* pElement = new UCBStorageElement_Impl( 
aTitle, bIsFolder, (sal_uLong) nSize );
-m_aChildrenList.push_back( pElement );
+m_aChildrenList.emplace_back( pElement );
 
 bool bIsOfficeDocument = m_bIsLinked || ( m_aClassId != 
SvGlobalName() );
 if ( bIsFolder )
@@ -1824,7 +1824,7 @@ void UCBStorage_Impl::SetError( ErrCode nError )
 sal_Int32 UCBStorage_Impl::GetObjectCount()
 {
 sal_Int32 nCount = m_aChildrenList.size();
-for (UCBStorageElement_Impl* pElement : m_aChildrenList)
+for (auto& pElement : m_aChildrenList)
 {
 DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.is(), 
"Storage should be open!" );
 if ( pElement->m_bIsFolder && pElement->m_xStorage.is() )
@@ -1880,7 +1880,7 @@ void UCBStorage_Impl::SetProps( const Sequence < Sequence 
< PropertyValue > >& r
 // the "FullPath" of a child always starts without '/'
 aPath.clear();
 
-for (UCBStorageElement_Impl* pElement : m_aChildrenList)
+for (auto& pElement : m_aChildrenList)
 {
 DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.is(), 
"Storage should be open!" );
 if ( pElement->m_bIsFolder && pElement->m_xStorage.is() )
@@ -1931,7 +1931,7 @@ void UCBStorage_Impl::GetProps( sal_Int32& nProps, 
Sequence < Sequence < Propert
 aPath.clear();
 
 // now the properties of my elements
-for (UCBStorageElement_Impl* pElement : m_aChildrenList)
+for (auto& pElement : m_aChildrenList)
 {
 DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.is(), 
"Storage should be open!" );
 if ( pElement->m_bIsFolder && pElement->m_xStorage.is() )
@@ -1953,9 +1953,6 @@ void UCBStorage_Impl::GetProps( sal_Int32& nProps, 
Sequence < Sequence < Propert
 
 UCBStorage_Impl::~UCBStorage_Impl()
 {
-// first delete elements!
-for (UCBStorageElement_Impl* i : m_aChildrenList)
-delete i;
 m_aChildrenList.clear();
 
 delete m_pContent;
@@ -2037,7 +2034,7 @@ sal_Int16 UCBStorage_Impl::Commit()
 // all errors will be caught in the "catch" statement outside the 
loop
 for ( size_t i = 0; i < m_aChildrenList.size() && nRet; ++i )
 {
-UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
+auto& pElement = m_aChildrenList[ i ];
 ::ucbhelper::Content* pContent = pElement->GetContent();
 std::unique_ptr< ::ucbhelper::Content > xDeleteContent;
 if ( !pContent && pElement->IsModified() )
@@ -2264,14 +2261,9 @@ sal_Int16 UCBStorage_Impl::Commit()
 // are also removed from the lists
 for ( size_t i = 0; i < m_aChildrenList.size(); )
 {
-UCBStorageElement_Impl* pInnerElement = m_aChildrenList[ i ];
+auto& pInnerElement = m_aChildrenList[ i ];
 if ( pInnerElement->m_bIsRemoved )
-{
-UCBStorageElementList_Impl::iterator it = 
m_aChildrenList.begin();
-::std::advance( it, i );
-delete *it;
-m_aChildrenList.erase( it );
-}
+m_aChildrenList.erase( m_aChildrenList.begin() + i );
 else
 {
 pInnerElement->m_aOriginalName = pInnerElement->m_aName;
@@ -2291,15 +2283,10 @@ bool UCBStorage_Impl::Revert()
 {
 for ( size_t i = 0; i < m_aChildrenList.size(); )
 {
-UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
+auto& pElement = m_aChildrenList[ i ];
 pElement->m_bIsRemoved = false;
 if ( pElement->m_bIsInserted )
- 

[Libreoffice-commits] core.git: sot/source

2017-11-16 Thread Caolán McNamara
 sot/source/sdstor/stgelem.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 359286b90f4d9962a3c1cb936ac7fd4140f71baa
Author: Caolán McNamara 
Date:   Thu Nov 16 13:14:36 2017 +

ofz#4079 check for error earlier

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

diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 7016a3a8f5f0..c474d5b3e100 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -136,7 +136,10 @@ bool StgHeader::Load( SvStream& r )
  .ReadUInt16( m_nByteOrder ) // 1C Unicode byte order 
indicator
  .ReadInt16( m_nPageSize )  // 1E 1 << nPageSize = block 
size
  .ReadInt16( m_nDataPageSize ); // 20 1 << this size == data 
block size
-r.SeekRel( 10 );
+if (!r.good())
+return false;
+if (!checkSeek(r, r.Tell() + 10))
+return false;
 r.ReadInt32( m_nFATSize )   // 2C total number of FAT pages
  .ReadInt32( m_nTOCstrm )   // 30 starting page for the 
TOC stream
  .ReadInt32( m_nReserved )  // 34
@@ -148,7 +151,7 @@ bool StgHeader::Load( SvStream& r )
 for(sal_Int32 & i : m_nMasterFAT)
 r.ReadInt32( i );
 
-return (r.GetErrorCode() == ERRCODE_NONE) && Check();
+return r.good() && Check();
 }
 
 bool StgHeader::Store( StgIo& rIo )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-11-13 Thread Takeshi Abe
 sot/source/base/exchange.cxx |   39 +--
 1 file changed, 13 insertions(+), 26 deletions(-)

New commits:
commit 6dd8b701058fc02e78941270ce0423199e4d2352
Author: Takeshi Abe 
Date:   Mon Nov 13 18:39:20 2017 +0900

sot: Simplify SotData_Impl with std::unique_ptr

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

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 1d230a43fccf..37d917730e46 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 using namespace::com::sun::star::uno;
@@ -213,25 +214,11 @@ namespace
 const DataFlavorRepresentation, ImplFormatArray_Impl > {};
 
 
-typedef std::vector tDataFlavorList;
+typedef std::vector 
tDataFlavorList;
 
 struct SotData_Impl
 {
-tDataFlavorList* pDataFlavorList;
-
-SotData_Impl(): pDataFlavorList(nullptr) {}
-~SotData_Impl()
-{
-if (pDataFlavorList)
-{
-for( tDataFlavorList::iterator aI = pDataFlavorList->begin(),
- aEnd = pDataFlavorList->end(); aI != aEnd; ++aI)
-{
-delete *aI;
-}
-delete pDataFlavorList;
-}
-}
+std::unique_ptr pDataFlavorList;
 };
 
 struct ImplData : public rtl::Static {};
@@ -241,7 +228,7 @@ static tDataFlavorList& InitFormats_Impl()
 {
 SotData_Impl *pSotData = ::get();
 if( !pSotData->pDataFlavorList )
-pSotData->pDataFlavorList = new tDataFlavorList;
+pSotData->pDataFlavorList.reset(new tDataFlavorList);
 return *pSotData->pDataFlavorList;
 }
 
@@ -272,17 +259,17 @@ SotClipboardFormatId SotExchange::RegisterFormatName( 
const OUString& rName )
 tDataFlavorList& rL = InitFormats_Impl();
 for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ )
 {
-DataFlavor* pFlavor = rL[ i ];
+auto const& pFlavor = rL[ i ];
 if( pFlavor && rName == pFlavor->HumanPresentableName )
 return static_cast(i + 
static_cast(SotClipboardFormatId::USER_END) + 1);
 }
 
-DataFlavor* pNewFlavor = new DataFlavor;
+std::unique_ptr pNewFlavor(new DataFlavor);
 pNewFlavor->MimeType = rName;
 pNewFlavor->HumanPresentableName = rName;
 pNewFlavor->DataType = cppu::UnoType::get();
 
-rL.push_back( pNewFlavor );
+rL.push_back( std::move(pNewFlavor) );
 
 return static_cast(static_cast(rL.size()-1) + 
static_cast(SotClipboardFormatId::USER_END) + 1);
 }
@@ -303,17 +290,17 @@ SotClipboardFormatId SotExchange::RegisterFormatMimeType( 
const OUString& rMimeT
 tDataFlavorList& rL = InitFormats_Impl();
 for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ )
 {
-DataFlavor* pFlavor = rL[ i ];
+auto const& pFlavor = rL[ i ];
 if( pFlavor && rMimeType == pFlavor->MimeType )
 return static_cast(i + 
static_cast(SotClipboardFormatId::USER_END) + 1);
 }
 
-DataFlavor* pNewFlavor = new DataFlavor;
+std::unique_ptr pNewFlavor(new DataFlavor);
 pNewFlavor->MimeType = rMimeType;
 pNewFlavor->HumanPresentableName = rMimeType;
 pNewFlavor->DataType = cppu::UnoType::get();
 
-rL.push_back( pNewFlavor );
+rL.push_back( std::move(pNewFlavor) );
 
 return static_cast(static_cast(rL.size()-1) + 
static_cast(SotClipboardFormatId::USER_END) + 1);
 }
@@ -332,7 +319,7 @@ SotClipboardFormatId SotExchange::RegisterFormat( const 
DataFlavor& rFlavor )
 {
 tDataFlavorList& rL = InitFormats_Impl();
 nRet = static_cast(rL.size() + 
static_cast(SotClipboardFormatId::USER_END) + 1);
-rL.push_back( new DataFlavor( rFlavor ) );
+rL.emplace_back( new DataFlavor( rFlavor ) );
 }
 
 return nRet;
@@ -433,7 +420,7 @@ SotClipboardFormatId SotExchange::GetFormatIdFromMimeType( 
const OUString& rMime
 
 for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ )
 {
-DataFlavor* pFlavor = rL[ i ];
+auto const& pFlavor = rL[ i ];
 if( pFlavor && rMimeType == pFlavor->MimeType )
 return static_cast(i + 
static_cast(SotClipboardFormatId::USER_END) + 1);
 }
@@ -470,7 +457,7 @@ SotClipboardFormatId SotExchange::GetFormat( const 
DataFlavor& rFlavor )
 tDataFlavorList& rL = InitFormats_Impl();
 for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ )
 {
-DataFlavor* pFlavor = rL[ i ];
+auto const& pFlavor = rL[ i ];
 if( pFlavor && rMimeType == pFlavor->MimeType )
 return static_cast(i + 
static_cast(SotClipboardFormatId::USER_END) + 1);
 }

[Libreoffice-commits] core.git: sot/source

2017-11-04 Thread Caolán McNamara
 sot/source/sdstor/stgcache.cxx |   35 ---
 1 file changed, 24 insertions(+), 11 deletions(-)

New commits:
commit f1c790ca3613a43dac84e2a9b6a99d1338176325
Author: Caolán McNamara 
Date:   Sat Nov 4 16:53:20 2017 +

ofz short read considered as a successful full block read

i.e StgDataStrm::Read takes the bool of no error and
multiplies it by the block size to report the length
read. A short read isn't an error so full buffer is
considered valid.

To keep #i73846# working and get deterministic fuzzing
results, zero out the trailing space of a successful but
short read. Changing this to return the truthful
number of bytes read makes #i73846# stop working.

There's wonderful nonsense here calculating nPg2,
determining nBytes to read derived from this,
reading nBytes into the buffer and then considering
it an error if nPg2 is not 1 after the presumably
potentially fatal buffer overflow if nPg2 wasn't initially
1, but this doesn't seem possible in practice

Change-Id: I2bac6066deb8a2902677e04696367ba2c351b325
Reviewed-on: https://gerrit.libreoffice.org/44310
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 8387f0290765..8f77abdbc345 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -319,6 +319,7 @@ void StgCache::Close()
 
 bool StgCache::Read( sal_Int32 nPage, void* pBuf )
 {
+sal_uInt32 nRead = 0, nBytes = m_nPageSize;
 if( Good() )
 {
 /*  #i73846# real life: a storage may refer to a page one-behind the
@@ -329,28 +330,40 @@ bool StgCache::Read( sal_Int32 nPage, void* pBuf )
 SetError( SVSTREAM_READ_ERROR );
 else if ( nPage < m_nPages )
 {
-sal_uInt32 nPos = Page2Pos( nPage );
-sal_Int32 nPg2 = ( ( nPage + 1 ) > m_nPages ) ? m_nPages - nPage : 
1;
-sal_uInt32 nBytes = nPg2 * m_nPageSize;
+sal_uInt32 nPos;
+sal_Int32 nPg2;
 // fixed address and size for the header
 if( nPage == -1 )
 {
 nPos = 0;
-nBytes = 512;
 nPg2 = 1;
+nBytes = 512;
 }
-if( m_pStrm->Tell() != nPos )
+else
 {
-m_pStrm->Seek(nPos);
+nPos = Page2Pos(nPage);
+nPg2 = ((nPage + 1) > m_nPages) ? m_nPages - nPage : 1;
 }
-m_pStrm->ReadBytes( pBuf, nBytes );
-if ( 1 != nPg2 )
-SetError( SVSTREAM_READ_ERROR );
+
+if (m_pStrm->Tell() != nPos)
+m_pStrm->Seek(nPos);
+
+if (nPg2 != 1)
+SetError(SVSTREAM_READ_ERROR);
 else
-SetError( m_pStrm->GetError() );
+{
+nRead = m_pStrm->ReadBytes(pBuf, nBytes);
+SetError(m_pStrm->GetError());
+}
 }
 }
-return Good();
+
+if (!Good())
+return false;
+
+if (nRead != nBytes)
+memset(static_cast(pBuf) + nRead, 0, nBytes - nRead);
+return true;
 }
 
 bool StgCache::Write( sal_Int32 nPage, void const * pBuf )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-10-19 Thread Caolán McNamara
 sot/source/sdstor/stgstrms.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 312a8a32a579160fd1665ab10dc37bd73c89961a
Author: Caolán McNamara 
Date:   Thu Oct 19 17:11:37 2017 +0100

ofz+ubsan: runtime error: left shift cannot be represented in type

Change-Id: Ic153b39475abbd562e4c81b47089ca8280080cff
Reviewed-on: https://gerrit.libreoffice.org/43569
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 1f7f0769f0ce..0933ba7d265e 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -71,10 +71,12 @@ rtl::Reference< StgPage > StgFAT::GetPhysPage( sal_Int32 
nByteOff )
 
 sal_Int32 StgFAT::GetNextPage( sal_Int32 nPg )
 {
-if( nPg >= 0 )
+if (nPg >= 0)
 {
-  rtl::Reference< StgPage > pPg = GetPhysPage( nPg << 2 );
-  nPg = pPg.is() ? StgCache::GetFromPage( pPg, m_nOffset >> 2 ) : STG_EOF;
+if (nPg > (SAL_MAX_INT32 >> 2))
+return STG_EOF;
+rtl::Reference< StgPage > pPg = GetPhysPage( nPg << 2 );
+nPg = pPg.is() ? StgCache::GetFromPage( pPg, m_nOffset >> 2 ) : 
STG_EOF;
 }
 return nPg;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-10-02 Thread Caolán McNamara
 sot/source/sdstor/stgio.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit b4d9f5d4d6475565530d8f698bd8f72fc685b491
Author: Caolán McNamara 
Date:   Sun Oct 1 20:58:49 2017 +0100

coverity#1418672 silence Explicit null deref

Change-Id: I9c39da02a344316b09c190a3c12bdb17201cf176
Reviewed-on: https://gerrit.libreoffice.org/43027
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index 15774bf64a2b..44b245f5f01d 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -89,6 +89,7 @@ void StgIo::SetupStreams()
 m_pDataStrm = nullptr;
 m_pFAT  = nullptr;
 ResetError();
+
 short nPhysPageSize = 1 << m_aHdr.GetPageSize();
 SetPhysPageSize(nPhysPageSize);
 sal_Int32 nFatStrmSize;
@@ -98,12 +99,11 @@ void StgIo::SetupStreams()
 SetError(SVSTREAM_FILEFORMAT_ERROR);
 m_pFAT = nullptr;
 m_pTOC = nullptr;
+return;
 }
-else
-{
-m_pFAT = new StgFATStrm(*this, nFatStrmSize);
-m_pTOC = new StgDirStrm( *this );
-}
+
+m_pFAT = new StgFATStrm(*this, nFatStrmSize);
+m_pTOC = new StgDirStrm(*this);
 if( !GetError() )
 {
 StgDirEntry* pRoot = m_pTOC->GetRoot();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-09-25 Thread Caolán McNamara
 sot/source/sdstor/stgstrms.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit a1ee7a24b1b02553ac02be14f7fe6b06359ed3fd
Author: Caolán McNamara 
Date:   Mon Sep 25 21:32:27 2017 +0100

check sot multiply

Change-Id: I9d1e86834af87cd92c2792f66ac722ba94dff040
Reviewed-on: https://gerrit.libreoffice.org/42768
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 1ecdc042f351..f449874b3b10 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1070,7 +1071,12 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n )
 nBytes = (short) n;
 if( nBytes )
 {
-if( !m_pData || !m_pData->Pos2Page( m_nPage * m_nPageSize + 
m_nOffset ) )
+if (!m_pData)
+break;
+sal_Int32 nPos;
+if (o3tl::checked_multiply(m_nPage, m_nPageSize, nPos))
+break;
+if (!m_pData->Pos2Page(nPos + m_nOffset))
 break;
 // all reading through the stream
 short nRes = (short) m_pData->Read( static_cast(pBuf) 
+ nDone, nBytes );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source vcl/workben

2017-09-22 Thread Caolán McNamara
 sot/source/sdstor/stg.cxx |1 
 sot/source/sdstor/storage.cxx |   48 +
 vcl/workben/fftester.cxx  |   15 ++-
 vcl/workben/olefuzzer.cxx |   54 +-
 4 files changed, 64 insertions(+), 54 deletions(-)

New commits:
commit 893c08b59abf31ee0ae50c4ac030b006c43c0976
Author: Caolán McNamara 
Date:   Fri Sep 22 12:32:28 2017 +0100

move TestImportOLE2 where it can be used by fftester

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

diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 67ea06b8f815..f82cd30d5e80 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -941,5 +941,4 @@ bool Storage::Equals( const BaseStorage& rStorage ) const
 return pOther && ( pOther->pEntry == pEntry );
 }
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 4445872b5f2b..9d19bafafedb 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -809,4 +809,52 @@ sal_Int32 SotStorage::GetVersion( const 
css::uno::Reference < css::embed::XStora
 return 0;
 }
 
+namespace
+{
+void traverse(const tools::SvRef& rStorage, 
std::vector& rBuf)
+{
+SvStorageInfoList infos;
+
+rStorage->FillInfoList();
+
+for (const auto& info: infos)
+{
+if (info.IsStream())
+{
+// try to open and read all content
+tools::SvRef 
xStream(rStorage->OpenSotStream(info.GetName(), StreamMode::STD_READ));
+const size_t nSize = xStream->GetSize();
+const size_t nRead = xStream->ReadBytes(rBuf.data(), nSize);
+SAL_INFO("sot", "Read " << nRead << "bytes");
+}
+else if (info.IsStorage())
+{
+tools::SvRef 
xStorage(rStorage->OpenSotStorage(info.GetName(), StreamMode::STD_READ));
+
+// continue with children
+traverse(xStorage, rBuf);
+}
+else
+{
+}
+}
+}
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportOLE2(SvStream )
+{
+try
+{
+size_t nSize = rStream.remainingSize();
+tools::SvRef xRootStorage(new SotStorage(, false));
+std::vector aTmpBuf(nSize);
+traverse(xRootStorage, aTmpBuf);
+}
+catch (...)
+{
+return false;
+}
+return true;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 4b9d6979ae54..4e806216d956 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -532,7 +532,20 @@ try_again:
 SvFileStream aFileStream(out, StreamMode::READ);
 ret = (int) (*pfnImport)(aFileStream);
 }
-
+else if (strcmp(argv[2], "ole") == 0)
+{
+static FFilterCall pfnImport(nullptr);
+if (!pfnImport)
+{
+osl::Module aLibrary;
+aLibrary.loadRelative(, "libsotlo.so", 
SAL_LOADMODULE_LAZY);
+pfnImport = reinterpret_cast(
+aLibrary.getFunctionSymbol("TestImportOLE2"));
+aLibrary.release();
+}
+SvFileStream aFileStream(out, StreamMode::READ);
+ret = (int) (*pfnImport)(aFileStream);
+}
 #endif
 }
 
diff --git a/vcl/workben/olefuzzer.cxx b/vcl/workben/olefuzzer.cxx
index f9a717122e59..6554b723f955 100644
--- a/vcl/workben/olefuzzer.cxx
+++ b/vcl/workben/olefuzzer.cxx
@@ -7,60 +7,10 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include 
-
-#include 
-
 #include 
-
 #include "commonfuzzer.hxx"
 
-namespace
-{
-
-void traverse(const tools::SvRef& rStorage, std::vector& rBuf)
-{
-SvStorageInfoList infos;
-
-rStorage->FillInfoList();
-
-for (const auto& info: infos)
-{
-if (info.IsStream())
-{
-// try to open and read all content
-tools::SvRef 
xStream(rStorage->OpenSotStream(info.GetName(), StreamMode::STD_READ));
-const size_t nSize = xStream->GetSize();
-const size_t nRead = xStream->ReadBytes(rBuf.data(), nSize);
-(void) nRead;
-}
-else if (info.IsStorage())
-{
-tools::SvRef 
xStorage(rStorage->OpenSotStorage(info.GetName(), StreamMode::STD_READ));
-
-// continue with children
-traverse(xStorage, rBuf);
-}
-else
-{
-}
-}
-}
-
-void TestImportOLE2(SvStream , size_t nSize)
-{
-try
-{
-

[Libreoffice-commits] core.git: sot/source

2017-07-13 Thread Johnny_M
 sot/source/base/exchange.cxx |   33 +---
 sot/source/base/filelist.cxx |4 +-
 sot/source/base/formats.cxx  |   64 ++-
 sot/source/base/object.cxx   |   11 +++---
 sot/source/sdstor/stgavl.cxx |2 -
 sot/source/sdstor/stgcache.cxx   |2 -
 sot/source/sdstor/stgdir.cxx |4 +-
 sot/source/sdstor/stgio.cxx  |   10 +++---
 sot/source/sdstor/stgstrms.cxx   |   14 
 sot/source/sdstor/storinfo.cxx   |2 -
 sot/source/sdstor/ucbstorage.cxx |2 -
 11 files changed, 71 insertions(+), 77 deletions(-)

New commits:
commit 0018fd1b81b3c4ec5ee1de092760479aeae7cd96
Author: Johnny_M 
Date:   Wed Jul 12 22:41:14 2017 +0200

Translate German comments/debug strings (leftovers in the sot dir)

Translates leftovers found using a custom regex and manually checking
the rest of the affected file.

Change-Id: I0e44957d58e089b82738c65a8774d1a45ea7068d
Reviewed-on: https://gerrit.libreoffice.org/39879
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 286f4c7e49e2..f4a51bff5121 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -37,12 +37,11 @@ using namespace::com::sun::star::uno;
 using namespace::com::sun::star::datatransfer;
 
 /*
-In diesen Tabellen stehen alle im Office verwendeten MimeTypes,
-Format-Bezeichner und Types.
-Die Tabelle ist nach den Formatstring-Ids sortiert und jede Id
-ist um genau 1 groesser als ihre Vorgaenger-Id, damit die Id als
-Tabellenindex benutzt werden kann.
-*/
+ *  These tables contain all MimeTypes, format identifiers, and types used in
+ *  the Office. The table is sorted by the format string ID, and each ID is
+ *  exactly 1 greater than its predecessor ID, so that the ID can be used as a
+ *  table index.
+ */
 struct DataFlavorRepresentation
 {
 const char*pMimeType;
@@ -251,12 +250,12 @@ static tDataFlavorList& InitFormats_Impl()
 |*
 |*SotExchange::RegisterFormatName()
 |*
-|*Beschreibung  CLIP.SDW
+|*Description   CLIP.SDW
 */
 SotClipboardFormatId SotExchange::RegisterFormatName( const OUString& rName )
 {
 const DataFlavorRepresentation *pFormatArray_Impl = 
FormatArray_Impl::get();
-// teste zuerst die Standard - Name
+// test the default first - name
 for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i <= 
SotClipboardFormatId::FILE_LIST;  ++i )
 if( rName.equalsAscii( pFormatArray_Impl[ static_cast(i) ].pName 
) )
 return i;
@@ -270,7 +269,7 @@ SotClipboardFormatId SotExchange::RegisterFormatName( const 
OUString& rName )
  ? SotClipboardFormatId::STARCHART_50
  : i );
 
-// dann in der dynamischen Liste
+// then in the dynamic list
 tDataFlavorList& rL = InitFormats_Impl();
 for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ )
 {
@@ -292,7 +291,7 @@ SotClipboardFormatId SotExchange::RegisterFormatName( const 
OUString& rName )
 SotClipboardFormatId SotExchange::RegisterFormatMimeType( const OUString& 
rMimeType )
 {
 const DataFlavorRepresentation *pFormatArray_Impl = 
FormatArray_Impl::get();
-// teste zuerst die Standard - Name
+// test the default first - name
 for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i <= 
SotClipboardFormatId::FILE_LIST;  ++i )
 if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast(i) 
].pMimeType ) )
 return i;
@@ -301,7 +300,7 @@ SotClipboardFormatId SotExchange::RegisterFormatMimeType( 
const OUString& rMimeT
 if( rMimeType.equalsAscii( pFormatArray_Impl[ static_cast(i) 
].pMimeType ) )
 return i;
 
-// dann in der dynamischen Liste
+// then in the dynamic list
 tDataFlavorList& rL = InitFormats_Impl();
 for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ )
 {
@@ -324,7 +323,7 @@ SotClipboardFormatId SotExchange::RegisterFormatMimeType( 
const OUString& rMimeT
 |*
 |*SotExchange::RegisterFormatName()
 |*
-|*Beschreibung  CLIP.SDW
+|*Description   CLIP.SDW
 */
 SotClipboardFormatId SotExchange::RegisterFormat( const DataFlavor& rFlavor )
 {
@@ -430,7 +429,7 @@ SotClipboardFormatId SotExchange::GetFormatIdFromMimeType( 
const OUString& rMime
  ? SotClipboardFormatId::STARCHART_50
  : i );
 
-// dann in der dynamischen Liste
+// then in the dynamic list
 tDataFlavorList& rL = InitFormats_Impl();
 
 for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ )
@@ -447,11 +446,11 @@ SotClipboardFormatId 
SotExchange::GetFormatIdFromMimeType( const OUString& rMime
 |*
 |*

[Libreoffice-commits] core.git: sot/source

2017-07-07 Thread Miklos Vajna
 sot/source/sdstor/storage.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7d876e48cb0292d94e193ea7da2538e018f0e07c
Author: Miklos Vajna 
Date:   Fri Jul 7 17:23:00 2017 +0200

sot: fix loplugin:unnecessaryparen warning

Change-Id: Ia022f6cb1e9c91c9aa49025e54699a5c7718fc75

diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index df3caff95a85..13e6c7d08ab4 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -291,7 +291,7 @@ void SotStorage::CreateStorage( bool bForceUCBStorage, 
StreamMode nMode )
 if( !m_aName.isEmpty() )
 {
 // named storage
-if( ( ( nMode & ERASEMASK ) == ERASEMASK ) )
+if( ( nMode & ERASEMASK ) == ERASEMASK )
 ::utl::UCBContentHelper::Kill( m_aName );
 
 INetURLObject aObj( m_aName );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-06-30 Thread Stephan Bergmann
 sot/source/sdstor/ucbstorage.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit c91f05e1744ea5077fa2ce2793f0aef6378b5d42
Author: Stephan Bergmann 
Date:   Fri Jun 30 16:43:48 2017 +0200

aKey is demonstratedly always empty

...since cb958bb5e0e81d343c91c08a8513006a7bf1d913 "loplugin:constantparam in
sot..svl"

Change-Id: Id74078a26efb9b7a5a8b58ea28f3142cef4ac71f

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index b6a8bae3eb2f..4e4e7382137b 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -2618,8 +2618,7 @@ BaseStorageStream* UCBStorage::OpenStream( const 
OUString& rEleName, StreamMode
 {
 // check if stream is opened with the same keyword as before
 // if not, generate a new stream because it could be encrypted 
vs. decrypted!
-OString aKey;
-if ( pElement->m_xStream->m_aKey == aKey )
+if ( pElement->m_xStream->m_aKey.isEmpty() )
 {
 pElement->m_xStream->PrepareCachedForReopen( nMode );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-06-30 Thread Stephan Bergmann
 sot/source/sdstor/ucbstorage.cxx |5 -
 1 file changed, 5 deletions(-)

New commits:
commit 42634a370dddb23c51747fe5616a4988f27e84d7
Author: Stephan Bergmann 
Date:   Fri Jun 30 16:06:10 2017 +0200

aContentType is unused

...ever since f14feb754eba67b2420c67c310440d16845f62f5 "INTEGRATION: CWS
warnings01"

Change-Id: I96bbbf55fe3136550dac229e4f247457bcb66364

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 25f3d60e4150..b6a8bae3eb2f 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1731,17 +1731,12 @@ void UCBStorage_Impl::ReadContent()
 {
 // insert all into the children list
 OUString aTitle( xRow->getString(1) );
-OUString aContentType;
 if ( m_bIsLinked )
 {
 // unpacked storages have to deal with the meta-inf folder 
by themselves
 if ( aTitle == "META-INF" )
 continue;
 }
-else
-{
-aContentType = xRow->getString(3);
-}
 
 bool bIsFolder( xRow->getBoolean(2) );
 sal_Int64 nSize = xRow->getLong(4);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-06-05 Thread Noel Grandin
 sot/source/sdstor/stg.cxx   |4 -
 sot/source/sdstor/stgio.cxx |   90 ++--
 sot/source/sdstor/stgio.hxx |   20 -
 3 files changed, 57 insertions(+), 57 deletions(-)

New commits:
commit 118bcbc83e38604189bec667a394a4acaec98f56
Author: Noel Grandin 
Date:   Mon Jun 5 10:51:04 2017 +0200

convert FatError to scoped enum

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

diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 03313496f402..f2a01cf4eb75 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -885,9 +885,9 @@ OUString Storage::GetUserName()
 bool Storage::ValidateFAT()
 {
 Link aLink = StgIo::GetErrorLink();
-ErrCode nErr = pIo->ValidateFATs();
+FatError nErr = pIo->ValidateFATs();
 StgIo::SetErrorLink( aLink );
-return nErr == ERRCODE_NONE;
+return nErr == FatError::Ok;
 }
 
 void Storage::SetDirty()
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index 0ed5097dd0ce..fcb622b9aa44 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -156,7 +156,7 @@ public:
 
 sal_Int32 GetPageSize() { return nPageSize; }
 
-sal_uLong Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect );
+FatError Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect );
 bool HasUnrefChains();
 };
 
@@ -194,7 +194,7 @@ bool EasyFat::HasUnrefChains()
 return false;
 }
 
-sal_uLong EasyFat::Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect )
+FatError EasyFat::Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect )
 {
 if( nCount > 0 )
 {
@@ -206,41 +206,41 @@ sal_uLong EasyFat::Mark( sal_Int32 nPage, sal_Int32 
nCount, sal_Int32 nExpect )
 while( nCount != 0 )
 {
 if( nCurPage < 0 || nCurPage >= nPages )
-return FAT_OUTOFBOUNDS;
+return FatError::OutOfBounds;
 pFree[ nCurPage ] = false;
 nCurPage = pFat[ nCurPage ];
 //Stream zu lang
 if( nCurPage != nExpect && nCount == 1 )
-return FAT_WRONGLENGTH;
+return FatError::WrongLength;
 //Stream zu kurz
 if( nCurPage == nExpect && nCount != 1 && nCount != -1 )
-return FAT_WRONGLENGTH;
+return FatError::WrongLength;
 // letzter Block bei Stream ohne Laenge
 if( nCurPage == nExpect && nCount == -1 )
 nCount = 1;
 if( nCount != -1 )
 nCount--;
 }
-return FAT_OK;
+return FatError::Ok;
 }
 
 class Validator
 {
-sal_uLong nError;
+FatError nError;
 
 EasyFat aSmallFat;
 EasyFat aFat;
 
 StgIo 
 
-sal_uLong ValidateMasterFATs();
-sal_uLong ValidateDirectoryEntries();
-sal_uLong FindUnrefedChains();
-sal_uLong MarkAll( StgDirEntry *pEntry );
+FatError ValidateMasterFATs();
+FatError ValidateDirectoryEntries();
+FatError FindUnrefedChains();
+FatError MarkAll( StgDirEntry *pEntry );
 
 public:
 explicit Validator( StgIo  );
-bool IsError() { return nError != 0; }
+bool IsError() { return nError != FatError::Ok; }
 };
 
 Validator::Validator( StgIo  )
@@ -248,48 +248,48 @@ Validator::Validator( StgIo  )
   aFat( rIoP, rIoP.m_pFAT, 1 << rIoP.m_aHdr.GetPageSize() ),
   rIo( rIoP )
 {
-sal_uLong nErr = nError = FAT_OK;
+FatError nErr = nError = FatError::Ok;
 
-if( ( nErr = ValidateMasterFATs() ) != FAT_OK )
+if( ( nErr = ValidateMasterFATs() ) != FatError::Ok )
 nError = nErr;
-else if(( nErr = ValidateDirectoryEntries() ) != FAT_OK )
+else if(( nErr = ValidateDirectoryEntries() ) != FatError::Ok )
 nError = nErr;
-else if(( nErr = FindUnrefedChains()) != FAT_OK )
+else if(( nErr = FindUnrefedChains()) != FatError::Ok )
 nError = nErr;
 }
 
-sal_uLong Validator::ValidateMasterFATs()
+FatError Validator::ValidateMasterFATs()
 {
 sal_Int32 nCount = rIo.m_aHdr.GetFATSize();
-sal_uLong nErr;
+FatError nErr;
 if ( !rIo.m_pFAT )
-return FAT_INMEMORYERROR;
+return FatError::InMemoryError;
 
 for( sal_Int32 i = 0; i < nCount; i++ )
 {
-if( ( nErr = aFat.Mark(rIo.m_pFAT->GetPage( short(i), false ), 
aFat.GetPageSize(), -3 )) != FAT_OK )
+if( ( nErr = aFat.Mark(rIo.m_pFAT->GetPage( short(i), false ), 
aFat.GetPageSize(), -3 )) != FatError::Ok )
 return nErr;
 }
 if( rIo.m_aHdr.GetMasters() )
-if( ( nErr = aFat.Mark(rIo.m_aHdr.GetFATChain( ), aFat.GetPageSize(), 
-4 )) != FAT_OK )
+if( ( nErr = aFat.Mark(rIo.m_aHdr.GetFATChain( ), aFat.GetPageSize(), 
-4 )) != FatError::Ok )
 return nErr;
 
-return FAT_OK;
+return FatError::Ok;
 }
 

[Libreoffice-commits] core.git: sot/source sw/source

2017-04-03 Thread Caolán McNamara
 sot/source/sdstor/ucbstorage.cxx |   15 ---
 sw/source/filter/ww8/ww8par.cxx  |1 +
 2 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit e5b0183bd8a54edcfb68fa4f3d44740a833c70ab
Author: Caolán McNamara 
Date:   Mon Apr 3 13:24:29 2017 +0100

these are file urls, so don't need ucb

Change-Id: I25beaeab002db1de34be3b5f4a774bd15b71f5d3
Reviewed-on: https://gerrit.libreoffice.org/36045
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 3d15a40dd037..a7de41a9bb00 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -124,8 +125,8 @@ FileStreamWrapper_Impl::~FileStreamWrapper_Impl()
 #endif
 }
 
-if ( !m_aURL.isEmpty() )
-::utl::UCBContentHelper::Kill( m_aURL );
+if (!m_aURL.isEmpty())
+osl::File::remove(m_aURL);
 }
 
 
@@ -227,7 +228,7 @@ void SAL_CALL FileStreamWrapper_Impl::closeInput()
 #if OSL_DEBUG_LEVEL > 0
 --nOpenFiles;
 #endif
-::utl::UCBContentHelper::Kill( m_aURL );
+osl::File::remove(m_aURL);
 m_aURL.clear();
 }
 
@@ -683,8 +684,8 @@ UCBStorageStream_Impl::~UCBStorageStream_Impl()
 
 delete m_pStream;
 
-if ( !m_aTempURL.isEmpty() )
-::utl::UCBContentHelper::Kill( m_aTempURL );
+if (!m_aTempURL.isEmpty())
+osl::File::remove(m_aTempURL);
 
 delete m_pContent;
 }
@@ -1125,7 +1126,7 @@ void UCBStorageStream_Impl::Revert()
 Free();
 if ( !m_aTempURL.isEmpty() )
 {
-::utl::UCBContentHelper::Kill( m_aTempURL );
+osl::File::remove(m_aTempURL);
 m_aTempURL.clear();
 }
 
@@ -1211,7 +1212,7 @@ void UCBStorageStream_Impl::PrepareCachedForReopen( 
StreamMode nMode )
 
 if ( !m_aTempURL.isEmpty() )
 {
-::utl::UCBContentHelper::Kill( m_aTempURL );
+osl::File::remove(m_aTempURL);
 m_aTempURL.clear();
 }
 }
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 5fa0270e53da..85e17a57f258 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -6215,6 +6215,7 @@ bool SAL_CALL TestImportDOC(SvStream , const 
OUString )
 aPaM.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(), 0);
 bool bRet = pReader->Read(*pD, OUString(), aPaM, OUString()) == 0;
 delete pReader;
+
 return bRet;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-03-21 Thread dilekuzulmez
 sot/source/sdstor/stgcache.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit e73505fe0fb44075b462a20a3b2091063db5e1b3
Author: dilekuzulmez 
Date:   Thu Mar 16 23:38:59 2017 +0300

tdf#96505 Get rid of cargo cult long integer literals

Change-Id: I6bda2915547980b33d059257c8dbd65f181f9f16
Reviewed-on: https://gerrit.libreoffice.org/35291
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 409e4729a874..57632bcc128c 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -297,7 +297,7 @@ bool StgCache::Open( const OUString& rName, StreamMode 
nMode )
 {
 sal_uLong nFileSize = m_pStrm->Seek( STREAM_SEEK_TO_END );
 m_nPages = lcl_GetPageCount( nFileSize, m_nPageSize );
-m_pStrm->Seek( 0L );
+m_pStrm->Seek( 0 );
 }
 else
 m_nPages = 0;
@@ -335,7 +335,7 @@ bool StgCache::Read( sal_Int32 nPage, void* pBuf )
 // fixed address and size for the header
 if( nPage == -1 )
 {
-nPos = 0L;
+nPos = 0;
 nBytes = 512;
 nPg2 = 1;
 }
@@ -364,7 +364,7 @@ bool StgCache::Write( sal_Int32 nPage, void* pBuf )
 // nPageSize must be >= 512, otherwise the header can not be written 
here, we check it on import
 if( nPage == -1 )
 {
-nPos = 0L;
+nPos = 0;
 nBytes = 512;
 }
 if( m_pStrm->Tell() != nPos )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-03-21 Thread Caolán McNamara
 sot/source/sdstor/storage.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 63a9cca54e589bfeff3f6214fc63e010f5662c1c
Author: Caolán McNamara 
Date:   Tue Mar 21 11:47:25 2017 +

fix indent

Change-Id: I6facc99a16c29275771f46d397162bcd4f4a27b0

diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index adce130e11f3..eb3ddae6169c 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -748,7 +748,7 @@ SotStorage* SotStorage::OpenOLEStorage( const 
css::uno::Reference < css::embed::
 uno::makeAny( OUString(  
"application/vnd.sun.star.oleobject"  ) ) );
 }
 
-   pStream = utl::UcbStreamHelper::CreateStream( xStream );
+pStream = utl::UcbStreamHelper::CreateStream( xStream );
 }
 catch ( uno::Exception& )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-02-27 Thread Stephan Bergmann
 sot/source/sdstor/stgelem.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 377efdcea0687f5b79e92874db15171043b3de97
Author: Stephan Bergmann 
Date:   Mon Feb 27 13:01:37 2017 +0100

loplugin:loopvartoosmall

Change-Id: I3ada4fc8c8ebcf04962be03c048fb87bc0d6dbf8

diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 12ed731..0fb80c4 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -323,7 +323,7 @@ bool StgEntry::SetName( const OUString& rName )
 m_aName = m_aName.copy(0, nMaxLegalStr);
 }
 
-sal_uInt16 i;
+sal_Int32 i;
 for( i = 0; i < rName.getLength() && i <= nMaxLegalStr; i++ )
 {
 m_nName[ i ] = rName[ i ];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-01-31 Thread Jochen Nitschke
 sot/source/base/formats.cxx | 2496 +---
 1 file changed, 1231 insertions(+), 1265 deletions(-)

New commits:
commit 0d17c4fa4994debb1a0d653ad9fb816c46623a57
Author: Jochen Nitschke 
Date:   Tue Jan 31 12:51:16 2017 +0100

inline macros

move static arrays to anonymous namespace
try creating the SotAction arrays at compile time with constexpr

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

diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index 6ff84b1..64a19aa 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -39,9 +39,9 @@ struct SotAction_Impl
 SotExchangeActionFlags nFlags; // Action Id
 sal_uInt8  nContextCheckId;// additional check of content 
in clipboard
 
-SotAction_Impl(SotClipboardFormatId _nFormatId, sal_uInt16 _nAction, 
SotExchangeActionFlags _nFlags, sal_uInt8 _nContextCheckId)
+SAL_CONSTEXPR SotAction_Impl(SotClipboardFormatId _nFormatId, sal_uInt16 
_nAction, SotExchangeActionFlags _nFlags, sal_uInt8 _nContextCheckId)
 : nFormatId(_nFormatId), nAction(_nAction), nFlags(_nFlags), 
nContextCheckId(_nContextCheckId) {}
-SotAction_Impl(SotClipboardFormatId _nFormatId, sal_uInt16 _nAction)
+SAL_CONSTEXPR SotAction_Impl(SotClipboardFormatId _nFormatId, sal_uInt16 
_nAction)
 : nFormatId(_nFormatId), nAction(_nAction), 
nFlags(SotExchangeActionFlags::NONE), nContextCheckId(0) {}
 };
 
@@ -69,7 +69,8 @@ struct SotDestinationEntry_Impl
 const SotAction_Impl*   aLinkActions;
 };
 
-
+namespace
+{
 /*
 Ueber diese Tabelle erfolgt die Zuordnung von Destination, vorhandenen
 Datenformaten sowie gewuenschter Aktion zu einer Aktion und dem in
@@ -85,1267 +86,1237 @@ struct SotDestinationEntry_Impl
 Format-Prioritaet sortiert. Eintrag Null hat die hoechste Prioritaet.
 */
 
-#define EXCHG_EMPYT_ARRAY \
-static SotAction_Impl const aEmptyArr[] = \
-{ \
-{ static_cast(0x), 0 }   
   \
-};
-
-#define EXCHG_DEST_DOC_OLEOBJ_ARRAY \
-static SotAction_Impl const aEXCHG_DEST_DOC_OLEOBJ_Def[] =\
-{   \
-{ SotClipboardFormatId::INET_IMAGE, EXCHG_IN_ACTION_LINK },
  \
-{ SotClipboardFormatId::NETSCAPE_IMAGE, EXCHG_IN_ACTION_LINK },
  \
-{ SotClipboardFormatId::FILE_LIST, EXCHG_IN_ACTION_LINK }, 
\
-{ SotClipboardFormatId::SIMPLE_FILE, EXCHG_IN_ACTION_LINK },   
   \
-{ SotClipboardFormatId::NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK }, 
  \
-{ SotClipboardFormatId::FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, 
SotExchangeActionFlags::NONE, FILEGRPDSC_ONLY_URL },   \
-{ SotClipboardFormatId::UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK 
},   \
-{ static_cast(0x), 0 }   
   \
-};  \
-static SotAction_Impl const aEXCHG_DEST_DOC_OLEOBJ_Move[] =   \
-{   \
-{ SotClipboardFormatId::SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP },  
  \
-{ static_cast(0x), 0 }   
   \
-};  \
-static SotAction_Impl const aEXCHG_DEST_DOC_OLEOBJ_Link[] =   \
-{   \
-{ SotClipboardFormatId::INET_IMAGE, 
EXCHG_OUT_ACTION_INSERT_INTERACTIVE },   \
-{ SotClipboardFormatId::NETSCAPE_IMAGE, 
EXCHG_OUT_ACTION_INSERT_INTERACTIVE },   \
-{ SotClipboardFormatId::FILE_LIST, EXCHG_OUT_ACTION_INSERT_INTERACTIVE 
},  \
-{ SotClipboardFormatId::SIMPLE_FILE, 
EXCHG_OUT_ACTION_INSERT_INTERACTIVE },   \
-{ SotClipboardFormatId::NETSCAPE_BOOKMARK, 
EXCHG_OUT_ACTION_INSERT_INTERACTIVE },\
-{ SotClipboardFormatId::FILEGRPDESCRIPTOR, 
EXCHG_OUT_ACTION_INSERT_INTERACTIVE, SotExchangeActionFlags::NONE, 
FILEGRPDSC_ONLY_URL },\
-{ SotClipboardFormatId::UNIFORMRESOURCELOCATOR, 
EXCHG_OUT_ACTION_INSERT_INTERACTIVE },\
-{ SotClipboardFormatId::SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP },  
  \
-{ static_cast(0x), 0 }   
   \
-};
-
-#define EXCHG_DEST_CHARTDOC_OLEOBJ_ARRAY   

[Libreoffice-commits] core.git: sot/source

2017-01-22 Thread Jochen Nitschke
 sot/source/sdstor/stgstrms.cxx |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit ffafd5e4a0c02fdcf47674866a9428a2158c0ae4
Author: Jochen Nitschke 
Date:   Sun Jan 22 11:06:44 2017 +0100

cppcheck: useInitializationList

don't initialise the unique_ptr m_pFat twice

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

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 3503421..8f6f584 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -318,14 +318,16 @@ bool StgFAT::FreePages( sal_Int32 nStart, bool bAll )
 // and accessing the data on a physical basis. It uses the built-in
 // FAT class for the page allocations.
 
-StgStrm::StgStrm( StgIo& r ) : m_rIo( r )
+StgStrm::StgStrm( StgIo& r )
+: m_rIo(r),
+  m_pEntry(nullptr),
+  m_nStart(STG_EOF),
+  m_nSize(0),
+  m_nPos(0),
+  m_nPage(STG_EOF),
+  m_nOffset(0),
+  m_nPageSize(m_rIo.GetPhysPageSize())
 {
-m_pFat= nullptr;
-m_nStart  = m_nPage = STG_EOF;
-m_nOffset = 0;
-m_pEntry  = nullptr;
-m_nPos = m_nSize = 0;
-m_nPageSize = m_rIo.GetPhysPageSize();
 }
 
 StgStrm::~StgStrm()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2017-01-20 Thread Noel Grandin
 sot/source/sdstor/stgcache.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a55e5389a84542768568acc7fd69af20e3fe0745
Author: Noel Grandin 
Date:   Fri Jan 20 11:39:51 2017 +0200

this field should be std::unique_ptr to sal_uInt8[], not sal_uInt8

Change-Id: Ia4ca8693e7c89a23ccbf2e71261c072dd6f8affa

diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx
index 5964902..14942e3 100644
--- a/sot/source/sdstor/stgcache.hxx
+++ b/sot/source/sdstor/stgcache.hxx
@@ -96,7 +96,7 @@ public:
 class StgPage : public salhelper::SimpleReferenceObject
 {
 const sal_Int32 mnPage;// page index
-std::unique_ptr
+std::unique_ptr
 mpData;// nSize bytes
 short   mnSize;// size of this page
  StgPage( short nData, sal_Int32 nPage );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source starmath/inc starmath/source

2016-10-27 Thread Noel Grandin
 sot/source/sdstor/stgcache.cxx|2 +-
 sot/source/sdstor/stgcache.hxx|1 -
 starmath/inc/ElementsDockingWindow.hxx|2 --
 starmath/inc/dialog.hxx   |1 -
 starmath/inc/rect.hxx |2 --
 starmath/inc/utility.hxx  |1 -
 starmath/source/ElementsDockingWindow.cxx |7 +--
 starmath/source/cfgitem.cxx   |   10 ++
 starmath/source/cfgitem.hxx   |1 -
 starmath/source/dialog.cxx|2 +-
 starmath/source/mathmlimport.cxx  |2 +-
 starmath/source/mathmlimport.hxx  |4 
 starmath/source/rect.cxx  |   10 ++
 starmath/source/utility.cxx   |   19 +++
 14 files changed, 15 insertions(+), 49 deletions(-)

New commits:
commit 618171552e1bcddb07660167d9df4512435269b0
Author: Noel Grandin 
Date:   Thu Oct 27 10:50:45 2016 +0200

loplugin:expandablemethods in sot..starmath

Change-Id: I5b718bbda9ceca5bbfd1e6482ebd215e15884956
Reviewed-on: https://gerrit.libreoffice.org/30318
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 55f91f12..2ee2c28 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -274,7 +274,7 @@ void StgCache::SetStrm( UCBStorageStream* pStgStream )
 
 void StgCache::SetDirty( const rtl::Reference< StgPage >  )
 {
-assert( IsWritable() );
+assert( m_pStrm && m_pStrm->IsWritable() );
 maDirtyPages[ rPage->GetPage() ] = rPage;
 }
 
diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx
index 0fafeba..5a1ec38 100644
--- a/sot/source/sdstor/stgcache.hxx
+++ b/sot/source/sdstor/stgcache.hxx
@@ -70,7 +70,6 @@ public:
 SvStream* GetStrm() { return m_pStrm; }
 void  SetStrm( SvStream*, bool );
 void  SetStrm( UCBStorageStream* );
-bool  IsWritable() const{ return ( m_pStrm && 
m_pStrm->IsWritable() ); }
 bool  Good() const  { return m_nError == SVSTREAM_OK; }
 ErrCode GetError()  { return m_nError;}
 void  MoveError( StorageBase& );
diff --git a/starmath/inc/ElementsDockingWindow.hxx 
b/starmath/inc/ElementsDockingWindow.hxx
index 15ca546..50b1648 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -106,8 +106,6 @@ class SmElementsControl : public Control
 
 void addElements(const sal_uInt16 aElementsArray[][2], sal_uInt16 size);
 
-void addSeparator();
-
 void build();
 
 //if pContext is not NULL, then draw, otherwise
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 047f115..79bc363 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -379,7 +379,6 @@ public:
 
 boolSelectSymbolSet(const OUString );
 voidSelectSymbol(sal_uInt16 nSymbolPos);
-sal_uInt16  GetSelectedSymbol() const   { return 
m_pSymbolSetDisplay->GetSelectSymbol(); }
 };
 
 
diff --git a/starmath/inc/rect.hxx b/starmath/inc/rect.hxx
index c28e1d2..5f20fda 100644
--- a/starmath/inc/rect.hxx
+++ b/starmath/inc/rect.hxx
@@ -111,8 +111,6 @@ class SmRect
 protected:
 void BuildRect (const OutputDevice , const SmFormat *pFormat,
 const OUString , sal_uInt16 nBorderWidth);
-void Init(const OutputDevice , const SmFormat *pFormat,
-  const OUString , sal_uInt16 nBorderWidth);
 
 inline  void CopyMBL(const SmRect& rRect);
 void CopyAlignInfo(const SmRect& rRect);
diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index be4c84d..7920fc8 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -122,7 +122,6 @@ public:
 virtual ~SmFontPickList() { Clear(); }
 
 virtual voidInsert(const vcl::Font );
-voidRemove(const vcl::Font );
 
 voidClear();
 vcl::Font   Get(sal_uInt16 nPos = 0) const;
diff --git a/starmath/source/ElementsDockingWindow.cxx 
b/starmath/source/ElementsDockingWindow.cxx
index fe517fb..4721e51 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -502,11 +502,6 @@ void SmElementsControl::DoScroll(long nDelta)
 Invalidate();
 }
 
-void SmElementsControl::addSeparator()
-{
-maElementList.push_back(o3tl::make_unique());
-}
-
 void SmElementsControl::addElement(const OUString& aElementVisual, const 
OUString& aElementSource, const OUString& aHelpText)
 {
 std::unique_ptr pNode(SmParser().ParseExpression(aElementVisual));
@@ -541,7 +536,7 @@ void SmElementsControl::addElements(const sal_uInt16 
aElementsArray[][2], sal_uI
 sal_uInt16 aElementId = aElementsArray[i][0];
 sal_uInt16 

[Libreoffice-commits] core.git: sot/source starmath/inc stoc/source store/source svl/source svtools/inc svtools/source

2016-10-14 Thread Noel Grandin
 sot/source/sdstor/ucbstorage.cxx|6 +++---
 starmath/inc/caret.hxx  |6 +++---
 starmath/inc/unomodel.hxx   |2 +-
 stoc/source/security/permissions.h  |2 +-
 store/source/storbase.hxx   |6 +++---
 store/source/storcach.cxx   |2 +-
 store/source/stordata.hxx   |2 +-
 store/source/stortree.hxx   |2 +-
 svl/source/items/stylepool.cxx  |2 +-
 svtools/inc/roadmap.hxx |2 +-
 svtools/source/control/ctrlbox.cxx  |6 --
 svtools/source/control/roadmap.cxx  |2 +-
 svtools/source/control/tabbar.cxx   |4 ++--
 svtools/source/graphic/grfcache.hxx |4 ++--
 14 files changed, 25 insertions(+), 23 deletions(-)

New commits:
commit faf4bf0c3e017b9caec27a1f7355c9cf636bf19b
Author: Noel Grandin 
Date:   Fri Oct 14 10:52:44 2016 +0200

loplugin:countusersofdefaultparams in sot..svtools

Change-Id: Ifce19de3518f3eaf5a1b6439f9053feee4a33c14

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index f0555e5..b0a4f87 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -436,8 +436,8 @@ public:
 // reference is destroyed
 boolm_bIsOLEStorage;// an OLEStorage on a 
UCBStorageStream makes this an Autocommit-stream
 
-UCBStorageStream_Impl( const OUString&, 
StreamMode, UCBStorageStream*, bool, const OString* pKey=nullptr,
-   bool bRepair = false, 
Reference< XProgressHandler > const & xProgress = Reference< XProgressHandler 
>() );
+UCBStorageStream_Impl( const OUString&, 
StreamMode, UCBStorageStream*, bool, const OString* pKey,
+   bool bRepair, 
Reference< XProgressHandler > const & xProgress );
 
 voidFree();
 boolInit();
@@ -500,7 +500,7 @@ public:
 UCBStorage_Impl( const ::ucbhelper::Content&, 
const OUString&, StreamMode, UCBStorage*, bool,
  bool, bool = false, 
Reference< XProgressHandler > const & = Reference< XProgressHandler >() );
 UCBStorage_Impl( const OUString&, StreamMode, 
UCBStorage*, bool, bool,
- bool = false, Reference< 
XProgressHandler > const & = Reference< XProgressHandler >() );
+ bool, Reference< 
XProgressHandler > const & );
 UCBStorage_Impl( SvStream&, UCBStorage*, bool 
);
 voidInit();
 sal_Int16   Commit();
diff --git a/starmath/inc/caret.hxx b/starmath/inc/caret.hxx
index e2c6486..08afcce 100644
--- a/starmath/inc/caret.hxx
+++ b/starmath/inc/caret.hxx
@@ -99,9 +99,9 @@ private:
 
 /** An entry in SmCaretPosGraph */
 struct SmCaretPosGraphEntry{
-SmCaretPosGraphEntry(SmCaretPos pos = SmCaretPos(),
-   SmCaretPosGraphEntry* left = nullptr,
-   SmCaretPosGraphEntry* right = nullptr){
+SmCaretPosGraphEntry(SmCaretPos pos,
+ SmCaretPosGraphEntry* left,
+ SmCaretPosGraphEntry* right) {
 CaretPos = pos;
 Left = left;
 Right = right;
diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx
index f20cdb8..34133b0 100644
--- a/starmath/inc/unomodel.hxx
+++ b/starmath/inc/unomodel.hxx
@@ -59,7 +59,7 @@ protected:
 virtual void _getPropertyValues( const comphelper::PropertyMapEntry** 
ppEntries, css::uno::Any* pValue )
 throw (css::uno::RuntimeException, 
css::beans::UnknownPropertyException, css::lang::WrappedTargetException, 
std::exception) override;
 public:
-explicit SmModel( SfxObjectShell *pObjSh = nullptr );
+explicit SmModel( SfxObjectShell *pObjSh );
 virtual ~SmModel() throw () override;
 
 //XInterface
diff --git a/stoc/source/security/permissions.h 
b/stoc/source/security/permissions.h
index dbdf8a0..582244e 100644
--- a/stoc/source/security/permissions.h
+++ b/stoc/source/security/permissions.h
@@ -39,7 +39,7 @@ public:
 
 inline Permission(
 t_type type,
-::rtl::Reference< Permission > const & next = ::rtl::Reference< 
Permission >() )
+::rtl::Reference< Permission > const & next )
 : m_next( next )
 , m_type( type )
 {}
diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx
index 0b16fae..f3224b2 100644
--- a/store/source/storbase.hxx
+++ b/store/source/storbase.hxx
@@ -140,9 +140,9 @@ struct OStorePageDescriptor
 /** Construction.
  */
 explicit OStorePageDescriptor (
-sal_uInt32 nAddr = STORE_PAGE_NULL,
-sal_uInt16 nSize = 0,
-

[Libreoffice-commits] core.git: sot/source

2016-06-14 Thread krishna keshav
 sot/source/sdstor/storinfo.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3c573174dab0f1c6a85ce50ad4210c8772bdcf9a
Author: krishna keshav 
Date:   Tue May 31 00:20:13 2016 +0530

tdf#96505 Get rid of cargo cult long integer literals

cleanup in sot/source/stdsor/storinfo.cxx

Change-Id: Ib904cb3ddc18dc90e479b35ca21ae4649abd0f0c
Reviewed-on: https://gerrit.libreoffice.org/25684
Tested-by: Jenkins 
Reviewed-by: jan iversen 
Tested-by: jan iversen 

diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx
index bfcd214..1c5025b 100644
--- a/sot/source/sdstor/storinfo.cxx
+++ b/sot/source/sdstor/storinfo.cxx
@@ -43,7 +43,7 @@ SotClipboardFormatId ReadClipboardFormat( SvStream & rStm )
 else
 rStm.SetError( SVSTREAM_GENERALERROR );
 }
-else if( nLen == -1L )
+else if( nLen == -1 )
 {
 // Windows clipboard format
 // SV und Win stimmen ueberein (bis einschl. 
SotClipboardFormatId::GDIMETAFILE)
@@ -51,7 +51,7 @@ SotClipboardFormatId ReadClipboardFormat( SvStream & rStm )
 rStm.ReadUInt32( nTmp );
 nFormat = static_cast(nTmp);
 }
-else if( nLen == -2L )
+else if( nLen == -2 )
 {
 sal_uInt32 nTmp;
 rStm.ReadUInt32( nTmp );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2016-06-08 Thread Noel Grandin
 sot/source/sdstor/stgdir.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit f9a6d8255240c5841746400de7c9ed6a170e6f53
Author: Noel Grandin 
Date:   Wed Jun 8 14:44:01 2016 +0200

remove "trying to resize readonly stream" warning

some of code appears to rely on this clamping behaviour for correct
functioning

Change-Id: I3448994967cdc7631476a947fac0c0dda55181d3

diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index 7f1230c..dacd890 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -417,13 +417,11 @@ sal_Int32 StgDirEntry::Seek( sal_Int32 nNew )
 if( nNew < 0 )
 nNew = nSize;
 
-// try to enlarge, the readonly streams should not allow this
+// try to enlarge, readonly streams do not allow this
 if( nNew > nSize )
 {
 if ( !( m_nMode & StreamMode::WRITE ) || !SetSize( nNew ) )
 {
-SAL_WARN_IF(!(m_nMode & StreamMode::WRITE), "sot",
-"Trying to resize readonly stream by seeking, could be a 
wrong offset: " << nNew);
 return m_nPos;
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2016-04-04 Thread Noel Grandin
 sot/source/sdstor/ucbstorage.cxx   |5 +++--
 sot/source/unoolestorage/xolesimplestorage.cxx |2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 3900df378ccce285b49a71dbbc3e7bc23c9e7d64
Author: Noel Grandin 
Date:   Fri Apr 1 08:06:17 2016 +0200

remove some unnecessary realloc'ing

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

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index d3b53a7..ec3003b 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -145,13 +145,14 @@ sal_Int32 SAL_CALL 
FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData
 
 ::osl::MutexGuard aGuard( m_aMutex );
 
-aData.realloc(nBytesToRead);
+if (aData.getLength() < nBytesToRead)
+aData.realloc(nBytesToRead);
 
 sal_uInt32 nRead = m_pSvStream->Read(static_cast(aData.getArray()), 
nBytesToRead);
 checkError();
 
 // Wenn gelesene Zeichen < MaxLength, Sequence anpassen
-if (nRead < (sal_uInt32)nBytesToRead)
+if ((sal_Int32)nRead < aData.getLength())
 aData.realloc( nRead );
 
 return nRead;
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx 
b/sot/source/unoolestorage/xolesimplestorage.cxx
index fd23760..76f2b76 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -203,8 +203,6 @@ void OLESimpleStorage::InsertInputStreamToStorage_Impl( 
BaseStorage* pStorage, c
 do
 {
 nRead = xInputStream->readBytes( aData, nBytesCount );
-if ( nRead < nBytesCount )
-aData.realloc( nRead );
 
 sal_Int32 nWritten = pNewStream->Write( aData.getArray(), nRead );
 if ( nWritten < nRead )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2016-03-11 Thread Rohan Kumar
 sot/source/sdstor/ucbstorage.cxx |   19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 004c233d30a432ba4e8e4c0d0052d34798850bd4
Author: Rohan Kumar 
Date:   Wed Mar 9 16:07:44 2016 +0530

tdf#91794 remove OSL_DEBUG_LEVEL > 1 conditionals

I removed OSL_DEBUG_LEVEL > 1 conditionals and replaced them with
OSL_DEBUG_LEVEL > 0 as suggested in easy hack

Change-Id: I6495bf203365356e0969a057f5238c2343931d2b
Reviewed-on: https://gerrit.libreoffice.org/23061
Tested-by: Jenkins 
Reviewed-by: Björn Michaelsen 

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 3b69a4b..d3b53a7 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -74,8 +74,7 @@ using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::sdbc;
 using namespace ::ucbhelper;
 
-#if OSL_DEBUG_LEVEL > 1
-#include 
+#if OSL_DEBUG_LEVEL > 0
 static int nOpenFiles=0;
 static int nOpenStreams=0;
 #endif
@@ -120,7 +119,7 @@ FileStreamWrapper_Impl::~FileStreamWrapper_Impl()
 if ( m_pSvStream )
 {
 delete m_pSvStream;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
 --nOpenFiles;
 #endif
 }
@@ -225,7 +224,7 @@ void SAL_CALL FileStreamWrapper_Impl::closeInput() throw( 
NotConnectedException,
 ::osl::MutexGuard aGuard( m_aMutex );
 checkConnected();
 DELETEZ( m_pSvStream );
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
 --nOpenFiles;
 #endif
 ::utl::UCBContentHelper::Kill( m_aURL );
@@ -288,7 +287,7 @@ void FileStreamWrapper_Impl::checkConnected()
 if ( !m_pSvStream )
 {
 m_pSvStream = ::utl::UcbStreamHelper::CreateStream( m_aURL, 
STREAM_STD_READ );
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
 ++nOpenFiles;
 #endif
 }
@@ -729,7 +728,7 @@ bool UCBStorageStream_Impl::Init()
 m_aTempURL = ::utl::TempFile().GetURL();
 
 m_pStream = ::utl::UcbStreamHelper::CreateStream( m_aTempURL, 
STREAM_STD_READWRITE, true /* bFileExists */ );
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
 ++nOpenFiles;
 #endif
 
@@ -1206,7 +1205,7 @@ bool UCBStorageStream_Impl::Clear()
 
 void UCBStorageStream_Impl::Free()
 {
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
 if ( m_pStream )
 {
 if ( !m_aTempURL.isEmpty() )
@@ -2253,9 +2252,9 @@ sal_Int16 UCBStorage_Impl::Commit()
 }
 else
 {
-#if OSL_DEBUG_LEVEL > 1
-fprintf ( stderr, "Files: %i\n", nOpenFiles );
-fprintf ( stderr, "Streams: %i\n", nOpenStreams );
+#if OSL_DEBUG_LEVEL > 0
+SAL_INFO("sot", "Files: " << nOpenFiles);
+SAL_INFO("sot", "Streams: " << nOpenStreams);
 #endif
 // force writing
 Any aAny;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2015-10-27 Thread Stephan Bergmann
 sot/source/sdstor/stgio.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5472c41350a56963b97b78d0355a74aeec6c46b5
Author: Stephan Bergmann 
Date:   Tue Oct 27 14:05:26 2015 +0100

Typo, I pressume?

Change-Id: I5ee823c58061e31913c37291d5a854837fb48240

diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index 350d0d6..538a3c2 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -127,7 +127,7 @@ bool StgIo::CommitAll()
 if( m_aHdr.Store( *this ) )
 {
 m_pStrm->Flush();
-const ErrCode n = pStrm->GetError();
+const ErrCode n = m_pStrm->GetError();
 SetError( n );
 #ifdef DBG_UTIL
 if( n==SVSTREAM_OK ) ValidateFATs();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2015-10-27 Thread Matteo Casalin
 sot/source/sdstor/stgstrms.cxx |   22 ++
 sot/source/sdstor/stgstrms.hxx |2 +-
 2 files changed, 11 insertions(+), 13 deletions(-)

New commits:
commit 51bc0594f2d65630cf167a107f3be3f79993e6d9
Author: Matteo Casalin 
Date:   Tue Oct 27 18:25:07 2015 +0100

sal_uLong to sal_uInt64/sal_Size

Change-Id: I4032b08225f1b530a43f1a8c09c5fc3515f45ced

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index f21bc25..4367fc7 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -,7 +,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, 
sal_Int32 n )
 
 #define THRESHOLD 32768L
 
-StgTmpStrm::StgTmpStrm( sal_uLong nInitSize )
+StgTmpStrm::StgTmpStrm( sal_uInt64 nInitSize )
   : SvMemoryStream( nInitSize > THRESHOLD
   ? 16
 : ( nInitSize ? nInitSize : 16 ), 4096 )
@@ -1125,8 +1125,8 @@ StgTmpStrm::StgTmpStrm( sal_uLong nInitSize )
 
 bool StgTmpStrm::Copy( StgTmpStrm& rSrc )
 {
-sal_uLong n= rSrc.GetSize();
-sal_uLong nCur = rSrc.Tell();
+sal_uInt64 n = rSrc.GetSize();
+const sal_uInt64 nCur = rSrc.Tell();
 SetSize( n );
 if( GetError() == SVSTREAM_OK )
 {
@@ -1135,9 +1135,7 @@ bool StgTmpStrm::Copy( StgTmpStrm& rSrc )
 Seek( 0L );
 while( n )
 {
-sal_uLong nn = n;
-if( nn > 4096 )
-nn = 4096;
+const sal_uInt64 nn = std::min(n, 4096);
 if( rSrc.Read( p.get(), nn ) != nn )
 break;
 if( Write( p.get(), nn ) != nn )
@@ -1187,15 +1185,15 @@ void StgTmpStrm::SetSize(sal_uInt64 n)
 {
 m_aName = utl::TempFile(0, false).GetURL();
 SvFileStream* s = new SvFileStream( m_aName, STREAM_READWRITE );
-sal_uLong nCur = Tell();
-sal_uLong i = nEndOfData;
+const sal_uInt64 nCur = Tell();
+sal_uInt64 i = nEndOfData;
 std::unique_ptr p(new sal_uInt8[ 4096 ]);
 if( i )
 {
 Seek( 0L );
 while( i )
 {
-sal_uLong nb = ( i > 4096 ) ? 4096 : i;
+const sal_uInt64 nb = std::min(i, 4096);
 if( Read( p.get(), nb ) == nb
 && s->Write( p.get(), nb ) == nb )
 i -= nb;
@@ -1213,7 +1211,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n)
 i = n - nEndOfData;
 while (i)
 {
-sal_uLong const nb = (i > 4096) ? 4096 : i;
+const sal_uInt64 nb = std::min(i, 4096);
 if (s->Write(p.get(), nb) == nb)
 i -= nb;
 else
@@ -1247,7 +1245,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n)
 }
 }
 
-sal_uLong StgTmpStrm::GetData( void* pData, sal_uLong n )
+sal_Size StgTmpStrm::GetData( void* pData, sal_Size n )
 {
 if( m_pStrm )
 {
@@ -1259,7 +1257,7 @@ sal_uLong StgTmpStrm::GetData( void* pData, sal_uLong n )
 return SvMemoryStream::GetData( pData, n );
 }
 
-sal_uLong StgTmpStrm::PutData( const void* pData, sal_uLong n )
+sal_Size StgTmpStrm::PutData( const void* pData, sal_Size n )
 {
 sal_uInt32 nCur = Tell();
 sal_uInt32 nNew = nCur + n;
diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx
index 94f3049..2ce3ff3 100644
--- a/sot/source/sdstor/stgstrms.hxx
+++ b/sot/source/sdstor/stgstrms.hxx
@@ -151,7 +151,7 @@ class StgTmpStrm : public SvMemoryStream
 virtual void FlushData() override;
 
 public:
-explicit StgTmpStrm( sal_uLong=16 );
+explicit StgTmpStrm( sal_uInt64=16 );
 virtual ~StgTmpStrm();
 bool Copy( StgTmpStrm& );
 virtual void SetSize( sal_uInt64 ) override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2015-10-27 Thread Stephan Bergmann
 sot/source/sdstor/stgstrms.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 6a87d1d7a9fde5bc24cb16642d235044906fe0a8
Author: Stephan Bergmann 
Date:   Tue Oct 27 14:38:03 2015 +0100

Fix StgTmpStrm::GetSize

Change-Id: I49891d6c2149154c4fd524f79f3cbda17568fa7e

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index cffe639..f21bc25 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -1163,12 +1163,12 @@ StgTmpStrm::~StgTmpStrm()
 }
 }
 
-sal_uLong StgTmpStrm::GetSize() const
+sal_uInt64 StgTmpStrm::GetSize() const
 {
-sal_uLong n;
+sal_uInt64 n;
 if( m_pStrm )
 {
-sal_uLong old = m_pStrm->Tell();
+sal_uInt64 old = m_pStrm->Tell();
 n = m_pStrm->Seek( STREAM_SEEK_TO_END );
 m_pStrm->Seek( old );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2015-10-13 Thread Miklos Vajna
 sot/source/sdstor/stgdir.cxx   |   44 +++---
 sot/source/sdstor/stgstrms.cxx |  280 -
 sot/source/sdstor/stgstrms.hxx |   22 +--
 3 files changed, 173 insertions(+), 173 deletions(-)

New commits:
commit 3f7d7a218eac78e8bcbb8575f2727074baf4b924
Author: Miklos Vajna 
Date:   Tue Oct 13 09:37:32 2015 +0200

sot: prefix remaining StgStrm members

Change-Id: I2a70543bf3137f8d5a76e610a2aff6a3a3fcab4e

diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index 821cb91..b5113ca 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -725,8 +725,8 @@ StgDirStrm::StgDirStrm( StgIo& r )
 {
 if( r.GetError() )
 return;
-m_nEntries = nPageSize / STGENTRY_SIZE;
-if( nStart == STG_EOF )
+m_nEntries = m_nPageSize / STGENTRY_SIZE;
+if( m_nStart == STG_EOF )
 {
 StgEntry aRoot;
 aRoot.Init();
@@ -739,9 +739,9 @@ StgDirStrm::StgDirStrm( StgIo& r )
 {
 // temporarily use this instance as owner, so
 // the TOC pages can be removed.
-pEntry = reinterpret_cast(this); // just for a bit 
pattern
+m_pEntry = reinterpret_cast(this); // just for a bit 
pattern
 SetupEntry( 0, m_pRoot );
-pEntry = NULL;
+m_pEntry = NULL;
 }
 }
 
@@ -757,7 +757,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* 
pUpper )
 void* p = ( n == STG_FREE ) ? NULL : GetEntry( n );
 if( p )
 {
-SvStream *pUnderlyingStream = rIo.GetStrm();
+SvStream *pUnderlyingStream = m_rIo.GetStrm();
 sal_uInt64 nCur = pUnderlyingStream->Tell();
 sal_uInt64 nUnderlyingStreamSize = 
pUnderlyingStream->Seek(STREAM_SEEK_TO_END);
 pUnderlyingStream->Seek(nCur);
@@ -768,7 +768,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* 
pUpper )
 if( !bOk )
 {
 delete pCur;
-rIo.SetError( SVSTREAM_GENERALERROR );
+m_rIo.SetError( SVSTREAM_GENERALERROR );
 // an error occurred
 return;
 }
@@ -787,7 +787,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* 
pUpper )
 if (nLeaf != STG_FREE && nLeaf == n)
 {
 delete pCur;
-rIo.SetError( SVSTREAM_GENERALERROR );
+m_rIo.SetError( SVSTREAM_GENERALERROR );
 return;
 }
 }
@@ -847,7 +847,7 @@ bool StgDirStrm::SetSize( sal_Int32 nBytes )
 if ( nBytes < 0 )
 nBytes = 0;
 
-nBytes = ( ( nBytes + nPageSize - 1 ) / nPageSize ) * nPageSize;
+nBytes = ( ( nBytes + m_nPageSize - 1 ) / m_nPageSize ) * m_nPageSize;
 return StgStrm::SetSize( nBytes );
 }
 
@@ -857,16 +857,16 @@ bool StgDirStrm::Store()
 {
 if( !m_pRoot || !m_pRoot->IsDirty() )
 return true;
-if( !m_pRoot->StoreStreams( rIo ) )
+if( !m_pRoot->StoreStreams( m_rIo ) )
 return false;
 // After writing all streams, the data FAT stream has changed,
 // so we have to commit the root again
 m_pRoot->Commit();
 // We want a completely new stream, so fake an empty stream
-sal_Int32 nOldStart = nStart;   // save for later deletion
-sal_Int32 nOldSize  = nSize;
-nStart = nPage = STG_EOF;
-nSize  = m_nPos = 0;
+sal_Int32 nOldStart = m_nStart;   // save for later deletion
+sal_Int32 nOldSize  = m_nSize;
+m_nStart = m_nPage = STG_EOF;
+m_nSize  = m_nPos = 0;
 m_nOffset = 0;
 // Delete all temporary entries
 m_pRoot->DelTemp( false );
@@ -875,12 +875,12 @@ bool StgDirStrm::Store()
 m_pRoot->Enum( n );
 if( !SetSize( n * STGENTRY_SIZE ) )
 {
-nStart = nOldStart; nSize = nOldSize;
+m_nStart = nOldStart; m_nSize = nOldSize;
 m_pRoot->RevertAll();
 return false;
 }
 // set up the cache elements for the new stream
-if( !Copy( STG_FREE, nSize ) )
+if( !Copy( STG_FREE, m_nSize ) )
 {
 m_pRoot->RevertAll();
 return false;
@@ -892,7 +892,7 @@ bool StgDirStrm::Store()
 return false;
 }
 // fill any remaining entries with empty data
-sal_Int32 ne = nSize / STGENTRY_SIZE;
+sal_Int32 ne = m_nSize / STGENTRY_SIZE;
 StgEntry aEmpty;
 aEmpty.Init();
 while( n < ne )
@@ -907,7 +907,7 @@ bool StgDirStrm::Store()
 }
 // Now we can release the old stream
 m_pFat->FreePages( nOldStart, true );
-rIo.m_aHdr.SetTOCStart( nStart );
+m_rIo.m_aHdr.SetTOCStart( m_nStart );
 return true;
 }
 
@@ -915,7 +915,7 @@ bool StgDirStrm::Store()
 
 void* StgDirStrm::GetEntry( sal_Int32 n, bool bDirty )
 {
-return n < 0 || n >= nSize / STGENTRY_SIZE
+return n < 0 || n >= m_nSize / STGENTRY_SIZE
 ? NULL : GetPtr( n * STGENTRY_SIZE, true, bDirty );
 }
 
@@ -929,7 +929,7 @@ StgDirEntry* StgDirStrm::Find( StgDirEntry& rStg, const 
OUString& rName )
 

[Libreoffice-commits] core.git: sot/source

2015-10-10 Thread melikeyurtoglu
 sot/source/sdstor/stgdir.cxx   |6 -
 sot/source/sdstor/stgstrms.cxx |  138 -
 sot/source/sdstor/stgstrms.hxx |   10 +-
 3 files changed, 77 insertions(+), 77 deletions(-)

New commits:
commit 30b3676624685e260e2ec1909486b971fac129f7
Author: melikeyurtoglu 
Date:   Sat Oct 10 00:00:16 2015 +0300

tdf#94879 add 'm' suffixes to member variables

Reviewed on:
https://gerrit.libreoffice.org/19290

Change-Id: I48b0488edc9462ec1c15188d0b5c893db529c0e7

diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index a2a82c8..821cb91 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -866,8 +866,8 @@ bool StgDirStrm::Store()
 sal_Int32 nOldStart = nStart;   // save for later deletion
 sal_Int32 nOldSize  = nSize;
 nStart = nPage = STG_EOF;
-nSize  = nPos = 0;
-nOffset = 0;
+nSize  = m_nPos = 0;
+m_nOffset = 0;
 // Delete all temporary entries
 m_pRoot->DelTemp( false );
 // set the entry numbers
@@ -906,7 +906,7 @@ bool StgDirStrm::Store()
 aEmpty.Store( p );
 }
 // Now we can release the old stream
-pFat->FreePages( nOldStart, true );
+m_pFat->FreePages( nOldStart, true );
 rIo.m_aHdr.SetTOCStart( nStart );
 return true;
 }
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 3d85481..f81aa45 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -307,17 +307,17 @@ bool StgFAT::FreePages( sal_Int32 nStart, bool bAll )
 
 StgStrm::StgStrm( StgIo& r ) : rIo( r )
 {
-pFat= NULL;
+m_pFat= NULL;
 nStart  = nPage = STG_EOF;
-nOffset = 0;
+m_nOffset = 0;
 pEntry  = NULL;
-nPos = nSize = 0;
+m_nPos = nSize = 0;
 nPageSize = rIo.GetPhysPageSize();
 }
 
 StgStrm::~StgStrm()
 {
-delete pFat;
+delete m_pFat;
 }
 
 // Attach the stream to the given entry.
@@ -353,7 +353,7 @@ void StgStrm::scanBuildPageChainCache(sal_Int32 
*pOptionalCalcSize)
 {
 if( nBgn >= 0 )
 m_aPagesCache.push_back(nBgn);
-nBgn = pFat->GetNextPage( nBgn );
+nBgn = m_pFat->GetNextPage( nBgn );
 
 //returned second is false if it already exists
 if (!nUsedPageNumbers.insert(nBgn).second)
@@ -380,19 +380,19 @@ void StgStrm::scanBuildPageChainCache(sal_Int32 
*pOptionalCalcSize)
 // behind the EOF.
 bool StgStrm::Pos2Page( sal_Int32 nBytePos )
 {
-if ( !pFat )
+if ( !m_pFat )
 return false;
 
 // Values < 0 seek to the end
 if( nBytePos < 0 || nBytePos >= nSize )
 nBytePos = nSize;
 // Adjust the position back to offset 0
-nPos -= nOffset;
+m_nPos -= m_nOffset;
 sal_Int32 nMask = ~( nPageSize - 1 );
-sal_Int32 nOld = nPos & nMask;
+sal_Int32 nOld = m_nPos & nMask;
 sal_Int32 nNew = nBytePos & nMask;
-nOffset = (short) ( nBytePos & ~nMask );
-nPos = nBytePos;
+m_nOffset = (short) ( nBytePos & ~nMask );
+m_nPos = nBytePos;
 if( nOld == nNew )
 return true;
 
@@ -417,7 +417,7 @@ bool StgStrm::Pos2Page( sal_Int32 nBytePos )
 // Start adding pages while we can
 while( nToAdd > 0 && nBgn >= 0 )
 {
-nBgn = pFat->GetNextPage( nBgn );
+nBgn = m_pFat->GetNextPage( nBgn );
 if( nBgn >= 0 )
 {
 m_aPagesCache.push_back( nBgn );
@@ -432,7 +432,7 @@ bool StgStrm::Pos2Page( sal_Int32 nBytePos )
  " beyond page cache size " << m_aPagesCache.size());
 // fdo#84229 - handle seek to end and back as eg. XclImpStream expects
 nPage = STG_EOF;
-nOffset = 0;
+m_nOffset = 0;
 // Intriguingly in the past we didn't reset nPos to match the real
 // length of the stream thus:
 //   nIdx = m_aPagesCache.size();
@@ -443,10 +443,10 @@ bool StgStrm::Pos2Page( sal_Int32 nBytePos )
 
 // special case: seek to 1st byte of new, unallocated page
 // (in case the file size is a multiple of the page size)
-if( nBytePos == nSize && !nOffset && nIdx > 0 && nIdx == 
m_aPagesCache.size() )
+if( nBytePos == nSize && !m_nOffset && nIdx > 0 && nIdx == 
m_aPagesCache.size() )
 {
 nIdx--;
-nOffset = nPageSize;
+m_nOffset = nPageSize;
 }
 else if ( nIdx == m_aPagesCache.size() )
 {
@@ -464,7 +464,7 @@ bool StgStrm::Pos2Page( sal_Int32 nBytePos )
 
 bool StgStrm::Copy( sal_Int32 nFrom, sal_Int32 nBytes )
 {
-if ( !pFat )
+if ( !m_pFat )
 return false;
 
 m_aPagesCache.clear();
@@ -481,21 +481,21 @@ bool StgStrm::Copy( sal_Int32 nFrom, sal_Int32 nBytes )
 rIo.Copy( nTo, nFrom );
 if( nFrom >= 0 )
 {
-nFrom = pFat->GetNextPage( nFrom );
+nFrom = m_pFat->GetNextPage( nFrom );
 if( nFrom < 0 )
 {
 rIo.SetError( 

[Libreoffice-commits] core.git: sot/source

2015-08-06 Thread Noel Grandin
 sot/source/base/exchange.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 0c08cb23b4902f19ed0e1050b5c9a52164c0d2ac
Author: Noel Grandin n...@peralex.com
Date:   Thu Aug 6 14:04:02 2015 +0200

tdf#93018 - Copying forms not working anymore (part2)

I missed a similar bug lower down

Change-Id: I673c69dd1d36cc1b502a7de7821a05d859313aac

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 78a7d13..24604dd 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -287,16 +287,14 @@ SotClipboardFormatId SotExchange::RegisterFormatMimeType( 
const OUString rMimeT
 return static_castSotClipboardFormatId(i + 
static_castint(SotClipboardFormatId::USER_END) + 1);
 }
 
-// nMax ist der neue Platz
 DataFlavor* pNewFlavor = new DataFlavor;
-
 pNewFlavor-MimeType = rMimeType;
 pNewFlavor-HumanPresentableName = rMimeType;
 pNewFlavor-DataType = cppu::UnoTypeOUString::get();
 
 rL.push_back( pNewFlavor );
 
-return static_castSotClipboardFormatId(static_castint(nMax) + 
static_castint(SotClipboardFormatId::USER_END) + 1);
+return static_castSotClipboardFormatId(static_castint(rL.size()-1) + 
static_castint(SotClipboardFormatId::USER_END) + 1);
 }
 
 /*
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2015-08-06 Thread Noel Grandin
 sot/source/base/exchange.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit f7d65b04126b614bbb0b1bc0e7b6309900d4dc8d
Author: Noel Grandin n...@peralex.com
Date:   Thu Aug 6 13:46:36 2015 +0200

tdf#93018 - Copying forms not working anymore

Bug introduced by commit fb14be5f8f74f83ba89e15f891ddf1f753dcc62f
create new 'enum class' SotClipboardFormatId to unify types

Change-Id: I3febb927f658ac27d2b864869775db3b71940a5c

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 599525d..78a7d13 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -254,16 +254,14 @@ SotClipboardFormatId SotExchange::RegisterFormatName( 
const OUString rName )
 return static_castSotClipboardFormatId(i + 
static_castint(SotClipboardFormatId::USER_END) + 1);
 }
 
-// nMax ist der neue Platz
 DataFlavor* pNewFlavor = new DataFlavor;
-
 pNewFlavor-MimeType = rName;
 pNewFlavor-HumanPresentableName = rName;
 pNewFlavor-DataType = cppu::UnoTypeOUString::get();
 
 rL.push_back( pNewFlavor );
 
-return static_castSotClipboardFormatId(static_castint(nMax) + 
static_castint(SotClipboardFormatId::USER_END) + 1);
+return static_castSotClipboardFormatId(static_castint(rL.size()-1) + 
static_castint(SotClipboardFormatId::USER_END) + 1);
 }
 
 SotClipboardFormatId SotExchange::RegisterFormatMimeType( const OUString 
rMimeType )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2015-08-06 Thread Noel Grandin
 sot/source/base/exchange.cxx |   24 ++--
 sot/source/base/formats.cxx  |   50 +--
 2 files changed, 33 insertions(+), 41 deletions(-)

New commits:
commit 922f631da18935887c3de6e2ba47ebba8d5aea02
Author: Noel Grandin n...@peralex.com
Date:   Thu Aug 6 14:06:40 2015 +0200

remove some unnecessary casts and local vars

Change-Id: I6070421b2275b7fdd698fdc87cc349fc87846513

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 24604dd..92c8bf37 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -230,16 +230,14 @@ SotClipboardFormatId SotExchange::RegisterFormatName( 
const OUString rName )
 {
 const DataFlavorRepresentation *pFormatArray_Impl = 
FormatArray_Impl::get();
 // teste zuerst die Standard - Name
-SotClipboardFormatId nMax = SotClipboardFormatId::FILE_LIST;
-for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i = nMax;  
++i )
+for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i = 
SotClipboardFormatId::FILE_LIST;  ++i )
 if( rName.equalsAscii( pFormatArray_Impl[ static_castint(i) ].pName 
) )
 return i;
 
 // BM: the chart format 105 (StarChartDocument 5.0) was written
 // only into 5.1 chart documents - in 5.0 and 5.2 it was 42 (StarChart 
5.0)
 // The registry only contains the entry for the 42 format id.
-nMax = SotClipboardFormatId::USER_END;
-for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i = nMax;  ++i )
+for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i = 
SotClipboardFormatId::USER_END;  ++i )
 if( rName.equalsAscii( pFormatArray_Impl[ static_castint(i) ].pName 
) )
 return ( (i == SotClipboardFormatId::STARCHARTDOCUMENT_50)
  ? SotClipboardFormatId::STARCHART_50
@@ -268,13 +266,11 @@ SotClipboardFormatId SotExchange::RegisterFormatMimeType( 
const OUString rMimeT
 {
 const DataFlavorRepresentation *pFormatArray_Impl = 
FormatArray_Impl::get();
 // teste zuerst die Standard - Name
-SotClipboardFormatId nMax = SotClipboardFormatId::FILE_LIST;
-for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i = nMax;  
++i )
+for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i = 
SotClipboardFormatId::FILE_LIST;  ++i )
 if( rMimeType.equalsAscii( pFormatArray_Impl[ static_castint(i) 
].pMimeType ) )
 return i;
 
-nMax = SotClipboardFormatId::USER_END;
-for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i = nMax;  ++i )
+for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i = 
SotClipboardFormatId::USER_END;  ++i )
 if( rMimeType.equalsAscii( pFormatArray_Impl[ static_castint(i) 
].pMimeType ) )
 return i;
 
@@ -394,16 +390,14 @@ OUString SotExchange::GetFormatMimeType( 
SotClipboardFormatId nFormat )
 SotClipboardFormatId SotExchange::GetFormatIdFromMimeType( const OUString 
rMimeType )
 {
 const DataFlavorRepresentation *pFormatArray_Impl = 
FormatArray_Impl::get();
-SotClipboardFormatId nMax = SotClipboardFormatId::FILE_LIST;
-for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i = nMax;  
++i )
+for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i = 
SotClipboardFormatId::FILE_LIST;  ++i )
 if( rMimeType.equalsAscii( pFormatArray_Impl[ static_castint(i) 
].pMimeType ) )
 return i;
 
 // BM: the chart format 105 (StarChartDocument 5.0) was written
 // only into 5.1 chart documents - in 5.0 and 5.2 it was 42 (StarChart 
5.0)
 // The registry only contains the entry for the 42 format id.
-nMax = SotClipboardFormatId::USER_END;
-for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i = nMax;  ++i )
+for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i = 
SotClipboardFormatId::USER_END;  ++i )
 if( rMimeType.equalsAscii( pFormatArray_Impl[ static_castint(i) 
].pMimeType ) )
 return ( (i == SotClipboardFormatId::STARCHARTDOCUMENT_50)
  ? SotClipboardFormatId::STARCHART_50
@@ -433,17 +427,15 @@ SotClipboardFormatId SotExchange::GetFormat( const 
DataFlavor rFlavor )
 // teste zuerst die Standard - Name
 const OUString rMimeType = rFlavor.MimeType;
 
-SotClipboardFormatId nMax = SotClipboardFormatId::FILE_LIST;
 const DataFlavorRepresentation *pFormatArray_Impl = 
FormatArray_Impl::get();
-for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i = nMax;  
++i )
+for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i = 
SotClipboardFormatId::FILE_LIST;  ++i )
 if( rMimeType.equalsAscii( pFormatArray_Impl[ static_castint(i) 
].pMimeType ) )
 return static_castSotClipboardFormatId(i);
 
 // BM: the chart format 105 (StarChartDocument 5.0) was written
 // only into 5.1 chart documents - in 5.0 and 5.2 it was 42 (StarChart 
5.0)
 // The registry only contains the 

[Libreoffice-commits] core.git: sot/source

2015-06-22 Thread Noel Grandin
 sot/source/base/exchange.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 1bcf792993c3d88acfd7ede4567701c5dd6e7e62
Author: Noel Grandin noelgran...@gmail.com
Date:   Sun Jun 21 14:08:16 2015 +0200

tdf#92037 fix dragging DataSources field into document

Bug introduced by my commit fb14be5f8f74f83ba89e15f891ddf1f753dcc62f
create new 'enum class' SotClipboardFormatId to unify types

Change-Id: I7347fb9e653077205476e2b0c2b8107dc9caae0e
Reviewed-on: https://gerrit.libreoffice.org/16396
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Michael Meeks michael.me...@collabora.com
Tested-by: Michael Meeks michael.me...@collabora.com

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index eac3846..8b3541f 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -343,7 +343,7 @@ bool SotExchange::GetFormatDataFlavor( SotClipboardFormatId 
nFormat, DataFlavor
 {
 tDataFlavorList rL = InitFormats_Impl();
 
-unsigned i = static_castint(nFormat) - 
static_castint(SotClipboardFormatId::USER_END) + 1;
+unsigned i = static_castint(nFormat) - 
static_castint(SotClipboardFormatId::USER_END) - 1;
 
 if( rL.size()  i )
 {
@@ -377,7 +377,7 @@ OUString SotExchange::GetFormatMimeType( 
SotClipboardFormatId nFormat )
 {
 tDataFlavorList rL = InitFormats_Impl();
 
-unsigned i = static_castint(nFormat) - 
static_castint(SotClipboardFormatId::USER_END) + 1;
+unsigned i = static_castint(nFormat) - 
static_castint(SotClipboardFormatId::USER_END) - 1;
 
 if( rL.size()  i )
 sMimeType = rL[ i ]-MimeType;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2014-08-05 Thread Andrzej Hunt
 sot/source/base/formats.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit a96a7ce51aa98fb9ee97ea3803e2b7e648611008
Author: Andrzej Hunt andrzej.h...@collabora.com
Date:   Tue Aug 5 19:15:14 2014 +0200

fdo#81835 Don't prefer GDI Metafiles to RTF/HTML

Was first introduced by 538c13f3d1756f2d105115f64ab1bc0b7426eebc

We should process clipboard formats in order of descriptive-/
usefulness -- however png/bmp are special cases (as browsers
will add an html equivalent to their clipboard when copying raw
images, with the raw image being the preferred target format)
and were therefore moved up in the paste-preference list,
mistakenly it was assumed that GDI Metafiles should be subject
to the same treatment, but it appears that Word (and Wordpad?)
will provide both RTF (preferred) and GDI for formatted text.

Change-Id: I731986fc9d70e7aeb64e53764e32cfec3e27eca1

diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index 753e738..c61508e 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -857,7 +857,6 @@ static SotAction_Impl const 
aEXCHG_DEST_SWDOC_FREE_AREA_Copy[] =  \
 { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
 { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
-{ SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_PNG, EXCHG_OUT_ACTION_INSERT_BITMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
@@ -869,6 +868,7 @@ static SotAction_Impl const 
aEXCHG_DEST_SWDOC_FREE_AREA_Copy[] =  \
 { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, 
EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
 { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, 
EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
 { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, 
EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+{ SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
 { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
 { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
@@ -1036,7 +1036,6 @@ static SotAction_Impl const 
aEXCHG_DEST_SCDOC_FREE_AREA_Copy[] =  \
 { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
 { SOT_FORMATSTR_ID_BIFF_5, EXCHG_IN_ACTION_COPY | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },  \
 { SOT_FORMATSTR_ID_BIFF__5,EXCHG_IN_ACTION_COPY | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },  \
-{ SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_PNG, EXCHG_OUT_ACTION_INSERT_BITMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2014-07-12 Thread Takeshi Abe
 sot/source/sdstor/stgdir.cxx |9 +++-
 sot/source/sdstor/stgole.cxx |8 +++
 sot/source/sdstor/stgstrms.cxx   |   16 +++---
 sot/source/sdstor/storage.cxx|   15 +++--
 sot/source/sdstor/storinfo.cxx   |9 +++-
 sot/source/sdstor/ucbstorage.cxx |   42 ---
 6 files changed, 46 insertions(+), 53 deletions(-)

New commits:
commit 1bae012c997a3cf5b99a6772746107c0a6800458
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Sat Jul 12 23:10:34 2014 +0900

Avoid possible memory leaks in case of exceptions

Change-Id: Id0304366c4e6191db85527935f5bc5cdb0aeb8d8

diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index f4903a5..d7dce35 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -26,7 +26,7 @@
 #include stgstrms.hxx
 #include stgdir.hxx
 #include stgio.hxx
-
+#include boost/scoped_array.hpp
 
  class StgDirEntry
 
@@ -350,13 +350,12 @@ bool StgDirEntry::SetSize( sal_Int32 nNewSize )
 // if so, we probably need to copy the old data
 if( nOldSize )
 {
-void* pBuf = new sal_uInt8[ nOldSize ];
+boost::scoped_arraysal_uInt8 pBuf(new sal_uInt8[ 
nOldSize ]);
 pOld-Pos2Page( 0L );
 pStgStrm-Pos2Page( 0L );
-if( pOld-Read( pBuf, nOldSize )
-  pStgStrm-Write( pBuf, nOldSize ) )
+if( pOld-Read( pBuf.get(), nOldSize )
+ pStgStrm-Write( pBuf.get(), nOldSize ) )
 bRes = true;
-delete[] static_castsal_uInt8*(pBuf);
 }
 else
 bRes = true;
diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx
index 0b9d0b5..9bbf3ee 100644
--- a/sot/source/sdstor/stgole.cxx
+++ b/sot/source/sdstor/stgole.cxx
@@ -20,6 +20,7 @@
 #include rtl/string.h
 #include stgole.hxx
 #include sot/storinfo.hxx
+#include boost/scoped_array.hpp
 
 #ifdef _MSC_VER
 #pragma warning(disable: 4342)
@@ -117,9 +118,9 @@ bool StgCompObjStream::Load()
 // higher bits are ignored
 sal_uLong nStrLen = ::std::min( nLen1, (sal_Int32)0xFFFE );
 
-sal_Char* p = new sal_Char[ nStrLen+1 ];
+boost::scoped_arraysal_Char p(new sal_Char[ nStrLen+1 ]);
 p[nStrLen] = 0;
-if( Read( p, nStrLen ) == nStrLen )
+if( Read( p.get(), nStrLen ) == nStrLen )
 {
 //The encoding here is ANSI, which is pretty useless seeing 
as
 //the actual codepage used doesn't seem to be specified/stored
@@ -127,12 +128,11 @@ bool StgCompObjStream::Load()
 //all platforms and envs
 //https://issues.apache.org/ooo/attachment.cgi?id=68668
 //for a good edge-case example
-aUserName = nStrLen ? OUString( p, nStrLen, 
RTL_TEXTENCODING_MS_1252 ) : OUString();
+aUserName = nStrLen ? OUString( p.get(), nStrLen, 
RTL_TEXTENCODING_MS_1252 ) : OUString();
 nCbFormat = ReadClipboardFormat( *this );
 }
 else
 SetError( SVSTREAM_GENERALERROR );
-delete [] p;
 }
 }
 return GetError() == SVSTREAM_OK;
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index e4214b2..f2450c9 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -31,6 +31,7 @@
 #include stgstrms.hxx
 #include stgdir.hxx
 #include stgio.hxx
+#include boost/scoped_array.hpp
 
 / class StgFAT
 
@@ -1136,7 +1137,7 @@ bool StgTmpStrm::Copy( StgTmpStrm rSrc )
 SetSize( n );
 if( GetError() == SVSTREAM_OK )
 {
-sal_uInt8* p = new sal_uInt8[ 4096 ];
+boost::scoped_arraysal_uInt8 p(new sal_uInt8[ 4096 ]);
 rSrc.Seek( 0L );
 Seek( 0L );
 while( n )
@@ -1144,13 +1145,13 @@ bool StgTmpStrm::Copy( StgTmpStrm rSrc )
 sal_uLong nn = n;
 if( nn  4096 )
 nn = 4096;
-if( rSrc.Read( p, nn ) != nn )
+if( rSrc.Read( p.get(), nn ) != nn )
 break;
-if( Write( p, nn ) != nn )
+if( Write( p.get(), nn ) != nn )
 break;
 n -= nn;
 }
-delete [] p;
+p.reset();
 rSrc.Seek( nCur );
 Seek( nCur );
 return n == 0;
@@ -1197,18 +1198,17 @@ void StgTmpStrm::SetSize(sal_uInt64 n)
 sal_uLong i = nEndOfData;
 if( i )
 {
-sal_uInt8* p = new sal_uInt8[ 4096 ];
+boost::scoped_arraysal_uInt8 p(new sal_uInt8[ 4096 ]);
 Seek( 0L );
 while( i )
 {
 sal_uLong nb = ( i  4096 ) ? 4096 : i;

[Libreoffice-commits] core.git: sot/source

2014-05-28 Thread Andrzej Hunt
 sot/source/base/formats.cxx |   36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 538c13f3d1756f2d105115f64ab1bc0b7426eebc
Author: Andrzej Hunt andrzej.h...@collabora.com
Date:   Wed May 28 18:43:37 2014 +0100

fdo#78801 fdo#52547 Paste preference is image, then html, then text.

c47db038f98aaf7aec3cbe57c4e5683591afa23e was an attempt to fix fdo#52547,
i.e. to make sure that the actual image data was stored if an image was
being pasted from a browser (where the clipboard contains both image data,
but also an html construct which would instead embed the image from the
web). However the new ordering inadvertently meant that strings would
be preferred to html -- i.e. copying a mixture of text+image from a
webpage would result in only the text being stored.

The new ordering causes images copied from the browser to still have
the actual image data stored (rather than a link in the case of the
html being stored), but html is still preferred to plaint text.

(This is primarily as a result of Firefox (and possibly other browsers)
changing their clipboard to contain an html construct which links to the
original image, in addition to the raw image data-- and html previously
being preferred to images in the paste ordering meant that the linked
version would be pasted by default, which is not the expected result
when copying an image.)

Change-Id: Ice9b37cf3dd25d8cdb0e04f19a6b2f3661018564

diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index 36716a3..753e738 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -857,20 +857,20 @@ static SotAction_Impl const 
aEXCHG_DEST_SWDOC_FREE_AREA_Copy[] =  \
 { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
 { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+{ SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
+{ SOT_FORMATSTR_ID_PNG, EXCHG_OUT_ACTION_INSERT_BITMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
+{ SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
+{ SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
+{ SOT_FORMATSTR_ID_HTML_NO_COMMENT, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
+{ SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },   \
 { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },  \
 { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },  \
 { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, 
EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
 { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, 
EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
 { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, 
EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
-{ SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
-{ SOT_FORMATSTR_ID_PNG, EXCHG_OUT_ACTION_INSERT_BITMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
-{ SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
 { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
-{ SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
-{ SOT_FORMATSTR_ID_HTML_NO_COMMENT, 

[Libreoffice-commits] core.git: sot/source

2014-04-07 Thread Stephan Bergmann
 sot/source/sdstor/stgio.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit 8144550c120fc013161d19f2a2aa98e879504bcf
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Apr 7 12:40:21 2014 +0200

Remove unused functions

Change-Id: Ifa8fad734c716deeed32137f09cbe88378d11faf

diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index dc02e4d..9ce0de1 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -153,12 +153,6 @@ public:
 ~EasyFat() { delete[] pFat; delete[] pFree; }
 
 sal_Int32 GetPageSize() { return nPageSize; }
-sal_Int32 Count() { return nPages; }
-sal_Int32 operator[]( sal_Int32 nOffset )
-{
-OSL_ENSURE( nOffset = 0  nOffset  nPages, Unexpected offset! );
-return nOffset = 0  nOffset  nPages ? pFat[ nOffset ] : -2;
-}
 
 sal_uLong Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect );
 bool HasUnrefChains();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2014-02-19 Thread Stephan Bergmann
 sot/source/sdstor/ucbstorage.cxx   |4 ++--
 sot/source/unoolestorage/xolesimplestorage.cxx |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 81a2fc786728205b0a869b38a95fc889662b08a6
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Feb 19 14:05:37 2014 +0100

sot: sal_Bool - bool fixup

Change-Id: I53777b6f72f5ff60228e40e9ec2a0e909e059fcf

diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 9d3e66a..47158af 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -2156,7 +2156,7 @@ sal_Int16 UCBStorage_Impl::Commit()
 // first remove all open stream handles
 if( !pElement-m_xStream.Is() || 
pElement-m_xStream-Clear() )
 {
-pContent-executeCommand( OUString(delete), 
makeAny( sal_Bool( sal_True ) ) );
+pContent-executeCommand( OUString(delete), 
makeAny( true ) );
 nRet = COMMIT_RESULT_SUCCESS;
 }
 else
@@ -2189,7 +2189,7 @@ sal_Int16 UCBStorage_Impl::Commit()
 // OLE storage should be stored encrytped, if the 
storage uses encryption
 pElement-m_xStream-m_aContentType = 
application/vnd.sun.star.oleobject;
 Any aValue;
-aValue = (sal_Bool)sal_True;
+aValue = true;
 
pElement-m_xStream-m_pContent-setPropertyValue(Encrypted, aValue );
 }
 
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx 
b/sot/source/unoolestorage/xolesimplestorage.cxx
index 3fe6aa5..1de814e 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -476,7 +476,7 @@ uno::Any SAL_CALL OLESimpleStorage::getByName( const 
OUString aName )
 
 uno::Sequence uno::Any  aArgs( 2 );
 aArgs[0] = xInputStream; // allow readonly access only
-aArgs[1] = (sal_Bool)sal_True; // do not create copy
+aArgs[1] = true; // do not create copy
 
 uno::Reference container::XNameContainer  xResultNameContainer(
 m_xFactory-createInstanceWithArguments(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2014-02-12 Thread Andrzej Hunt
 sot/source/base/formats.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit c47db038f98aaf7aec3cbe57c4e5683591afa23e
Author: Andrzej Hunt andrzej.h...@collabora.com
Date:   Fri Feb 7 18:18:42 2014 +

fdo#52547 SOT: Prefer embedding image data to embedding linked image.

When copying an image from e.g. Firefox or Chromium the clipboard
will contain both the image itself, and the url of the image --
presumably it makes more sense to store the image data itself if
it is available -- the order of the items in the *_FREE_AREA_Copy
defines the order of preference for which data in the clipboard
should be used.

Change-Id: Id8b862a9f2fce3a34adbb16509e9b7372500a239
Reviewed-on: https://gerrit.libreoffice.org/7928
Tested-by: Caolán McNamara caol...@redhat.com
Reviewed-by: Caolán McNamara caol...@redhat.com

diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index 46d43c2..c31304c 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -857,9 +857,6 @@ static SotAction_Impl const 
aEXCHG_DEST_SWDOC_FREE_AREA_Copy[] =  \
 { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
 { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
-{ SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
-{ SOT_FORMATSTR_ID_HTML_NO_COMMENT, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
-{ SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },   \
 { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },  \
 { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },  \
@@ -871,6 +868,9 @@ static SotAction_Impl const 
aEXCHG_DEST_SWDOC_FREE_AREA_Copy[] =  \
 { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
 { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+{ SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
+{ SOT_FORMATSTR_ID_HTML_NO_COMMENT, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
+{ SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
 { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
 { 0x, 0, 0 }   
   \
@@ -1036,9 +1036,6 @@ static SotAction_Impl const 
aEXCHG_DEST_SCDOC_FREE_AREA_Copy[] =  \
 { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
 { SOT_FORMATSTR_ID_BIFF_5, EXCHG_IN_ACTION_COPY | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },  \
 { SOT_FORMATSTR_ID_BIFF__5,EXCHG_IN_ACTION_COPY | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },  \
-{ SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
-{ SOT_FORMATSTR_ID_HTML_NO_COMMENT, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
-{ SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | 
EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 
0 },\
 { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },  \
 { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, 
EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | 
EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
 { 

[Libreoffice-commits] core.git: sot/source

2014-02-12 Thread Kohei Yoshida
 sot/source/sdstor/stgelem.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit da2efb3e14aa93be13dc4a88f0e41b7dc7948e15
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Feb 12 11:13:32 2014 -0500

Perhaps it's better to use nMaxLegalStr here than using hardcoded 32.

Change-Id: Idee4667f5ef9aa71af05139b6fc7ee8a5166b398

diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index e2aae4b..cd3eee6 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -298,12 +298,12 @@ bool StgEntry::SetName( const OUString rName )
 aName = aName.copy(0, nMaxLegalStr);
 }
 
-int i;
-for( i = 0; i  rName.getLength()  i  32; i++ )
+sal_uInt16 i;
+for( i = 0; i  rName.getLength()  i = nMaxLegalStr; i++ )
 {
 nName[ i ] = rName[ i ];
 }
-while( i  32 )
+while (i = nMaxLegalStr)
 {
 nName[ i++ ] = 0;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2013-10-16 Thread Armin Le Grand
 sot/source/sdstor/stgstrms.cxx |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit dfa1afd0e8b7ae9c706c4a3171a04752e24230b0
Author: Armin Le Grand a...@apache.org
Date:   Wed Oct 16 16:47:38 2013 +0100

i123485 secured file import scanning existing pages

(cherry picked from commit 04b38114b0ca4be9895d8f9fa842b6cb390c8036
 and adapted to the rewritten scanBuildPageChainCache)

Change-Id: Ib90d0563be5aeb69aa14c28b3304e42f3cc46162
Reviewed-on: https://gerrit.libreoffice.org/6272
Reviewed-by: Michael Meeks michael.me...@collabora.com
Tested-by: Michael Meeks michael.me...@collabora.com

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 1afbf21..16deea9 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -23,6 +23,7 @@
 #include sal/log.hxx
 #include osl/file.hxx
 #include unotools/tempfile.hxx
+#include set
 
 #include sot/stg.hxx
 #include stgelem.hxx
@@ -339,16 +340,23 @@ void StgStrm::scanBuildPageChainCache(sal_Int32 
*pOptionalCalcSize)
 
 bool bError = false;
 sal_Int32 nBgn = nStart;
-sal_Int32 nOldBgn = -1;
 sal_Int32 nOptSize = 0;
-while( nBgn = 0  nBgn != nOldBgn )
+
+// Track already scanned PageNumbers here and use them to
+// see if an  already counted page is re-visited
+std::set sal_Int32  nUsedPageNumbers;
+
+while( nBgn = 0  !bError )
 {
 if( nBgn = 0 )
 m_aPagesCache.push_back(nBgn);
-nOldBgn = nBgn;
 nBgn = pFat-GetNextPage( nBgn );
-if( nBgn == nOldBgn )
+
+if( nUsedPageNumbers.find(nBgn) != nUsedPageNumbers.end() )
 bError = true;
+else
+nUsedPageNumbers.insert(nBgn);
+
 nOptSize += nPageSize;
 }
 if (bError)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2013-07-04 Thread Caolán McNamara
 sot/source/base/exchange.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c55a2bd33b00f92f795f4ee224c1887228c97b53
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jul 4 11:05:50 2013 +0100

fix build

Change-Id: I87ad4384b8898017d94f8e075d13545b7b4cfe50

diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 5b13c74..9765eb3 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -386,7 +386,7 @@ OUString SotExchange::GetFormatMimeType( sal_uLong nFormat )
 sMimeType = rL[ nFormat ]-MimeType;
 }
 
-DBG_ASSERT( sMimeType.Len(), SotExchange::GetFormatMimeType(): DataFlavor 
not initialized );
+DBG_ASSERT( !sMimeType.isEmpty(), SotExchange::GetFormatMimeType(): 
DataFlavor not initialized );
 
 return sMimeType;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2013-05-19 Thread Oliver-Rainer Wittmann
 sot/source/sdstor/stgelem.cxx |   10 +-
 sot/source/sdstor/stgelem.hxx |   26 ++
 2 files changed, 19 insertions(+), 17 deletions(-)

New commits:
commit b751e3915ef527c9af07b995c95fb353c3c81a42
Author: Oliver-Rainer Wittmann o...@apache.org
Date:   Tue Aug 14 12:40:36 2012 +

some refactoring on StgHeader

(cherry picked from commit 9c3ef4ee67c1d3f416c02b9db6d1adbc7ca6d549)

Conflicts:
sot/source/sdstor/stgelem.cxx

Change-Id: I3f826dc98af5ad5cee5c2566006ab405f0730c3c

diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 265381e..e34f068 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -110,7 +110,7 @@ void StgHeader::Init()
 
 SetTOCStart( STG_EOF );
 SetDataFATStart( STG_EOF );
-for( short i = 0; i  109; i++ )
+for( short i = 0; i  cFATPagesInHeader; i++ )
 SetFATPage( i, STG_FREE );
 }
 
@@ -145,7 +145,7 @@ sal_Bool StgHeader::Load( SvStream r )
nDataFATSize   // 40 # of data FATpages
nMasterChain   // 44 chain to the next master block
nMaster;   // 48 # of additional master blocks
-for( short i = 0; i  109; i++ )
+for( short i = 0; i  cFATPagesInHeader; i++ )
 r  nMasterFAT[ i ];
 
 return ( r.GetErrorCode() == ERRCODE_NONE  Check() );
@@ -172,7 +172,7 @@ sal_Bool StgHeader::Store( StgIo rIo )
nDataFATSize   // 40 # of data FAT pages
nMasterChain   // 44 chain to the next master block
nMaster;   // 48 # of additional master blocks
-for( short i = 0; i  109; i++ )
+for( short i = 0; i  cFATPagesInHeader; i++ )
 r  nMasterFAT[ i ];
 bDirty = !rIo.Good();
 return sal_Bool( !bDirty );
@@ -209,7 +209,7 @@ sal_Bool StgHeader::Check()
 
 sal_Int32 StgHeader::GetFATPage( short n ) const
 {
-if( n = 0  n  109 )
+if( n = 0  n  cFATPagesInHeader )
 return nMasterFAT[ n ];
 else
 return STG_EOF;
@@ -217,7 +217,7 @@ sal_Int32 StgHeader::GetFATPage( short n ) const
 
 void StgHeader::SetFATPage( short n, sal_Int32 nb )
 {
-if( n = 0  n  109 )
+if( n = 0  n  cFATPagesInHeader )
 {
 if( nMasterFAT[ n ] != nb )
 bDirty = sal_True, nMasterFAT[ n ] = nb;
diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx
index e2bfad3..5e7b6c4 100644
--- a/sot/source/sdstor/stgelem.hxx
+++ b/sot/source/sdstor/stgelem.hxx
@@ -36,8 +36,10 @@ SvStream operator( SvStream, const ClsId );
 
 class StgHeader
 {
+static const sal_uInt8 cFATPagesInHeader = 109;
+
 sal_uInt8   cSignature[ 8 ];// 00 signature (see below)
-ClsId   aClsId; // 08 Class ID
+ClsId   aClsId; // 08 Class ID
 sal_Int32   nVersion;   // 18 version number
 sal_uInt16  nByteOrder; // 1C Unicode byte order indicator
 sal_Int16   nPageSize;  // 1E 1  nPageSize = block size
@@ -52,7 +54,7 @@ class StgHeader
 sal_Int32   nDataFATSize;   // 40 # of data fat blocks
 sal_Int32   nMasterChain;   // 44 chain to the next master 
block
 sal_Int32   nMaster;// 48 # of additional master blocks
-sal_Int32   nMasterFAT[ 109 ];  // 4C first 109 master FAT pages
+sal_Int32   nMasterFAT[ cFATPagesInHeader ];// 4C first 
[cFATPagesInHeader] master FAT pages
 public:
 StgHeader();
 
@@ -61,23 +63,23 @@ public:
 sal_Bool  Load( SvStream );
 sal_Bool  Store( StgIo );
 sal_Bool  Check();  // check the signature and version
-short GetByteOrder() const  { return nByteOrder;}
-sal_Int32 GetTOCStart() const   { return nTOCstrm;  }
+short GetByteOrder() const  { return nByteOrder; }
+sal_Int32 GetTOCStart() const   { return nTOCstrm; }
 void  SetTOCStart( sal_Int32 n );
-sal_Int32 GetDataFATStart() const   { return nDataFAT;  }
+sal_Int32 GetDataFATStart() const   { return nDataFAT; }
 void  SetDataFATStart( sal_Int32 n );
-sal_Int32 GetDataFATSize() const{ return nDataFATSize;  }
+sal_Int32 GetDataFATSize() const{ return nDataFATSize; }
 void  SetDataFATSize( sal_Int32 n );
-sal_Int32 GetThreshold() const  { return nThreshold;}
-short GetPageSize() const   { return nPageSize; }
+sal_Int32 GetThreshold() const  { return nThreshold; }
+short GetPageSize() const   { return nPageSize; }
 short GetDataPageSize() const   { return nDataPageSize; }
-sal_Int32 GetFATSize() const{ return nFATSize;  }
+sal_Int32 GetFATSize() const{ return nFATSize; }
 void  SetFATSize( sal_Int32 n );
-sal_Int32 GetFATChain() const   { return 

[Libreoffice-commits] core.git: sot/source

2013-03-30 Thread Julien Nabet
 sot/source/sdstor/storage.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d0c94302b89a99c31a7a76f07c58b29638ac3d0f
Author: Julien Nabet serval2...@yahoo.fr
Date:   Sat Mar 30 19:25:20 2013 +0100

coverity#440717 Dereference after null check

Change-Id: I2ff581a72aa66bff8943d31499013b31e360333b

diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 130043e..52057a4 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -337,7 +337,7 @@ sal_Bool SotStorageStream::Commit()
 
 sal_Bool SotStorageStream::Revert()
 {
-if( !pOwnStm )
+if( pOwnStm )
 {
 pOwnStm-Revert();
 SetError( pOwnStm-GetError() );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2013-03-26 Thread Julien Nabet
 sot/source/sdstor/stgdir.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit daac7e3828e97d325e11b165a04b58ff4f96b131
Author: Julien Nabet serval2...@yahoo.fr
Date:   Tue Mar 26 19:11:05 2013 +0100

coverity#982310 Logically dead code

Change-Id: Iee6d57bc9900d4c88d614eefe6878eaca6f5e2c3

diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index dedb7cd..fc110ad 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -970,7 +970,7 @@ void* StgDirStrm::GetEntry( sal_Int32 n, bool bDirty )
 return NULL;
 
 n *= STGENTRY_SIZE;
-if( n  0  n = nSize )
+if( n = nSize )
 return NULL;
 return GetPtr( n, true, bDirty );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sot/source

2013-03-19 Thread Krisztian Pinter
 sot/source/sdstor/stg.cxx |1 -
 sot/source/sdstor/storage.cxx |1 -
 2 files changed, 2 deletions(-)

New commits:
commit 0173e89ca254a18953615c07864d1da22e5149b5
Author: Krisztian Pinter pin.termina...@gmail.com
Date:   Tue Mar 19 20:01:14 2013 +0100

fdo#39445 writing out tools/fsys.hxx (sot)

removed unused includes from stg.cxx and storage.cxx

Change-Id: I7863ce1b40432fdf1fc5025b074721d395c0c15f
Reviewed-on: https://gerrit.libreoffice.org/2852
Reviewed-by: Björn Michaelsen bjoern.michael...@canonical.com
Tested-by: Björn Michaelsen bjoern.michael...@canonical.com

diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 5835acf..04cd70e 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -22,7 +22,6 @@
 #include osl/file.hxx
 #include tools/tempfile.hxx
 #include tools/string.hxx
-#include tools/fsys.hxx
 #include tools/stream.hxx
 #include tools/debug.hxx
 
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 55c74cb..130043e 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -31,7 +31,6 @@
 #include sot/formats.hxx
 #include sot/exchange.hxx
 #include unotools/ucbstreamhelper.hxx
-#include tools/fsys.hxx
 #include tools/cachestr.hxx
 #include tools/debug.hxx
 #include tools/urlobj.hxx
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits