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
fc8b8033
Kaydet (Commit)
fc8b8033
authored
Mar 21, 2014
tarafından
Takeshi Abe
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Avoid possible resource leaks by boost::scoped_array
Change-Id: I4287fa05e35c132fb6e11d95dd17c3d3bf29defc
üst
5299cc26
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
32 deletions
+28
-32
nranges.cxx
svl/source/items/nranges.cxx
+11
-13
poolio.cxx
svl/source/items/poolio.cxx
+5
-4
PasswordHelper.cxx
svl/source/misc/PasswordHelper.cxx
+5
-8
saldisp.cxx
vcl/unx/generic/app/saldisp.cxx
+3
-4
jobdata.cxx
vcl/unx/generic/printer/jobdata.cxx
+4
-3
No files found.
svl/source/items/nranges.cxx
Dosyayı görüntüle @
fc8b8033
...
...
@@ -20,7 +20,7 @@
#include <cassert>
#include <vector>
// compiled via include from itemset.cxx only!
#include <boost/scoped_array.hpp>
#ifdef DBG_UTIL
...
...
@@ -436,9 +436,9 @@ SfxUShortRanges& SfxUShortRanges::operator -=
// (size is computed for maximal possibly split-count plus terminating 0)
sal_uInt16
nThisSize
=
Count_Impl
(
_pRanges
);
sal_uInt16
nTargetSize
=
1
+
(
nThisSize
+
Count_Impl
(
rRanges
.
_pRanges
)
);
sal_uInt16
*
pTarget
=
new
sal_uInt16
[
nTargetSize
]
;
memset
(
pTarget
,
0
,
sizeof
(
sal_uInt16
)
*
nTargetSize
);
memcpy
(
pTarget
,
_pRanges
,
sizeof
(
sal_uInt16
)
*
nThisSize
);
boost
::
scoped_array
<
sal_uInt16
>
pTarget
(
new
sal_uInt16
[
nTargetSize
])
;
memset
(
pTarget
.
get
()
,
0
,
sizeof
(
sal_uInt16
)
*
nTargetSize
);
memcpy
(
pTarget
.
get
()
,
_pRanges
,
sizeof
(
sal_uInt16
)
*
nThisSize
);
sal_uInt16
nPos1
=
0
,
nPos2
=
0
,
nTargetPos
=
0
;
while
(
_pRanges
[
nPos1
]
)
...
...
@@ -540,16 +540,15 @@ SfxUShortRanges& SfxUShortRanges::operator -=
// assign the differentiated ranges
delete
[]
_pRanges
;
sal_uInt16
nUShorts
=
Count_Impl
(
pTarget
)
+
1
;
sal_uInt16
nUShorts
=
Count_Impl
(
pTarget
.
get
()
)
+
1
;
if
(
1
!=
nUShorts
)
{
_pRanges
=
new
sal_uInt16
[
nUShorts
];
memcpy
(
_pRanges
,
pTarget
,
nUShorts
*
sizeof
(
sal_uInt16
)
);
memcpy
(
_pRanges
,
pTarget
.
get
()
,
nUShorts
*
sizeof
(
sal_uInt16
)
);
}
else
_pRanges
=
0
;
delete
[]
pTarget
;
return
*
this
;
}
...
...
@@ -587,9 +586,9 @@ SfxUShortRanges& SfxUShortRanges::operator /=
// (size is computed for maximal possibly split-count plus terminating 0)
sal_uInt16
nThisSize
=
Count_Impl
(
_pRanges
);
sal_uInt16
nTargetSize
=
1
+
(
nThisSize
+
Count_Impl
(
rRanges
.
_pRanges
)
);
sal_uInt16
*
pTarget
=
new
sal_uInt16
[
nTargetSize
]
;
memset
(
pTarget
,
0
,
sizeof
(
sal_uInt16
)
*
nTargetSize
);
memcpy
(
pTarget
,
_pRanges
,
sizeof
(
sal_uInt16
)
*
nThisSize
);
boost
::
scoped_array
<
sal_uInt16
>
pTarget
(
new
sal_uInt16
[
nTargetSize
])
;
memset
(
pTarget
.
get
()
,
0
,
sizeof
(
sal_uInt16
)
*
nTargetSize
);
memcpy
(
pTarget
.
get
()
,
_pRanges
,
sizeof
(
sal_uInt16
)
*
nThisSize
);
sal_uInt16
nPos1
=
0
,
nPos2
=
0
,
nTargetPos
=
0
;
while
(
_pRanges
[
nPos1
]
!=
0
&&
rRanges
.
_pRanges
[
nPos2
]
!=
0
)
...
...
@@ -659,16 +658,15 @@ SfxUShortRanges& SfxUShortRanges::operator /=
// assign the intersected ranges
delete
[]
_pRanges
;
sal_uInt16
nUShorts
=
Count_Impl
(
pTarget
)
+
1
;
sal_uInt16
nUShorts
=
Count_Impl
(
pTarget
.
get
()
)
+
1
;
if
(
1
!=
nUShorts
)
{
_pRanges
=
new
sal_uInt16
[
nUShorts
];
memcpy
(
_pRanges
,
pTarget
,
nUShorts
*
sizeof
(
sal_uInt16
)
);
memcpy
(
_pRanges
,
pTarget
.
get
()
,
nUShorts
*
sizeof
(
sal_uInt16
)
);
}
else
_pRanges
=
0
;
delete
[]
pTarget
;
return
*
this
;
}
...
...
svl/source/items/poolio.cxx
Dosyayı görüntüle @
fc8b8033
...
...
@@ -28,6 +28,7 @@
#include <svl/brdcst.hxx>
#include <svl/filerec.hxx>
#include "poolio.hxx"
#include <boost/scoped_array.hpp>
// STATIC DATA -----------------------------------------------------------
...
...
@@ -762,10 +763,10 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
CHECK_FILEFORMAT
(
rStream
,
SFX_ITEMPOOL_TAG_SIZES
);
sal_uInt32
nSizeTableLen
(
0
);
rStream
.
ReadUInt32
(
nSizeTableLen
);
sal_Char
*
pBuf
=
new
sal_Char
[
nSizeTableLen
]
;
rStream
.
Read
(
pBuf
,
nSizeTableLen
);
boost
::
scoped_array
<
sal_Char
>
pBuf
(
new
sal_Char
[
nSizeTableLen
])
;
rStream
.
Read
(
pBuf
.
get
()
,
nSizeTableLen
);
sal_uLong
nEndOfSizes
=
rStream
.
Tell
();
SvMemoryStream
aSizeTable
(
pBuf
,
nSizeTableLen
,
STREAM_READ
);
SvMemoryStream
aSizeTable
(
pBuf
.
get
()
,
nSizeTableLen
,
STREAM_READ
);
// ab Version 1.3 steht in der Size-Table eine Versions-Map
if
(
pImp
->
nMajorVer
>
1
||
pImp
->
nMinorVer
>=
3
)
...
...
@@ -968,7 +969,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
rStream
.
Seek
(
nPos
+
nSize
);
}
delete
[]
pBuf
;
pBuf
.
reset
()
;
rStream
.
Seek
(
nEndOfSizes
);
CHECK_FILEFORMAT
(
rStream
,
SFX_ITEMPOOL_TAG_ENDPOOL
);
CHECK_FILEFORMAT
(
rStream
,
SFX_ITEMPOOL_TAG_ENDPOOL
);
...
...
svl/source/misc/PasswordHelper.cxx
Dosyayı görüntüle @
fc8b8033
...
...
@@ -20,6 +20,7 @@
#include <svl/PasswordHelper.hxx>
#include <rtl/digest.h>
#include <boost/scoped_array.hpp>
using
namespace
com
::
sun
::
star
;
...
...
@@ -37,7 +38,7 @@ void SvPasswordHelper::GetHashPassword(uno::Sequence<sal_Int8>& rPassHash, const
void
SvPasswordHelper
::
GetHashPasswordLittleEndian
(
uno
::
Sequence
<
sal_Int8
>&
rPassHash
,
const
OUString
&
sPass
)
{
sal_Int32
nSize
(
sPass
.
getLength
());
sal_Char
*
pCharBuffer
=
new
sal_Char
[
nSize
*
sizeof
(
sal_Unicode
)]
;
boost
::
scoped_array
<
sal_Char
>
pCharBuffer
(
new
sal_Char
[
nSize
*
sizeof
(
sal_Unicode
)])
;
for
(
sal_Int32
i
=
0
;
i
<
nSize
;
++
i
)
{
...
...
@@ -46,15 +47,13 @@ void SvPasswordHelper::GetHashPasswordLittleEndian(uno::Sequence<sal_Int8>& rPas
pCharBuffer
[
2
*
i
+
1
]
=
static_cast
<
sal_Char
>
(
ch
>>
8
);
}
GetHashPassword
(
rPassHash
,
pCharBuffer
,
nSize
*
sizeof
(
sal_Unicode
));
delete
[]
pCharBuffer
;
GetHashPassword
(
rPassHash
,
pCharBuffer
.
get
(),
nSize
*
sizeof
(
sal_Unicode
));
}
void
SvPasswordHelper
::
GetHashPasswordBigEndian
(
uno
::
Sequence
<
sal_Int8
>&
rPassHash
,
const
OUString
&
sPass
)
{
sal_Int32
nSize
(
sPass
.
getLength
());
sal_Char
*
pCharBuffer
=
new
sal_Char
[
nSize
*
sizeof
(
sal_Unicode
)]
;
boost
::
scoped_array
<
sal_Char
>
pCharBuffer
(
new
sal_Char
[
nSize
*
sizeof
(
sal_Unicode
)])
;
for
(
sal_Int32
i
=
0
;
i
<
nSize
;
++
i
)
{
...
...
@@ -63,9 +62,7 @@ void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence<sal_Int8>& rPassHa
pCharBuffer
[
2
*
i
+
1
]
=
static_cast
<
sal_Char
>
(
ch
&
0xFF
);
}
GetHashPassword
(
rPassHash
,
pCharBuffer
,
nSize
*
sizeof
(
sal_Unicode
));
delete
[]
pCharBuffer
;
GetHashPassword
(
rPassHash
,
pCharBuffer
.
get
(),
nSize
*
sizeof
(
sal_Unicode
));
}
void
SvPasswordHelper
::
GetHashPassword
(
uno
::
Sequence
<
sal_Int8
>&
rPassHash
,
const
OUString
&
sPass
)
...
...
vcl/unx/generic/app/saldisp.cxx
Dosyayı görüntüle @
fc8b8033
...
...
@@ -77,6 +77,7 @@ Status XineramaGetInfo(Display*, int, XRectangle*, unsigned char*, int*);
#include <osl/socket.h>
#include <poll.h>
#include <boost/scoped_array.hpp>
using
namespace
vcl_sal
;
...
...
@@ -2647,7 +2648,7 @@ void SalColormap::GetPalette()
Pixel
i
;
m_aPalette
=
std
::
vector
<
SalColor
>
(
m_nUsed
);
XColor
*
aColor
=
new
XColor
[
m_nUsed
]
;
boost
::
scoped_array
<
XColor
>
aColor
(
new
XColor
[
m_nUsed
])
;
for
(
i
=
0
;
i
<
m_nUsed
;
i
++
)
{
...
...
@@ -2655,7 +2656,7 @@ void SalColormap::GetPalette()
aColor
[
i
].
pixel
=
i
;
}
XQueryColors
(
m_pDisplay
->
GetDisplay
(),
m_hColormap
,
aColor
,
m_nUsed
);
XQueryColors
(
m_pDisplay
->
GetDisplay
(),
m_hColormap
,
aColor
.
get
()
,
m_nUsed
);
for
(
i
=
0
;
i
<
m_nUsed
;
i
++
)
{
...
...
@@ -2663,8 +2664,6 @@ void SalColormap::GetPalette()
aColor
[
i
].
green
>>
8
,
aColor
[
i
].
blue
>>
8
);
}
delete
[]
aColor
;
}
static
sal_uInt16
sal_Lookup
(
const
std
::
vector
<
SalColor
>&
rPalette
,
...
...
vcl/unx/generic/printer/jobdata.cxx
Dosyayı görüntüle @
fc8b8033
...
...
@@ -25,6 +25,7 @@
#include <sal/alloca.h>
#include <rtl/strbuf.hxx>
#include <boost/scoped_array.hpp>
using
namespace
psp
;
...
...
@@ -175,10 +176,10 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes )
// now append the PPDContext stream buffer
aStream
.
WriteLine
(
"PPDContexData"
);
sal_uLong
nBytes
;
char
*
pContextBuffer
=
m_aContext
.
getStreamableBuffer
(
nBytes
);
boost
::
scoped_array
<
char
>
pContextBuffer
(
m_aContext
.
getStreamableBuffer
(
nBytes
)
);
if
(
nBytes
)
aStream
.
Write
(
pContextBuffer
,
nBytes
);
delete
[]
pContextBuffer
;
aStream
.
Write
(
pContextBuffer
.
get
()
,
nBytes
);
pContextBuffer
.
reset
()
;
// success
pData
=
rtl_allocateMemory
(
bytes
=
aStream
.
Tell
()
);
...
...
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