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
f20feba4
Kaydet (Commit)
f20feba4
authored
Eki 14, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
resolved fdo#70319 exponent must be followed by at least one digit
Change-Id: Icdd22fa0f1efcdd18cfea7cb48e1cbf2cf8d3533
üst
241454c4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
test-rtl-math.cxx
sal/qa/rtl/math/test-rtl-math.cxx
+12
-0
math.cxx
sal/rtl/math.cxx
+6
-0
No files found.
sal/qa/rtl/math/test-rtl-math.cxx
Dosyayı görüntüle @
f20feba4
...
...
@@ -72,9 +72,21 @@ public:
CPPUNIT_ASSERT_EQUAL
(
0.0
,
res
);
}
void
test_stringToDouble_exponent_without_digit
()
{
rtl_math_ConversionStatus
status
;
sal_Int32
end
;
double
res
=
rtl
::
math
::
stringToDouble
(
rtl
::
OUString
(
"1e"
),
sal_Unicode
(
'.'
),
sal_Unicode
(
','
),
&
status
,
&
end
);
CPPUNIT_ASSERT_EQUAL
(
rtl_math_ConversionStatus_Ok
,
status
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
RTL_CONSTASCII_LENGTH
(
"1"
)),
end
);
CPPUNIT_ASSERT_EQUAL
(
1.0
,
res
);
}
CPPUNIT_TEST_SUITE
(
Test
);
CPPUNIT_TEST
(
test_stringToDouble_good
);
CPPUNIT_TEST
(
test_stringToDouble_bad
);
CPPUNIT_TEST
(
test_stringToDouble_exponent_without_digit
);
CPPUNIT_TEST_SUITE_END
();
};
...
...
sal/rtl/math.cxx
Dosyayı görüntüle @
f20feba4
...
...
@@ -799,6 +799,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
// Exponent
if
(
p
!=
p0
&&
p
!=
pEnd
&&
(
*
p
==
CharT
(
'E'
)
||
*
p
==
CharT
(
'e'
)))
{
CharT
const
*
const
pExponent
=
p
;
++
p
;
bool
bExpSign
;
if
(
p
!=
pEnd
&&
*
p
==
CharT
(
'-'
))
...
...
@@ -812,6 +813,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
if
(
p
!=
pEnd
&&
*
p
==
CharT
(
'+'
))
++
p
;
}
CharT
const
*
const
pFirstExpDigit
=
p
;
if
(
fVal
==
0.0
)
{
// no matter what follows, zero stays zero, but carry on the
// offset
...
...
@@ -857,6 +859,10 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
else
fVal
=
rtl
::
math
::
pow10Exp
(
fVal
,
nExp
);
// normal
}
else
if
(
p
==
pFirstExpDigit
)
{
// no digits in exponent, reset end of scan
p
=
pExponent
;
}
}
}
else
if
(
p
-
p0
==
2
&&
p
!=
pEnd
&&
p
[
0
]
==
CharT
(
'#'
)
...
...
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