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
5cd4300f
Kaydet (Commit)
5cd4300f
authored
12 years ago
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fixed a mess of out of bounds string accesses
Change-Id: I800840e1b3c0d97a049b3ceba0ec244365dc8e6b
üst
dfcbc1e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
23 deletions
+40
-23
zformat.cxx
svl/source/numbers/zformat.cxx
+40
-23
No files found.
svl/source/numbers/zformat.cxx
Dosyayı görüntüle @
5cd4300f
...
...
@@ -1416,6 +1416,21 @@ SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(const OUString& rStr
return
(
cToken
==
']'
||
nPos
==
nLen
)
?
LocaleType
(
nNum
)
:
LocaleType
();
}
static
bool
lcl_matchKeywordAndGetNumber
(
const
OUString
&
rString
,
const
sal_Int32
nPos
,
const
OUString
&
rKeyword
,
sal_Int32
&
nNumber
)
{
if
(
0
<=
nPos
&&
nPos
+
rKeyword
.
getLength
()
<
rString
.
getLength
()
&&
rString
.
matchIgnoreAsciiCase
(
rKeyword
,
nPos
))
{
nNumber
=
rString
.
copy
(
nPos
+
rKeyword
.
getLength
()).
toInt32
();
return
true
;
}
else
{
nNumber
=
0
;
return
false
;
}
}
short
SvNumberformat
::
ImpNextSymbol
(
OUStringBuffer
&
rString
,
sal_Int32
&
nPos
,
OUString
&
sSymbol
)
...
...
@@ -1518,45 +1533,47 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString,
{
const
OUString
aNatNum
(
"NATNUM"
);
const
OUString
aDBNum
(
"DBNUM"
);
OUString
aUpperNatNum
(
rChrCls
().
uppercase
(
rString
.
toString
(),
nPos
-
1
,
aNatNum
.
getLength
()
)
);
OUString
aUpperDBNum
(
rChrCls
().
uppercase
(
rString
.
toString
(),
nPos
-
1
,
aDBNum
.
getLength
()
)
);
sal_Unicode
cUpper
=
aUpperNatNum
[
0
];
sal_Int32
nNatNumNum
=
rString
.
toString
().
copy
(
nPos
-
1
+
aNatNum
.
getLength
()
).
toInt32
();
sal_Unicode
cDBNum
=
nPos
-
1
+
aDBNum
.
getLength
()
<
rString
.
getLength
()
?
rString
[
nPos
-
1
+
aDBNum
.
getLength
()]
:
0
;
if
(
aUpperNatNum
==
aNatNum
&&
0
<=
nNatNumNum
&&
nNatNumNum
<=
19
)
const
OUString
aBufStr
(
rString
.
toString
());
sal_Int32
nNatNumNum
;
sal_Int32
nDBNum
;
if
(
lcl_matchKeywordAndGetNumber
(
aBufStr
,
nPos
-
1
,
aNatNum
,
nNatNumNum
)
&&
0
<=
nNatNumNum
&&
nNatNumNum
<=
19
)
{
sBuffSymbol
.
stripStart
((
sal_Unicode
)
'['
);
sBuffSymbol
.
append
(
rString
.
toString
()
.
copy
(
--
nPos
,
aNatNum
.
getLength
()
+
1
));
sBuffSymbol
.
append
(
aBufStr
.
copy
(
--
nPos
,
aNatNum
.
getLength
()
+
1
));
nPos
+=
aNatNum
.
getLength
()
+
1
;
//! SymbolType is negative
eSymbolType
=
(
short
)
(
BRACKET_SYMBOLTYPE_NATNUM0
-
nNatNumNum
);
eState
=
SsGetPrefix
;
}
else
if
(
aUpperDBNum
==
aDBNum
&&
'1'
<=
cDBNum
&&
cDBNum
<=
'9'
)
else
if
(
lcl_matchKeywordAndGetNumber
(
aBufStr
,
nPos
-
1
,
aDBNum
,
nDBNum
)
&&
'1'
<=
nDBNum
&&
nDBNum
<=
'9'
)
{
sBuffSymbol
.
stripStart
((
sal_Unicode
)
'['
);
sBuffSymbol
.
append
(
rString
.
toString
().
copy
(
--
nPos
,
aDBNum
.
getLength
()
+
1
));
nPos
+=
aDBNum
.
getLength
()
+
1
;
//! SymbolType is negative
eSymbolType
=
sal
::
static_int_cast
<
short
>
(
BRACKET_SYMBOLTYPE_DBNUM1
-
(
c
DBNum
-
'1'
));
eSymbolType
=
sal
::
static_int_cast
<
short
>
(
BRACKET_SYMBOLTYPE_DBNUM1
-
(
n
DBNum
-
'1'
));
eState
=
SsGetPrefix
;
}
else
if
(
cUpper
==
rKeywords
[
NF_KEY_H
][
0
]
||
// H
cUpper
==
rKeywords
[
NF_KEY_MI
][
0
]
||
// M
cUpper
==
rKeywords
[
NF_KEY_S
][
0
]
)
// S
{
sBuffSymbol
.
append
(
cToken
);
eState
=
SsGetTime
;
cLetter
=
cToken
;
}
else
{
sBuffSymbol
.
stripStart
((
sal_Unicode
)
'['
);
sBuffSymbol
.
append
(
cToken
);
eSymbolType
=
BRACKET_SYMBOLTYPE_COLOR
;
eState
=
SsGetPrefix
;
sal_Unicode
cUpper
=
rChrCls
().
uppercase
(
aBufStr
,
nPos
-
1
,
1
)[
0
];
if
(
cUpper
==
rKeywords
[
NF_KEY_H
][
0
]
||
// H
cUpper
==
rKeywords
[
NF_KEY_MI
][
0
]
||
// M
cUpper
==
rKeywords
[
NF_KEY_S
][
0
]
)
// S
{
sBuffSymbol
.
append
(
cToken
);
eState
=
SsGetTime
;
cLetter
=
cToken
;
}
else
{
sBuffSymbol
.
stripStart
((
sal_Unicode
)
'['
);
sBuffSymbol
.
append
(
cToken
);
eSymbolType
=
BRACKET_SYMBOLTYPE_COLOR
;
eState
=
SsGetPrefix
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
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