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
d67cd210
Kaydet (Commit)
d67cd210
authored
Eki 14, 2013
tarafından
Mathieu Parent
Kaydeden (comit)
Michael Meeks
Eki 14, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#56007 - Read more bytes on Zip read (for thumbnails)
Change-Id: Ia8c6caa44ed8019a8139beb5a855f0f28805544d
üst
20528cb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
26 deletions
+38
-26
zipfile.cxx
shell/source/win32/zipfile/zipfile.cxx
+38
-26
No files found.
shell/source/win32/zipfile/zipfile.cxx
Dosyayı görüntüle @
d67cd210
...
@@ -118,18 +118,42 @@ static unsigned char readByte(StreamInterface *stream)
...
@@ -118,18 +118,42 @@ static unsigned char readByte(StreamInterface *stream)
static
unsigned
short
readShort
(
StreamInterface
*
stream
)
static
unsigned
short
readShort
(
StreamInterface
*
stream
)
{
{
unsigned
short
p0
=
(
unsigned
short
)
readByte
(
stream
);
if
(
!
stream
||
stream
->
stell
()
==
-
1
)
unsigned
short
p1
=
(
unsigned
short
)
readByte
(
stream
);
throw
IOException
(
-
1
);
return
(
unsigned
short
)(
p0
|
(
p1
<<
8
));
unsigned
short
tmpBuf
;
unsigned
long
numBytesRead
=
stream
->
sread
(
reinterpret_cast
<
unsigned
char
*>
(
&
tmpBuf
),
2
);
if
(
numBytesRead
!=
2
)
throw
IOException
(
-
1
);
return
tmpBuf
;
}
}
static
unsigned
readInt
(
StreamInterface
*
stream
)
static
unsigned
readInt
(
StreamInterface
*
stream
)
{
{
unsigned
p0
=
(
unsigned
)
readByte
(
stream
);
if
(
!
stream
||
stream
->
stell
()
==
-
1
)
unsigned
p1
=
(
unsigned
)
readByte
(
stream
);
throw
IOException
(
-
1
);
unsigned
p2
=
(
unsigned
)
readByte
(
stream
);
unsigned
tmpBuf
;
unsigned
p3
=
(
unsigned
)
readByte
(
stream
);
unsigned
long
numBytesRead
=
stream
->
sread
(
return
(
unsigned
)(
p0
|
(
p1
<<
8
)
|
(
p2
<<
16
)
|
(
p3
<<
24
));
reinterpret_cast
<
unsigned
char
*>
(
&
tmpBuf
),
4
);
if
(
numBytesRead
!=
4
)
throw
IOException
(
-
1
);
return
tmpBuf
;
}
static
std
::
string
readString
(
StreamInterface
*
stream
,
unsigned
long
size
)
{
if
(
!
stream
||
stream
->
stell
()
==
-
1
)
throw
IOException
(
-
1
);
unsigned
char
*
tmp
=
new
unsigned
char
[
size
];
if
(
!
tmp
)
throw
IOException
(
-
1
);
unsigned
long
numBytesRead
=
stream
->
sread
(
tmp
,
size
);
if
(
numBytesRead
!=
size
)
throw
IOException
(
-
1
);
std
::
string
aStr
((
char
*
)
tmp
,
size
);
delete
[]
tmp
;
return
aStr
;
}
}
static
bool
readCentralDirectoryEnd
(
StreamInterface
*
stream
,
CentralDirectoryEnd
&
end
)
static
bool
readCentralDirectoryEnd
(
StreamInterface
*
stream
,
CentralDirectoryEnd
&
end
)
...
@@ -147,9 +171,7 @@ static bool readCentralDirectoryEnd(StreamInterface *stream, CentralDirectoryEnd
...
@@ -147,9 +171,7 @@ static bool readCentralDirectoryEnd(StreamInterface *stream, CentralDirectoryEnd
end
.
cdir_size
=
readInt
(
stream
);
end
.
cdir_size
=
readInt
(
stream
);
end
.
cdir_offset
=
readInt
(
stream
);
end
.
cdir_offset
=
readInt
(
stream
);
end
.
comment_size
=
readShort
(
stream
);
end
.
comment_size
=
readShort
(
stream
);
end
.
comment
.
clear
();
end
.
comment
.
assign
(
readString
(
stream
,
end
.
comment_size
));
for
(
unsigned
short
i
=
0
;
i
<
end
.
comment_size
;
i
++
)
end
.
comment
.
append
(
1
,(
char
)
readByte
(
stream
));
}
}
catch
(...)
catch
(...)
{
{
...
@@ -183,15 +205,9 @@ static bool readCentralDirectoryEntry(StreamInterface *stream, CentralDirectoryE
...
@@ -183,15 +205,9 @@ static bool readCentralDirectoryEntry(StreamInterface *stream, CentralDirectoryE
entry
.
external_attr
=
readInt
(
stream
);
entry
.
external_attr
=
readInt
(
stream
);
entry
.
offset
=
readInt
(
stream
);
entry
.
offset
=
readInt
(
stream
);
unsigned
short
i
=
0
;
unsigned
short
i
=
0
;
entry
.
filename
.
clear
();
entry
.
filename
.
assign
(
readString
(
stream
,
entry
.
filename_size
));
for
(
i
=
0
;
i
<
entry
.
filename_size
;
i
++
)
entry
.
extra_field
.
assign
(
readString
(
stream
,
entry
.
extra_field_size
));
entry
.
filename
.
append
(
1
,(
char
)
readByte
(
stream
));
entry
.
file_comment
.
assign
(
readString
(
stream
,
entry
.
file_comment_size
));
entry
.
extra_field
.
clear
();
for
(
i
=
0
;
i
<
entry
.
extra_field_size
;
i
++
)
entry
.
extra_field
.
append
(
1
,(
char
)
readByte
(
stream
));
entry
.
file_comment
.
clear
();
for
(
i
=
0
;
i
<
entry
.
file_comment_size
;
i
++
)
entry
.
file_comment
.
append
(
1
,(
char
)
readByte
(
stream
));
}
}
catch
(...)
catch
(...)
{
{
...
@@ -219,12 +235,8 @@ static bool readLocalFileHeader(StreamInterface *stream, LocalFileHeader &header
...
@@ -219,12 +235,8 @@ static bool readLocalFileHeader(StreamInterface *stream, LocalFileHeader &header
header
.
filename_size
=
readShort
(
stream
);
header
.
filename_size
=
readShort
(
stream
);
header
.
extra_field_size
=
readShort
(
stream
);
header
.
extra_field_size
=
readShort
(
stream
);
unsigned
short
i
=
0
;
unsigned
short
i
=
0
;
header
.
filename
.
clear
();
header
.
filename
.
assign
(
readString
(
stream
,
header
.
filename_size
));
for
(
i
=
0
;
i
<
header
.
filename_size
;
i
++
)
header
.
extra_field
.
assign
(
readString
(
stream
,
header
.
extra_field_size
));
header
.
filename
.
append
(
1
,(
char
)
readByte
(
stream
));
header
.
extra_field
.
clear
();
for
(
i
=
0
;
i
<
header
.
extra_field_size
;
i
++
)
header
.
extra_field
.
append
(
1
,(
char
)
readByte
(
stream
));
}
}
catch
(...)
catch
(...)
{
{
...
...
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