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
1a5457a1
Kaydet (Commit)
1a5457a1
authored
Nis 21, 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: I4b2b439615db0ff4598f405d1e339eebbff7ae91
üst
aa8820bd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
31 deletions
+19
-31
fwkutil.cxx
jvmfwk/source/fwkutil.cxx
+6
-7
xrmmerge.cxx
l10ntools/source/xrmmerge.cxx
+4
-4
hyphenimp.cxx
lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+9
-20
No files found.
jvmfwk/source/fwkutil.cxx
Dosyayı görüntüle @
1a5457a1
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
#include "framework.hxx"
#include "framework.hxx"
#include "fwkutil.hxx"
#include "fwkutil.hxx"
#include <boost/scoped_array.hpp>
using
namespace
osl
;
using
namespace
osl
;
...
@@ -114,10 +115,10 @@ rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData)
...
@@ -114,10 +115,10 @@ rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData)
static
const
char
EncodingTable
[]
=
static
const
char
EncodingTable
[]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
sal_Int32
lenRaw
=
rawData
.
getLength
();
sal_Int32
lenRaw
=
rawData
.
getLength
();
char
*
pBuf
=
new
char
[
lenRaw
*
2
]
;
boost
::
scoped_array
<
char
>
pBuf
(
new
char
[
lenRaw
*
2
])
;
const
sal_Int8
*
arRaw
=
rawData
.
getConstArray
();
const
sal_Int8
*
arRaw
=
rawData
.
getConstArray
();
char
*
pCurBuf
=
pBuf
;
char
*
pCurBuf
=
pBuf
.
get
()
;
for
(
int
i
=
0
;
i
<
lenRaw
;
i
++
)
for
(
int
i
=
0
;
i
<
lenRaw
;
i
++
)
{
{
unsigned
char
curChar
=
arRaw
[
i
];
unsigned
char
curChar
=
arRaw
[
i
];
...
@@ -133,8 +134,7 @@ rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData)
...
@@ -133,8 +134,7 @@ rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData)
pCurBuf
++
;
pCurBuf
++
;
}
}
rtl
::
ByteSequence
ret
((
sal_Int8
*
)
pBuf
,
lenRaw
*
2
);
rtl
::
ByteSequence
ret
((
sal_Int8
*
)
pBuf
.
get
(),
lenRaw
*
2
);
delete
[]
pBuf
;
return
ret
;
return
ret
;
}
}
...
@@ -144,7 +144,7 @@ rtl::ByteSequence decodeBase16(const rtl::ByteSequence& data)
...
@@ -144,7 +144,7 @@ rtl::ByteSequence decodeBase16(const rtl::ByteSequence& data)
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
sal_Int32
lenData
=
data
.
getLength
();
sal_Int32
lenData
=
data
.
getLength
();
sal_Int32
lenBuf
=
lenData
/
2
;
//always divisable by two
sal_Int32
lenBuf
=
lenData
/
2
;
//always divisable by two
unsigned
char
*
pBuf
=
new
unsigned
char
[
lenBuf
]
;
boost
::
scoped_array
<
unsigned
char
>
pBuf
(
new
unsigned
char
[
lenBuf
])
;
const
sal_Int8
*
pData
=
data
.
getConstArray
();
const
sal_Int8
*
pData
=
data
.
getConstArray
();
for
(
sal_Int32
i
=
0
;
i
<
lenBuf
;
i
++
)
for
(
sal_Int32
i
=
0
;
i
<
lenBuf
;
i
++
)
{
{
...
@@ -173,8 +173,7 @@ rtl::ByteSequence decodeBase16(const rtl::ByteSequence& data)
...
@@ -173,8 +173,7 @@ rtl::ByteSequence decodeBase16(const rtl::ByteSequence& data)
}
}
pBuf
[
i
]
=
nibble
;
pBuf
[
i
]
=
nibble
;
}
}
rtl
::
ByteSequence
ret
((
sal_Int8
*
)
pBuf
,
lenBuf
);
rtl
::
ByteSequence
ret
((
sal_Int8
*
)
pBuf
.
get
(),
lenBuf
);
delete
[]
pBuf
;
return
ret
;
return
ret
;
}
}
...
...
l10ntools/source/xrmmerge.cxx
Dosyayı görüntüle @
1a5457a1
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <iostream>
#include <iostream>
#include <fstream>
#include <fstream>
#include <vector>
#include <vector>
#include <boost/scoped_array.hpp>
using
namespace
std
;
using
namespace
std
;
...
@@ -327,13 +328,12 @@ void XRMResExport::WorkOnDesc(
...
@@ -327,13 +328,12 @@ void XRMResExport::WorkOnDesc(
ifstream
file
(
sDescFileName
.
getStr
(),
ios
::
in
|
ios
::
binary
|
ios
::
ate
);
ifstream
file
(
sDescFileName
.
getStr
(),
ios
::
in
|
ios
::
binary
|
ios
::
ate
);
if
(
file
.
is_open
())
{
if
(
file
.
is_open
())
{
int
size
=
static_cast
<
int
>
(
file
.
tellg
());
int
size
=
static_cast
<
int
>
(
file
.
tellg
());
char
*
memblock
=
new
char
[
size
+
1
]
;
boost
::
scoped_array
<
char
>
memblock
(
new
char
[
size
+
1
])
;
file
.
seekg
(
0
,
ios
::
beg
);
file
.
seekg
(
0
,
ios
::
beg
);
file
.
read
(
memblock
,
size
);
file
.
read
(
memblock
.
get
()
,
size
);
file
.
close
();
file
.
close
();
memblock
[
size
]
=
'\0'
;
memblock
[
size
]
=
'\0'
;
rText
=
OString
(
memblock
);
rText
=
OString
(
memblock
.
get
());
delete
[]
memblock
;
}
}
WorkOnText
(
rOpenTag
,
rText
);
WorkOnText
(
rOpenTag
,
rText
);
EndOfText
(
rOpenTag
,
rOpenTag
);
EndOfText
(
rOpenTag
,
rOpenTag
);
...
...
lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
Dosyayı görüntüle @
1a5457a1
...
@@ -47,6 +47,7 @@
...
@@ -47,6 +47,7 @@
#include <list>
#include <list>
#include <set>
#include <set>
#include <boost/scoped_array.hpp>
using
namespace
utl
;
using
namespace
utl
;
using
namespace
osl
;
using
namespace
osl
;
...
@@ -253,8 +254,6 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
...
@@ -253,8 +254,6 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
int
nHyphenationPosAlt
=
-
1
;
int
nHyphenationPosAlt
=
-
1
;
int
nHyphenationPosAltHyph
=
-
1
;
int
nHyphenationPosAltHyph
=
-
1
;
int
wordlen
;
int
wordlen
;
char
*
hyphens
;
char
*
lcword
;
int
k
=
0
;
int
k
=
0
;
PropertyHelper_Hyphenation
&
rHelper
=
GetPropHelper
();
PropertyHelper_Hyphenation
&
rHelper
=
GetPropHelper
();
...
@@ -341,15 +340,15 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
...
@@ -341,15 +340,15 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
OString
encWord
(
OU2ENC
(
nTerm
,
eEnc
));
OString
encWord
(
OU2ENC
(
nTerm
,
eEnc
));
wordlen
=
encWord
.
getLength
();
wordlen
=
encWord
.
getLength
();
lcword
=
new
char
[
wordlen
+
1
]
;
boost
::
scoped_array
<
char
>
lcword
(
new
char
[
wordlen
+
1
])
;
hyphens
=
new
char
[
wordlen
+
5
]
;
boost
::
scoped_array
<
char
>
hyphens
(
new
char
[
wordlen
+
5
])
;
char
**
rep
=
NULL
;
// replacements of discretionary hyphenation
char
**
rep
=
NULL
;
// replacements of discretionary hyphenation
int
*
pos
=
NULL
;
// array of [hyphenation point] minus [deletion position]
int
*
pos
=
NULL
;
// array of [hyphenation point] minus [deletion position]
int
*
cut
=
NULL
;
// length of deletions in original word
int
*
cut
=
NULL
;
// length of deletions in original word
// copy converted word into simple char buffer
// copy converted word into simple char buffer
strcpy
(
lcword
,
encWord
.
getStr
());
strcpy
(
lcword
.
get
()
,
encWord
.
getStr
());
// now strip off any ending periods
// now strip off any ending periods
int
n
=
wordlen
-
1
;
int
n
=
wordlen
-
1
;
...
@@ -358,15 +357,13 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
...
@@ -358,15 +357,13 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
n
++
;
n
++
;
if
(
n
>
0
)
if
(
n
>
0
)
{
{
const
bool
bFailed
=
0
!=
hnj_hyphen_hyphenate3
(
dict
,
lcword
,
n
,
hyphens
,
NULL
,
const
bool
bFailed
=
0
!=
hnj_hyphen_hyphenate3
(
dict
,
lcword
.
get
(),
n
,
hyphens
.
get
()
,
NULL
,
&
rep
,
&
pos
,
&
cut
,
minLead
,
minTrail
,
&
rep
,
&
pos
,
&
cut
,
minLead
,
minTrail
,
Max
(
dict
->
clhmin
,
Max
(
dict
->
clhmin
,
2
)
+
Max
(
0
,
minLead
-
Max
(
dict
->
lhmin
,
2
))),
Max
(
dict
->
clhmin
,
Max
(
dict
->
clhmin
,
2
)
+
Max
(
0
,
minLead
-
Max
(
dict
->
lhmin
,
2
))),
Max
(
dict
->
crhmin
,
Max
(
dict
->
crhmin
,
2
)
+
Max
(
0
,
minTrail
-
Max
(
dict
->
rhmin
,
2
)))
);
Max
(
dict
->
crhmin
,
Max
(
dict
->
crhmin
,
2
)
+
Max
(
0
,
minTrail
-
Max
(
dict
->
rhmin
,
2
)))
);
if
(
bFailed
)
if
(
bFailed
)
{
{
// whoops something did not work
// whoops something did not work
delete
[]
hyphens
;
delete
[]
lcword
;
if
(
rep
)
if
(
rep
)
{
{
for
(
int
j
=
0
;
j
<
n
;
j
++
)
for
(
int
j
=
0
;
j
<
n
;
j
++
)
...
@@ -480,8 +477,6 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
...
@@ -480,8 +477,6 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
}
}
}
}
delete
[]
lcword
;
delete
[]
hyphens
;
if
(
rep
)
if
(
rep
)
{
{
for
(
int
j
=
0
;
j
<
n
;
j
++
)
for
(
int
j
=
0
;
j
<
n
;
j
++
)
...
@@ -603,14 +598,14 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const
...
@@ -603,14 +598,14 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const
OString
encWord
(
OU2ENC
(
nTerm
,
eEnc
));
OString
encWord
(
OU2ENC
(
nTerm
,
eEnc
));
int
wordlen
=
encWord
.
getLength
();
int
wordlen
=
encWord
.
getLength
();
char
*
lcword
=
new
char
[
wordlen
+
1
]
;
boost
::
scoped_array
<
char
>
lcword
(
new
char
[
wordlen
+
1
])
;
char
*
hyphens
=
new
char
[
wordlen
+
5
]
;
boost
::
scoped_array
<
char
>
hyphens
(
new
char
[
wordlen
+
5
])
;
char
**
rep
=
NULL
;
// replacements of discretionary hyphenation
char
**
rep
=
NULL
;
// replacements of discretionary hyphenation
int
*
pos
=
NULL
;
// array of [hyphenation point] minus [deletion position]
int
*
pos
=
NULL
;
// array of [hyphenation point] minus [deletion position]
int
*
cut
=
NULL
;
// length of deletions in original word
int
*
cut
=
NULL
;
// length of deletions in original word
// copy converted word into simple char buffer
// copy converted word into simple char buffer
strcpy
(
lcword
,
encWord
.
getStr
());
strcpy
(
lcword
.
get
()
,
encWord
.
getStr
());
// first remove any trailing periods
// first remove any trailing periods
int
n
=
wordlen
-
1
;
int
n
=
wordlen
-
1
;
...
@@ -619,15 +614,12 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const
...
@@ -619,15 +614,12 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const
n
++
;
n
++
;
if
(
n
>
0
)
if
(
n
>
0
)
{
{
const
bool
bFailed
=
0
!=
hnj_hyphen_hyphenate3
(
dict
,
lcword
,
n
,
hyphens
,
NULL
,
const
bool
bFailed
=
0
!=
hnj_hyphen_hyphenate3
(
dict
,
lcword
.
get
(),
n
,
hyphens
.
get
()
,
NULL
,
&
rep
,
&
pos
,
&
cut
,
minLead
,
minTrail
,
&
rep
,
&
pos
,
&
cut
,
minLead
,
minTrail
,
Max
(
dict
->
clhmin
,
Max
(
dict
->
clhmin
,
2
)
+
Max
(
0
,
minLead
-
Max
(
dict
->
lhmin
,
2
))),
Max
(
dict
->
clhmin
,
Max
(
dict
->
clhmin
,
2
)
+
Max
(
0
,
minLead
-
Max
(
dict
->
lhmin
,
2
))),
Max
(
dict
->
crhmin
,
Max
(
dict
->
crhmin
,
2
)
+
Max
(
0
,
minTrail
-
Max
(
dict
->
rhmin
,
2
)))
);
Max
(
dict
->
crhmin
,
Max
(
dict
->
crhmin
,
2
)
+
Max
(
0
,
minTrail
-
Max
(
dict
->
rhmin
,
2
)))
);
if
(
bFailed
)
if
(
bFailed
)
{
{
delete
[]
hyphens
;
delete
[]
lcword
;
if
(
rep
)
if
(
rep
)
{
{
for
(
int
j
=
0
;
j
<
n
;
j
++
)
for
(
int
j
=
0
;
j
<
n
;
j
++
)
...
@@ -678,9 +670,6 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const
...
@@ -678,9 +670,6 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const
Reference
<
XPossibleHyphens
>
xRes
=
PossibleHyphens
::
CreatePossibleHyphens
(
Reference
<
XPossibleHyphens
>
xRes
=
PossibleHyphens
::
CreatePossibleHyphens
(
aWord
,
LinguLocaleToLanguage
(
aLocale
),
hyphenatedWord
,
aHyphPos
);
aWord
,
LinguLocaleToLanguage
(
aLocale
),
hyphenatedWord
,
aHyphPos
);
delete
[]
hyphens
;
delete
[]
lcword
;
if
(
rep
)
if
(
rep
)
{
{
for
(
int
j
=
0
;
j
<
n
;
j
++
)
for
(
int
j
=
0
;
j
<
n
;
j
++
)
...
...
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