Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
43889584
Commit
43889584
authored
Feb 21, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
archive/bzip2: move bz2_fillbuffer into struct Bzip2InputStream
parent
82b8f4f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
13 deletions
+11
-13
Bzip2ArchivePlugin.cxx
src/archive/plugins/Bzip2ArchivePlugin.cxx
+11
-13
No files found.
src/archive/plugins/Bzip2ArchivePlugin.cxx
View file @
43889584
...
...
@@ -103,6 +103,9 @@ struct Bzip2InputStream final : public InputStream {
/* virtual methods from InputStream */
bool
IsEOF
()
override
;
size_t
Read
(
void
*
ptr
,
size_t
size
,
Error
&
error
)
override
;
private
:
bool
FillBuffer
(
Error
&
error
);
};
static
constexpr
Domain
bz2_domain
(
"bz2"
);
...
...
@@ -175,24 +178,19 @@ Bzip2ArchiveFile::OpenStream(const char *path,
return
bis
;
}
static
bool
bz2_fillbuffer
(
Bzip2InputStream
*
bis
,
Error
&
error
)
inline
bool
Bzip2InputStream
::
FillBuffer
(
Error
&
error
)
{
size_t
count
;
bz_stream
*
bzstream
;
bzstream
=
&
bis
->
bzstream
;
if
(
bzstream
->
avail_in
>
0
)
if
(
bzstream
.
avail_in
>
0
)
return
true
;
count
=
bis
->
archive
->
istream
->
Read
(
bis
->
buffer
,
sizeof
(
bis
->
buffer
),
error
);
size_t
count
=
archive
->
istream
->
Read
(
buffer
,
sizeof
(
buffer
),
error
);
if
(
count
==
0
)
return
false
;
bzstream
->
next_in
=
bis
->
buffer
;
bzstream
->
avail_in
=
count
;
bzstream
.
next_in
=
buffer
;
bzstream
.
avail_in
=
count
;
return
true
;
}
...
...
@@ -209,7 +207,7 @@ Bzip2InputStream::Read(void *ptr, size_t length, Error &error)
bzstream
.
avail_out
=
length
;
do
{
if
(
!
bz2_fillbuffer
(
this
,
error
))
if
(
!
FillBuffer
(
error
))
return
0
;
bz_result
=
BZ2_bzDecompress
(
&
bzstream
);
...
...
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