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
f7a7a9dd
Kaydet (Commit)
f7a7a9dd
authored
Haz 25, 2015
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Do not forget to actually set newStr to an empty string
Change-Id: I745b09d8a248f08afdd3387f4cfcf69d71ec3c39
üst
0e2db2dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
test_strings_replace.cxx
sal/qa/rtl/strings/test_strings_replace.cxx
+19
-0
ustring.cxx
sal/rtl/ustring.cxx
+3
-3
No files found.
sal/qa/rtl/strings/test_strings_replace.cxx
Dosyayı görüntüle @
f7a7a9dd
...
...
@@ -20,6 +20,7 @@
namespace
{
OUString
s_empty
;
OUString
s_bar
(
"bar"
);
OUString
s_bars
(
"bars"
);
OUString
s_foo
(
"foo"
);
...
...
@@ -176,6 +177,9 @@ void Test::ustringReplaceFirstAsciiL() {
rtl
::
OUString
(
"foobarfoo"
).
replaceFirst
(
"bar"
,
s_other
,
&
n
));
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
-
1
),
n
);
}
CPPUNIT_ASSERT_EQUAL
(
rtl
::
OUString
(),
rtl
::
OUString
(
"xa"
).
replaceFirst
(
"xa"
,
s_empty
));
}
void
Test
::
ustringReplaceFirstToAsciiL
()
{
...
...
@@ -210,6 +214,9 @@ void Test::ustringReplaceFirstToAsciiL() {
rtl
::
OUString
(
"foobarfoo"
).
replaceFirst
(
s_bar
,
"other"
,
&
n
));
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
-
1
),
n
);
}
CPPUNIT_ASSERT_EQUAL
(
rtl
::
OUString
(),
rtl
::
OUString
(
"xa"
).
replaceFirst
(
s_xa
,
""
));
}
void
Test
::
ustringReplaceFirstAsciiLAsciiL
()
{
...
...
@@ -249,6 +256,9 @@ void Test::ustringReplaceFirstAsciiLAsciiL() {
replaceFirst
(
"bar"
,
"other"
,
&
n
)));
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
-
1
),
n
);
}
CPPUNIT_ASSERT_EQUAL
(
rtl
::
OUString
(),
rtl
::
OUString
(
"xa"
).
replaceFirst
(
"xa"
,
""
));
}
void
Test
::
ustringReplaceAll
()
{
...
...
@@ -277,6 +287,9 @@ void Test::ustringReplaceAllAsciiL() {
CPPUNIT_ASSERT_EQUAL
(
rtl
::
OUString
(
"xxa"
),
rtl
::
OUString
(
"xaa"
).
replaceAll
(
"xa"
,
s_xx
));
CPPUNIT_ASSERT_EQUAL
(
rtl
::
OUString
(),
rtl
::
OUString
(
"xa"
).
replaceAll
(
"xa"
,
s_empty
));
}
void
Test
::
ustringReplaceAllToAsciiL
()
{
...
...
@@ -291,6 +304,9 @@ void Test::ustringReplaceAllToAsciiL() {
CPPUNIT_ASSERT_EQUAL
(
rtl
::
OUString
(
"xxa"
),
rtl
::
OUString
(
"xaa"
).
replaceAll
(
s_xa
,
"xx"
));
CPPUNIT_ASSERT_EQUAL
(
rtl
::
OUString
(),
rtl
::
OUString
(
"xa"
).
replaceAll
(
s_xa
,
""
));
}
void
Test
::
ustringReplaceAllAsciiLAsciiL
()
{
...
...
@@ -308,6 +324,9 @@ void Test::ustringReplaceAllAsciiLAsciiL() {
rtl
::
OUString
(
"xxa"
),
(
rtl
::
OUString
(
"xaa"
).
replaceAll
(
"xa"
,
"xx"
)));
CPPUNIT_ASSERT_EQUAL
(
rtl
::
OUString
(),
rtl
::
OUString
(
"xa"
).
replaceAll
(
"xa"
,
""
));
}
}
...
...
sal/rtl/ustring.cxx
Dosyayı görüntüle @
f7a7a9dd
...
...
@@ -1154,8 +1154,8 @@ void rtl_uString_newReplaceFirstAsciiL(
}
sal_Int32
n
=
str
->
length
-
fromLength
+
to
->
length
;
rtl_uString_acquire
(
str
);
// in case *newStr == str
rtl_uString_new_WithLength
(
newStr
,
n
);
if
(
n
!=
0
)
{
rtl_uString_new_WithLength
(
newStr
,
n
);
(
*
newStr
)
->
length
=
n
;
assert
(
i
>=
0
&&
i
<
str
->
length
);
memcpy
(
...
...
@@ -1196,8 +1196,8 @@ void rtl_uString_newReplaceFirstToAsciiL(
}
sal_Int32
n
=
str
->
length
-
from
->
length
+
toLength
;
rtl_uString_acquire
(
str
);
// in case *newStr == str
rtl_uString_new_WithLength
(
newStr
,
n
);
if
(
n
!=
0
)
{
rtl_uString_new_WithLength
(
newStr
,
n
);
(
*
newStr
)
->
length
=
n
;
assert
(
i
>=
0
&&
i
<
str
->
length
);
memcpy
(
...
...
@@ -1240,8 +1240,8 @@ void rtl_uString_newReplaceFirstAsciiLAsciiL(
}
sal_Int32
n
=
str
->
length
-
fromLength
+
toLength
;
rtl_uString_acquire
(
str
);
// in case *newStr == str
rtl_uString_new_WithLength
(
newStr
,
n
);
if
(
n
!=
0
)
{
rtl_uString_new_WithLength
(
newStr
,
n
);
(
*
newStr
)
->
length
=
n
;
assert
(
i
>=
0
&&
i
<
str
->
length
);
memcpy
(
...
...
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