Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
1bae012c
Kaydet (Commit)
1bae012c
authored
Tem 12, 2014
tarafından
Takeshi Abe
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Avoid possible memory leaks in case of exceptions
Change-Id: Id0304366c4e6191db85527935f5bc5cdb0aeb8d8
üst
717f8a87
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
53 deletions
+46
-53
stgdir.cxx
sot/source/sdstor/stgdir.cxx
+4
-5
stgole.cxx
sot/source/sdstor/stgole.cxx
+4
-4
stgstrms.cxx
sot/source/sdstor/stgstrms.cxx
+8
-8
storage.cxx
sot/source/sdstor/storage.cxx
+8
-7
storinfo.cxx
sot/source/sdstor/storinfo.cxx
+4
-5
ucbstorage.cxx
sot/source/sdstor/ucbstorage.cxx
+18
-24
No files found.
sot/source/sdstor/stgdir.cxx
Dosyayı görüntüle @
1bae012c
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include "stgstrms.hxx"
#include "stgstrms.hxx"
#include "stgdir.hxx"
#include "stgdir.hxx"
#include "stgio.hxx"
#include "stgio.hxx"
#include <boost/scoped_array.hpp>
//////////////////////////// class StgDirEntry
//////////////////////////// class StgDirEntry
...
@@ -350,13 +350,12 @@ bool StgDirEntry::SetSize( sal_Int32 nNewSize )
...
@@ -350,13 +350,12 @@ bool StgDirEntry::SetSize( sal_Int32 nNewSize )
// if so, we probably need to copy the old data
// if so, we probably need to copy the old data
if
(
nOldSize
)
if
(
nOldSize
)
{
{
void
*
pBuf
=
new
sal_uInt8
[
nOldSize
]
;
boost
::
scoped_array
<
sal_uInt8
>
pBuf
(
new
sal_uInt8
[
nOldSize
])
;
pOld
->
Pos2Page
(
0L
);
pOld
->
Pos2Page
(
0L
);
pStgStrm
->
Pos2Page
(
0L
);
pStgStrm
->
Pos2Page
(
0L
);
if
(
pOld
->
Read
(
pBuf
,
nOldSize
)
if
(
pOld
->
Read
(
pBuf
.
get
()
,
nOldSize
)
&&
pStgStrm
->
Write
(
pBuf
,
nOldSize
)
)
&&
pStgStrm
->
Write
(
pBuf
.
get
()
,
nOldSize
)
)
bRes
=
true
;
bRes
=
true
;
delete
[]
static_cast
<
sal_uInt8
*>
(
pBuf
);
}
}
else
else
bRes
=
true
;
bRes
=
true
;
...
...
sot/source/sdstor/stgole.cxx
Dosyayı görüntüle @
1bae012c
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "rtl/string.h"
#include "rtl/string.h"
#include "stgole.hxx"
#include "stgole.hxx"
#include "sot/storinfo.hxx"
#include "sot/storinfo.hxx"
#include <boost/scoped_array.hpp>
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma warning(disable: 4342)
#pragma warning(disable: 4342)
...
@@ -117,9 +118,9 @@ bool StgCompObjStream::Load()
...
@@ -117,9 +118,9 @@ bool StgCompObjStream::Load()
// higher bits are ignored
// higher bits are ignored
sal_uLong
nStrLen
=
::
std
::
min
(
nLen1
,
(
sal_Int32
)
0xFFFE
);
sal_uLong
nStrLen
=
::
std
::
min
(
nLen1
,
(
sal_Int32
)
0xFFFE
);
sal_Char
*
p
=
new
sal_Char
[
nStrLen
+
1
]
;
boost
::
scoped_array
<
sal_Char
>
p
(
new
sal_Char
[
nStrLen
+
1
])
;
p
[
nStrLen
]
=
0
;
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 encoding here is "ANSI", which is pretty useless seeing as
//the actual codepage used doesn't seem to be specified/stored
//the actual codepage used doesn't seem to be specified/stored
...
@@ -127,12 +128,11 @@ bool StgCompObjStream::Load()
...
@@ -127,12 +128,11 @@ bool StgCompObjStream::Load()
//all platforms and envs
//all platforms and envs
//https://issues.apache.org/ooo/attachment.cgi?id=68668
//https://issues.apache.org/ooo/attachment.cgi?id=68668
//for a good edge-case example
//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
);
nCbFormat
=
ReadClipboardFormat
(
*
this
);
}
}
else
else
SetError
(
SVSTREAM_GENERALERROR
);
SetError
(
SVSTREAM_GENERALERROR
);
delete
[]
p
;
}
}
}
}
return
GetError
()
==
SVSTREAM_OK
;
return
GetError
()
==
SVSTREAM_OK
;
...
...
sot/source/sdstor/stgstrms.cxx
Dosyayı görüntüle @
1bae012c
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "stgstrms.hxx"
#include "stgstrms.hxx"
#include "stgdir.hxx"
#include "stgdir.hxx"
#include "stgio.hxx"
#include "stgio.hxx"
#include <boost/scoped_array.hpp>
///////////////////////////// class StgFAT
///////////////////////////// class StgFAT
...
@@ -1136,7 +1137,7 @@ bool StgTmpStrm::Copy( StgTmpStrm& rSrc )
...
@@ -1136,7 +1137,7 @@ bool StgTmpStrm::Copy( StgTmpStrm& rSrc )
SetSize
(
n
);
SetSize
(
n
);
if
(
GetError
()
==
SVSTREAM_OK
)
if
(
GetError
()
==
SVSTREAM_OK
)
{
{
sal_uInt8
*
p
=
new
sal_uInt8
[
4096
]
;
boost
::
scoped_array
<
sal_uInt8
>
p
(
new
sal_uInt8
[
4096
])
;
rSrc
.
Seek
(
0L
);
rSrc
.
Seek
(
0L
);
Seek
(
0L
);
Seek
(
0L
);
while
(
n
)
while
(
n
)
...
@@ -1144,13 +1145,13 @@ bool StgTmpStrm::Copy( StgTmpStrm& rSrc )
...
@@ -1144,13 +1145,13 @@ bool StgTmpStrm::Copy( StgTmpStrm& rSrc )
sal_uLong
nn
=
n
;
sal_uLong
nn
=
n
;
if
(
nn
>
4096
)
if
(
nn
>
4096
)
nn
=
4096
;
nn
=
4096
;
if
(
rSrc
.
Read
(
p
,
nn
)
!=
nn
)
if
(
rSrc
.
Read
(
p
.
get
()
,
nn
)
!=
nn
)
break
;
break
;
if
(
Write
(
p
,
nn
)
!=
nn
)
if
(
Write
(
p
.
get
()
,
nn
)
!=
nn
)
break
;
break
;
n
-=
nn
;
n
-=
nn
;
}
}
delete
[]
p
;
p
.
reset
()
;
rSrc
.
Seek
(
nCur
);
rSrc
.
Seek
(
nCur
);
Seek
(
nCur
);
Seek
(
nCur
);
return
n
==
0
;
return
n
==
0
;
...
@@ -1197,18 +1198,17 @@ void StgTmpStrm::SetSize(sal_uInt64 n)
...
@@ -1197,18 +1198,17 @@ void StgTmpStrm::SetSize(sal_uInt64 n)
sal_uLong
i
=
nEndOfData
;
sal_uLong
i
=
nEndOfData
;
if
(
i
)
if
(
i
)
{
{
sal_uInt8
*
p
=
new
sal_uInt8
[
4096
]
;
boost
::
scoped_array
<
sal_uInt8
>
p
(
new
sal_uInt8
[
4096
])
;
Seek
(
0L
);
Seek
(
0L
);
while
(
i
)
while
(
i
)
{
{
sal_uLong
nb
=
(
i
>
4096
)
?
4096
:
i
;
sal_uLong
nb
=
(
i
>
4096
)
?
4096
:
i
;
if
(
Read
(
p
,
nb
)
==
nb
if
(
Read
(
p
.
get
()
,
nb
)
==
nb
&&
s
->
Write
(
p
,
nb
)
==
nb
)
&&
s
->
Write
(
p
.
get
()
,
nb
)
==
nb
)
i
-=
nb
;
i
-=
nb
;
else
else
break
;
break
;
}
}
delete
[]
p
;
}
}
if
(
!
i
&&
n
>
nEndOfData
)
if
(
!
i
&&
n
>
nEndOfData
)
{
{
...
...
sot/source/sdstor/storage.cxx
Dosyayı görüntüle @
1bae012c
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
#include <unotools/localfilehelper.hxx>
#include <unotools/localfilehelper.hxx>
#include <unotools/ucbhelper.hxx>
#include <unotools/ucbhelper.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/processfactory.hxx>
#include <boost/scoped_array.hpp>
#include <boost/scoped_ptr.hpp>
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
;
...
@@ -230,17 +232,17 @@ bool SotStorageStream::CopyTo( SotStorageStream * pDestStm )
...
@@ -230,17 +232,17 @@ bool SotStorageStream::CopyTo( SotStorageStream * pDestStm )
Seek
(
0L
);
Seek
(
0L
);
pDestStm
->
SetSize
(
0
);
// Ziel-Stream leeren
pDestStm
->
SetSize
(
0
);
// Ziel-Stream leeren
void
*
pMem
=
new
sal_uInt8
[
8192
]
;
boost
::
scoped_array
<
sal_uInt8
>
pMem
(
new
sal_uInt8
[
8192
])
;
sal_uLong
nRead
;
sal_uLong
nRead
;
while
(
0
!=
(
nRead
=
Read
(
pMem
,
8192
))
)
while
(
0
!=
(
nRead
=
Read
(
pMem
.
get
()
,
8192
))
)
{
{
if
(
nRead
!=
pDestStm
->
Write
(
pMem
,
nRead
)
)
if
(
nRead
!=
pDestStm
->
Write
(
pMem
.
get
()
,
nRead
)
)
{
{
SetError
(
SVSTREAM_GENERALERROR
);
SetError
(
SVSTREAM_GENERALERROR
);
break
;
break
;
}
}
}
}
delete
[]
static_cast
<
sal_uInt8
*>
(
pMem
);
pMem
.
reset
(
);
// Position setzen
// Position setzen
pDestStm
->
Seek
(
nPos
);
pDestStm
->
Seek
(
nPos
);
Seek
(
nPos
);
Seek
(
nPos
);
...
@@ -581,9 +583,8 @@ bool SotStorage::IsStorageFile( const OUString & rFileName )
...
@@ -581,9 +583,8 @@ bool SotStorage::IsStorageFile( const OUString & rFileName )
aName
=
aObj
.
GetMainURL
(
INetURLObject
::
NO_DECODE
);
aName
=
aObj
.
GetMainURL
(
INetURLObject
::
NO_DECODE
);
}
}
SvStream
*
pStm
=
::
utl
::
UcbStreamHelper
::
CreateStream
(
aName
,
STREAM_STD_READ
);
boost
::
scoped_ptr
<
SvStream
>
pStm
(
::
utl
::
UcbStreamHelper
::
CreateStream
(
aName
,
STREAM_STD_READ
));
bool
bRet
=
SotStorage
::
IsStorageFile
(
pStm
);
bool
bRet
=
SotStorage
::
IsStorageFile
(
pStm
.
get
()
);
delete
pStm
;
return
bRet
;
return
bRet
;
}
}
...
...
sot/source/sdstor/storinfo.cxx
Dosyayı görüntüle @
1bae012c
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
#include <sot/stg.hxx>
#include <sot/stg.hxx>
#include <sot/storinfo.hxx>
#include <sot/storinfo.hxx>
#include <sot/exchange.hxx>
#include <sot/exchange.hxx>
#include <boost/scoped_array.hpp>
/************** class SvStorageInfo **************************************
/************** class SvStorageInfo **************************************
*************************************************************************/
*************************************************************************/
...
@@ -35,14 +35,13 @@ sal_uLong ReadClipboardFormat( SvStream & rStm )
...
@@ -35,14 +35,13 @@ sal_uLong ReadClipboardFormat( SvStream & rStm )
if
(
nLen
>
0
)
if
(
nLen
>
0
)
{
{
// get a string name
// get a string name
sal_Char
*
p
=
new
(
::
std
::
nothrow
)
sal_Char
[
nLen
]
;
boost
::
scoped_array
<
sal_Char
>
p
(
new
(
::
std
::
nothrow
)
sal_Char
[
nLen
])
;
if
(
p
&&
rStm
.
Read
(
p
,
nLen
)
==
(
sal_uLong
)
nLen
)
if
(
p
&&
rStm
.
Read
(
p
.
get
()
,
nLen
)
==
(
sal_uLong
)
nLen
)
{
{
nFormat
=
SotExchange
::
RegisterFormatName
(
OUString
(
p
,
nLen
-
1
,
RTL_TEXTENCODING_ASCII_US
));
nFormat
=
SotExchange
::
RegisterFormatName
(
OUString
(
p
.
get
()
,
nLen
-
1
,
RTL_TEXTENCODING_ASCII_US
));
}
}
else
else
rStm
.
SetError
(
SVSTREAM_GENERALERROR
);
rStm
.
SetError
(
SVSTREAM_GENERALERROR
);
delete
[]
p
;
}
}
else
if
(
nLen
==
-
1L
)
else
if
(
nLen
==
-
1L
)
// Windows clipboard format
// Windows clipboard format
...
...
sot/source/sdstor/ucbstorage.cxx
Dosyayı görüntüle @
1bae012c
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
#include <com/sun/star/packages/manifest/ManifestReader.hpp>
#include <com/sun/star/packages/manifest/ManifestReader.hpp>
#include <com/sun/star/ucb/InteractiveIOException.hpp>
#include <com/sun/star/ucb/InteractiveIOException.hpp>
#include <boost/scoped_array.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <rtl/digest.h>
#include <rtl/digest.h>
#include <tools/ref.hxx>
#include <tools/ref.hxx>
...
@@ -1402,7 +1403,7 @@ bool UCBStorageStream::CopyTo( BaseStorageStream* pDestStm )
...
@@ -1402,7 +1403,7 @@ bool UCBStorageStream::CopyTo( BaseStorageStream* pDestStm )
if
(
pDestStm
->
SetSize
(
n
)
&&
n
)
if
(
pDestStm
->
SetSize
(
n
)
&&
n
)
{
{
sal_uInt8
*
p
=
new
sal_uInt8
[
4096
]
;
boost
::
scoped_array
<
sal_uInt8
>
p
(
new
sal_uInt8
[
4096
])
;
Seek
(
0L
);
Seek
(
0L
);
pDestStm
->
Seek
(
0L
);
pDestStm
->
Seek
(
0L
);
while
(
n
)
while
(
n
)
...
@@ -1410,14 +1411,12 @@ bool UCBStorageStream::CopyTo( BaseStorageStream* pDestStm )
...
@@ -1410,14 +1411,12 @@ bool UCBStorageStream::CopyTo( BaseStorageStream* pDestStm )
sal_uInt32
nn
=
n
;
sal_uInt32
nn
=
n
;
if
(
nn
>
4096
)
if
(
nn
>
4096
)
nn
=
4096
;
nn
=
4096
;
if
(
Read
(
p
,
nn
)
!=
nn
)
if
(
Read
(
p
.
get
()
,
nn
)
!=
nn
)
break
;
break
;
if
(
pDestStm
->
Write
(
p
,
nn
)
!=
nn
)
if
(
pDestStm
->
Write
(
p
.
get
()
,
nn
)
!=
nn
)
break
;
break
;
n
-=
nn
;
n
-=
nn
;
}
}
delete
[]
p
;
}
}
return
true
;
return
true
;
...
@@ -1644,13 +1643,13 @@ UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, bool
...
@@ -1644,13 +1643,13 @@ UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, bool
m_aURL
=
aTemp
;
m_aURL
=
aTemp
;
// copy data into the temporary file
// copy data into the temporary file
SvStream
*
pStream
=
::
utl
::
UcbStreamHelper
::
CreateStream
(
m_pTempFile
->
GetURL
(),
STREAM_STD_READWRITE
,
true
/* bFileExists */
);
boost
::
scoped_ptr
<
SvStream
>
pStream
(
::
utl
::
UcbStreamHelper
::
CreateStream
(
m_pTempFile
->
GetURL
(),
STREAM_STD_READWRITE
,
true
/* bFileExists */
)
);
if
(
pStream
)
if
(
pStream
)
{
{
rStream
.
Seek
(
0
);
rStream
.
Seek
(
0
);
rStream
.
ReadStream
(
*
pStream
);
rStream
.
ReadStream
(
*
pStream
);
pStream
->
Flush
();
pStream
->
Flush
();
DELETEZ
(
pStream
);
pStream
.
reset
(
);
}
}
// close stream and let content access the file
// close stream and let content access the file
...
@@ -1694,7 +1693,7 @@ void UCBStorage_Impl::Init()
...
@@ -1694,7 +1693,7 @@ void UCBStorage_Impl::Init()
aObj
.
Append
(
OUString
(
"manifest.xml"
)
);
aObj
.
Append
(
OUString
(
"manifest.xml"
)
);
// create input stream
// create input stream
SvStream
*
pStream
=
::
utl
::
UcbStreamHelper
::
CreateStream
(
aObj
.
GetMainURL
(
INetURLObject
::
NO_DECODE
),
STREAM_STD_READ
);
boost
::
scoped_ptr
<
SvStream
>
pStream
(
::
utl
::
UcbStreamHelper
::
CreateStream
(
aObj
.
GetMainURL
(
INetURLObject
::
NO_DECODE
),
STREAM_STD_READ
)
);
// no stream means no manifest.xml
// no stream means no manifest.xml
if
(
pStream
)
if
(
pStream
)
{
{
...
@@ -1714,8 +1713,6 @@ void UCBStorage_Impl::Init()
...
@@ -1714,8 +1713,6 @@ void UCBStorage_Impl::Init()
xInputStream
=
NULL
;
xInputStream
=
NULL
;
SetProps
(
aProps
,
OUString
()
);
SetProps
(
aProps
,
OUString
()
);
}
}
delete
pStream
;
}
}
}
}
}
}
...
@@ -2273,7 +2270,7 @@ sal_Int16 UCBStorage_Impl::Commit()
...
@@ -2273,7 +2270,7 @@ sal_Int16 UCBStorage_Impl::Commit()
{
{
// create a stream to write the manifest file - use a temp file
// create a stream to write the manifest file - use a temp file
OUString
aURL
(
aNewSubFolder
.
getURL
()
);
OUString
aURL
(
aNewSubFolder
.
getURL
()
);
::
utl
::
TempFile
*
pTempFile
=
new
::
utl
::
TempFile
(
&
aURL
);
boost
::
scoped_ptr
<
::
utl
::
TempFile
>
pTempFile
(
new
::
utl
::
TempFile
(
&
aURL
)
);
// get the stream from the temp file and create an output stream wrapper
// get the stream from the temp file and create an output stream wrapper
SvStream
*
pStream
=
pTempFile
->
GetStream
(
STREAM_STD_READWRITE
);
SvStream
*
pStream
=
pTempFile
->
GetStream
(
STREAM_STD_READWRITE
);
...
@@ -2294,7 +2291,7 @@ sal_Int16 UCBStorage_Impl::Commit()
...
@@ -2294,7 +2291,7 @@ sal_Int16 UCBStorage_Impl::Commit()
Content
aSource
(
pTempFile
->
GetURL
(),
Reference
<
XCommandEnvironment
>
(),
comphelper
::
getProcessComponentContext
()
);
Content
aSource
(
pTempFile
->
GetURL
(),
Reference
<
XCommandEnvironment
>
(),
comphelper
::
getProcessComponentContext
()
);
xWriter
=
NULL
;
xWriter
=
NULL
;
xOutputStream
=
NULL
;
xOutputStream
=
NULL
;
DELETEZ
(
pTempFile
);
pTempFile
.
reset
(
);
aNewSubFolder
.
transferContent
(
aSource
,
InsertOperation_MOVE
,
OUString
(
"manifest.xml"
),
NameClash
::
OVERWRITE
);
aNewSubFolder
.
transferContent
(
aSource
,
InsertOperation_MOVE
,
OUString
(
"manifest.xml"
),
NameClash
::
OVERWRITE
);
}
}
}
}
...
@@ -2309,11 +2306,11 @@ sal_Int16 UCBStorage_Impl::Commit()
...
@@ -2309,11 +2306,11 @@ sal_Int16 UCBStorage_Impl::Commit()
m_pContent
->
executeCommand
(
OUString
(
"flush"
),
aAny
);
m_pContent
->
executeCommand
(
OUString
(
"flush"
),
aAny
);
if
(
m_pSource
!=
0
)
if
(
m_pSource
!=
0
)
{
{
SvStream
*
pStream
=
::
utl
::
UcbStreamHelper
::
CreateStream
(
m_pTempFile
->
GetURL
(),
STREAM_STD_READ
);
boost
::
scoped_ptr
<
SvStream
>
pStream
(
::
utl
::
UcbStreamHelper
::
CreateStream
(
m_pTempFile
->
GetURL
(),
STREAM_STD_READ
)
);
m_pSource
->
SetStreamSize
(
0
);
m_pSource
->
SetStreamSize
(
0
);
// m_pSource->Seek(0);
// m_pSource->Seek(0);
pStream
->
ReadStream
(
*
m_pSource
);
pStream
->
ReadStream
(
*
m_pSource
);
DELETEZ
(
pStream
);
pStream
.
reset
(
);
m_pSource
->
Seek
(
0
);
m_pSource
->
Seek
(
0
);
}
}
}
}
...
@@ -2534,7 +2531,7 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
...
@@ -2534,7 +2531,7 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
{
{
// copy the streams data
// copy the streams data
// the destination stream must not be open
// the destination stream must not be open
BaseStorageStream
*
pOtherStream
=
pDest
->
OpenStream
(
rNew
,
STREAM_WRITE
|
STREAM_SHARE_DENYALL
,
pImp
->
m_bDirect
);
boost
::
scoped_ptr
<
BaseStorageStream
>
pOtherStream
(
pDest
->
OpenStream
(
rNew
,
STREAM_WRITE
|
STREAM_SHARE_DENYALL
,
pImp
->
m_bDirect
)
);
BaseStorageStream
*
pStream
=
NULL
;
BaseStorageStream
*
pStream
=
NULL
;
bool
bDeleteStream
=
false
;
bool
bDeleteStream
=
false
;
...
@@ -2547,7 +2544,7 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
...
@@ -2547,7 +2544,7 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
bDeleteStream
=
true
;
bDeleteStream
=
true
;
}
}
pStream
->
CopyTo
(
pOtherStream
);
pStream
->
CopyTo
(
pOtherStream
.
get
()
);
SetError
(
pStream
->
GetError
()
);
SetError
(
pStream
->
GetError
()
);
if
(
pOtherStream
->
GetError
()
)
if
(
pOtherStream
->
GetError
()
)
pDest
->
SetError
(
pOtherStream
->
GetError
()
);
pDest
->
SetError
(
pOtherStream
->
GetError
()
);
...
@@ -2556,7 +2553,6 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
...
@@ -2556,7 +2553,6 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
if
(
bDeleteStream
)
if
(
bDeleteStream
)
delete
pStream
;
delete
pStream
;
delete
pOtherStream
;
}
}
else
else
{
{
...
@@ -2578,9 +2574,9 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
...
@@ -2578,9 +2574,9 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
UCBStorage
*
pUCBCopy
=
PTR_CAST
(
UCBStorage
,
pStorage
);
UCBStorage
*
pUCBCopy
=
PTR_CAST
(
UCBStorage
,
pStorage
);
bool
bOpenUCBStorage
=
pUCBDest
&&
pUCBCopy
;
bool
bOpenUCBStorage
=
pUCBDest
&&
pUCBCopy
;
BaseStorage
*
pOtherStorage
=
bOpenUCBStorage
?
boost
::
scoped_ptr
<
BaseStorage
>
pOtherStorage
(
bOpenUCBStorage
?
pDest
->
OpenUCBStorage
(
rNew
,
STREAM_WRITE
|
STREAM_SHARE_DENYALL
,
pImp
->
m_bDirect
)
:
pDest
->
OpenUCBStorage
(
rNew
,
STREAM_WRITE
|
STREAM_SHARE_DENYALL
,
pImp
->
m_bDirect
)
:
pDest
->
OpenOLEStorage
(
rNew
,
STREAM_WRITE
|
STREAM_SHARE_DENYALL
,
pImp
->
m_bDirect
);
pDest
->
OpenOLEStorage
(
rNew
,
STREAM_WRITE
|
STREAM_SHARE_DENYALL
,
pImp
->
m_bDirect
)
)
;
// For UCB storages, the class id and the format id may differ,
// For UCB storages, the class id and the format id may differ,
// do passing the class id is not sufficient.
// do passing the class id is not sufficient.
...
@@ -2590,7 +2586,7 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
...
@@ -2590,7 +2586,7 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
pUCBCopy
->
pImp
->
m_aUserTypeName
);
pUCBCopy
->
pImp
->
m_aUserTypeName
);
else
else
pOtherStorage
->
SetClassId
(
pStorage
->
GetClassId
()
);
pOtherStorage
->
SetClassId
(
pStorage
->
GetClassId
()
);
pStorage
->
CopyTo
(
pOtherStorage
);
pStorage
->
CopyTo
(
pOtherStorage
.
get
()
);
SetError
(
pStorage
->
GetError
()
);
SetError
(
pStorage
->
GetError
()
);
if
(
pOtherStorage
->
GetError
()
)
if
(
pOtherStorage
->
GetError
()
)
pDest
->
SetError
(
pOtherStorage
->
GetError
()
);
pDest
->
SetError
(
pOtherStorage
->
GetError
()
);
...
@@ -2599,7 +2595,6 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
...
@@ -2599,7 +2595,6 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
if
(
bDeleteStorage
)
if
(
bDeleteStorage
)
delete
pStorage
;
delete
pStorage
;
delete
pOtherStorage
;
}
}
return
Good
()
&&
pDest
->
Good
();
return
Good
()
&&
pDest
->
Good
();
...
@@ -3181,7 +3176,7 @@ OUString UCBStorage::CreateLinkFile( const OUString& rName )
...
@@ -3181,7 +3176,7 @@ OUString UCBStorage::CreateLinkFile( const OUString& rName )
OUString
aName
=
aFolderObj
.
GetName
();
OUString
aName
=
aFolderObj
.
GetName
();
aFolderObj
.
removeSegment
();
aFolderObj
.
removeSegment
();
OUString
aFolderURL
(
aFolderObj
.
GetMainURL
(
INetURLObject
::
NO_DECODE
)
);
OUString
aFolderURL
(
aFolderObj
.
GetMainURL
(
INetURLObject
::
NO_DECODE
)
);
::
utl
::
TempFile
*
pTempFile
=
new
::
utl
::
TempFile
(
&
aFolderURL
);
boost
::
scoped_ptr
<
::
utl
::
TempFile
>
pTempFile
(
new
::
utl
::
TempFile
(
&
aFolderURL
)
);
// get the stream from the temp file
// get the stream from the temp file
SvStream
*
pStream
=
pTempFile
->
GetStream
(
STREAM_STD_READWRITE
|
STREAM_TRUNC
);
SvStream
*
pStream
=
pTempFile
->
GetStream
(
STREAM_STD_READWRITE
|
STREAM_TRUNC
);
...
@@ -3236,13 +3231,12 @@ OUString UCBStorage::CreateLinkFile( const OUString& rName )
...
@@ -3236,13 +3231,12 @@ OUString UCBStorage::CreateLinkFile( const OUString& rName )
// move the stream to its desired location
// move the stream to its desired location
Content
aSource
(
pTempFile
->
GetURL
(),
Reference
<
XCommandEnvironment
>
(),
comphelper
::
getProcessComponentContext
()
);
Content
aSource
(
pTempFile
->
GetURL
(),
Reference
<
XCommandEnvironment
>
(),
comphelper
::
getProcessComponentContext
()
);
DELETEZ
(
pTempFile
);
pTempFile
.
reset
(
);
aFolder
.
transferContent
(
aSource
,
InsertOperation_MOVE
,
aName
,
NameClash
::
OVERWRITE
);
aFolder
.
transferContent
(
aSource
,
InsertOperation_MOVE
,
aName
,
NameClash
::
OVERWRITE
);
return
aURL
;
return
aURL
;
}
}
pTempFile
->
EnableKillingFile
(
true
);
pTempFile
->
EnableKillingFile
(
true
);
delete
pTempFile
;
return
OUString
();
return
OUString
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment