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
95b40155
Kaydet (Commit)
95b40155
authored
Şub 27, 2014
tarafından
David Tardon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
do not crash if allocation failed
Change-Id: I2fbc259de52a3c7f2c8c33027d74bb857d44b437
üst
89ca2fd7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
19 deletions
+27
-19
stream.cxx
tools/source/stream/stream.cxx
+27
-19
No files found.
tools/source/stream/stream.cxx
Dosyayı görüntüle @
95b40155
...
...
@@ -2056,14 +2056,18 @@ OString read_uInt8s_ToOString(SvStream& rStrm, sal_Size nLen)
//alloc a (ref-count 1) rtl_String of the desired length.
//rtl_String's buffer is uninitialized, except for null termination
pStr
=
rtl_string_alloc
(
sal
::
static_int_cast
<
sal_Int32
>
(
nLen
));
sal_Size
nWasRead
=
rStrm
.
Read
(
pStr
->
buffer
,
nLen
);
if
(
nWasRead
!=
nLen
)
SAL_WARN_IF
(
!
pStr
,
"tools"
,
"allocation failed"
);
if
(
pStr
)
{
//on (typically unlikely) short read set length to what we could
//read, and null terminate. Excess buffer capacity remains of
//course, could create a (true) replacement OString if it matters.
pStr
->
length
=
sal
::
static_int_cast
<
sal_Int32
>
(
nWasRead
);
pStr
->
buffer
[
pStr
->
length
]
=
0
;
sal_Size
nWasRead
=
rStrm
.
Read
(
pStr
->
buffer
,
nLen
);
if
(
nWasRead
!=
nLen
)
{
//on (typically unlikely) short read set length to what we could
//read, and null terminate. Excess buffer capacity remains of
//course, could create a (true) replacement OString if it matters.
pStr
->
length
=
sal
::
static_int_cast
<
sal_Int32
>
(
nWasRead
);
pStr
->
buffer
[
pStr
->
length
]
=
0
;
}
}
}
...
...
@@ -2081,19 +2085,23 @@ OUString read_uInt16s_ToOUString(SvStream& rStrm, sal_Size nLen)
//alloc a (ref-count 1) rtl_uString of the desired length.
//rtl_String's buffer is uninitialized, except for null termination
pStr
=
rtl_uString_alloc
(
sal
::
static_int_cast
<
sal_Int32
>
(
nLen
));
sal_Size
nWasRead
=
rStrm
.
Read
(
pStr
->
buffer
,
nLen
*
2
)
/
2
;
if
(
nWasRead
!=
nLen
)
{
//on (typically unlikely) short read set length to what we could
//read, and null terminate. Excess buffer capacity remains of
//course, could create a (true) replacement OUString if it matters.
pStr
->
length
=
sal
::
static_int_cast
<
sal_Int32
>
(
nWasRead
);
pStr
->
buffer
[
pStr
->
length
]
=
0
;
}
if
(
rStrm
.
IsEndianSwap
())
SAL_WARN_IF
(
!
pStr
,
"tools"
,
"allocation failed"
);
if
(
pStr
)
{
for
(
sal_Int32
i
=
0
;
i
<
pStr
->
length
;
++
i
)
pStr
->
buffer
[
i
]
=
OSL_SWAPWORD
(
pStr
->
buffer
[
i
]);
sal_Size
nWasRead
=
rStrm
.
Read
(
pStr
->
buffer
,
nLen
*
2
)
/
2
;
if
(
nWasRead
!=
nLen
)
{
//on (typically unlikely) short read set length to what we could
//read, and null terminate. Excess buffer capacity remains of
//course, could create a (true) replacement OUString if it matters.
pStr
->
length
=
sal
::
static_int_cast
<
sal_Int32
>
(
nWasRead
);
pStr
->
buffer
[
pStr
->
length
]
=
0
;
}
if
(
rStrm
.
IsEndianSwap
())
{
for
(
sal_Int32
i
=
0
;
i
<
pStr
->
length
;
++
i
)
pStr
->
buffer
[
i
]
=
OSL_SWAPWORD
(
pStr
->
buffer
[
i
]);
}
}
}
...
...
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