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
3952fab4
Kaydet (Commit)
3952fab4
authored
Mar 26, 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: I8b57f970b31b12902e3772c3306b71379b8d3fe5
üst
1c00c606
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
23 deletions
+18
-23
OPropertySet.cxx
chart2/source/tools/OPropertySet.cxx
+9
-8
Splines.cxx
chart2/source/view/charttypes/Splines.cxx
+9
-15
No files found.
chart2/source/tools/OPropertySet.cxx
Dosyayı görüntüle @
3952fab4
...
...
@@ -25,6 +25,7 @@
#include <vector>
#include <algorithm>
#include <boost/scoped_array.hpp>
using
namespace
::
com
::
sun
::
star
;
...
...
@@ -147,11 +148,11 @@ Sequence< beans::PropertyState > SAL_CALL
{
cppu
::
IPropertyArrayHelper
&
rPH
=
getInfoHelper
();
sal_Int32
*
pHandles
=
new
sal_Int32
[
aPropertyName
.
getLength
()
]
;
rPH
.
fillHandles
(
pHandles
,
aPropertyName
);
boost
::
scoped_array
<
sal_Int32
>
pHandles
(
new
sal_Int32
[
aPropertyName
.
getLength
()
])
;
rPH
.
fillHandles
(
pHandles
.
get
()
,
aPropertyName
);
::
std
::
vector
<
sal_Int32
>
aHandles
(
pHandles
,
pHandles
+
aPropertyName
.
getLength
());
delete
[]
pHandles
;
::
std
::
vector
<
sal_Int32
>
aHandles
(
pHandles
.
get
(),
pHandles
.
get
()
+
aPropertyName
.
getLength
());
pHandles
.
reset
()
;
return
m_pImplProperties
->
GetPropertyStatesByHandle
(
aHandles
);
}
...
...
@@ -198,11 +199,11 @@ void SAL_CALL
{
cppu
::
IPropertyArrayHelper
&
rPH
=
getInfoHelper
();
sal_Int32
*
pHandles
=
new
sal_Int32
[
aPropertyNames
.
getLength
()
]
;
rPH
.
fillHandles
(
pHandles
,
aPropertyNames
);
boost
::
scoped_array
<
sal_Int32
>
pHandles
(
new
sal_Int32
[
aPropertyNames
.
getLength
()
])
;
rPH
.
fillHandles
(
pHandles
.
get
()
,
aPropertyNames
);
::
std
::
vector
<
sal_Int32
>
aHandles
(
pHandles
,
pHandles
+
aPropertyNames
.
getLength
());
delete
[]
pHandles
;
::
std
::
vector
<
sal_Int32
>
aHandles
(
pHandles
.
get
(),
pHandles
.
get
()
+
aPropertyNames
.
getLength
());
pHandles
.
reset
()
;
m_pImplProperties
->
SetPropertiesToDefault
(
aHandles
);
}
...
...
chart2/source/view/charttypes/Splines.cxx
Dosyayı görüntüle @
3952fab4
...
...
@@ -23,6 +23,7 @@
#include <vector>
#include <algorithm>
#include <functional>
#include <boost/scoped_array.hpp>
#define MAX_BSPLINE_DEGREE 15
...
...
@@ -727,30 +728,29 @@ void SplineCalculater::CalculateBSplines(
continue
;
// need at least 2 points, degree p needs at least n+1 points
// next piece of series
double
*
t
=
new
double
[
n
+
1
]
;
if
(
!
createParameterT
(
aPointsIn
,
t
))
boost
::
scoped_array
<
double
>
t
(
new
double
[
n
+
1
])
;
if
(
!
createParameterT
(
aPointsIn
,
t
.
get
()
))
{
delete
[]
t
;
continue
;
// next piece of series
}
lcl_tSizeType
m
=
n
+
p
+
1
;
double
*
u
=
new
double
[
m
+
1
]
;
createKnotVector
(
n
,
p
,
t
,
u
);
boost
::
scoped_array
<
double
>
u
(
new
double
[
m
+
1
])
;
createKnotVector
(
n
,
p
,
t
.
get
(),
u
.
get
()
);
// The matrix N contains the B-spline basis functions applied to parameters.
// In each row only p+1 adjacent elements are non-zero. The starting
// column in a higher row is equal or greater than in the lower row.
// To store this matrix the non-zero elements are shifted to column 0
// and the amount of shifting is remembered in an array.
double
**
aMatN
=
new
double
*
[
n
+
1
]
;
boost
::
scoped_array
<
double
*>
aMatN
(
new
double
*
[
n
+
1
])
;
for
(
lcl_tSizeType
row
=
0
;
row
<=
n
;
++
row
)
{
aMatN
[
row
]
=
new
double
[
p
+
1
];
for
(
sal_uInt32
col
=
0
;
col
<=
p
;
++
col
)
aMatN
[
row
][
col
]
=
0.0
;
}
lcl_tSizeType
*
aShift
=
new
lcl_tSizeType
[
n
+
1
]
;
boost
::
scoped_array
<
lcl_tSizeType
>
aShift
(
new
lcl_tSizeType
[
n
+
1
])
;
aMatN
[
0
][
0
]
=
1.0
;
//all others are zero
aShift
[
0
]
=
0
;
aMatN
[
n
][
0
]
=
1.0
;
...
...
@@ -770,7 +770,7 @@ void SplineCalculater::CalculateBSplines(
// index in reduced matrix aMatN = (index in full matrix N) - (i-p)
aShift
[
k
]
=
i
-
p
;
applyNtoParameterT
(
i
,
t
[
k
],
p
,
u
,
aMatN
[
k
]);
applyNtoParameterT
(
i
,
t
[
k
],
p
,
u
.
get
()
,
aMatN
[
k
]);
}
// next row k
// Get matrix C of control points from the matrix equation aMatN * C = aPointsIn
...
...
@@ -886,7 +886,7 @@ void SplineCalculater::CalculateBSplines(
pNewX
[
nNewSize
-
1
]
=
aPointsIn
[
n
].
first
;
pNewY
[
nNewSize
-
1
]
=
aPointsIn
[
n
].
second
;
pNewZ
[
nNewSize
-
1
]
=
fZCoordinate
;
double
*
aP
=
new
double
[
m
+
1
]
;
boost
::
scoped_array
<
double
>
aP
(
new
double
[
m
+
1
])
;
lcl_tSizeType
nLow
=
0
;
for
(
lcl_tSizeType
nTIndex
=
0
;
nTIndex
<=
n
-
1
;
++
nTIndex
)
{
...
...
@@ -939,17 +939,11 @@ void SplineCalculater::CalculateBSplines(
pNewZ
[
nNewIndex
]
=
fZCoordinate
;
}
}
delete
[]
aP
;
}
delete
[]
aShift
;
for
(
lcl_tSizeType
row
=
0
;
row
<=
n
;
++
row
)
{
delete
[]
aMatN
[
row
];
}
delete
[]
aMatN
;
delete
[]
u
;
delete
[]
t
;
}
// next piece of the series
}
...
...
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