Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
65a79610
Commit
65a79610
authored
Nov 24, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash and warnings
parent
24984ea4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
compress.cpp
native/jni/magiskboot/compress.cpp
+10
-10
No files found.
native/jni/magiskboot/compress.cpp
View file @
65a79610
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
using
namespace
std
;
using
namespace
std
;
#define bwrite base->write
#define bwrite
this->
base->write
constexpr
size_t
CHUNK
=
0x40000
;
constexpr
size_t
CHUNK
=
0x40000
;
constexpr
size_t
LZ4_UNCOMPRESSED
=
0x800000
;
constexpr
size_t
LZ4_UNCOMPRESSED
=
0x800000
;
...
@@ -31,11 +31,11 @@ class out_stream : public filter_stream {
...
@@ -31,11 +31,11 @@ class out_stream : public filter_stream {
class
gz_strm
:
public
out_stream
{
class
gz_strm
:
public
out_stream
{
public
:
public
:
bool
write
(
const
void
*
buf
,
size_t
len
)
override
{
bool
write
(
const
void
*
buf
,
size_t
len
)
override
{
return
len
==
0
||
write
(
buf
,
len
,
Z_NO_FLUSH
);
return
len
==
0
||
do_
write
(
buf
,
len
,
Z_NO_FLUSH
);
}
}
~
gz_strm
()
override
{
~
gz_strm
()
override
{
write
(
nullptr
,
0
,
Z_FINISH
);
do_
write
(
nullptr
,
0
,
Z_FINISH
);
switch
(
mode
)
{
switch
(
mode
)
{
case
DECODE
:
case
DECODE
:
inflateEnd
(
&
strm
);
inflateEnd
(
&
strm
);
...
@@ -68,7 +68,7 @@ private:
...
@@ -68,7 +68,7 @@ private:
z_stream
strm
;
z_stream
strm
;
uint8_t
outbuf
[
CHUNK
];
uint8_t
outbuf
[
CHUNK
];
bool
write
(
const
void
*
buf
,
size_t
len
,
int
flush
)
{
bool
do_
write
(
const
void
*
buf
,
size_t
len
,
int
flush
)
{
strm
.
next_in
=
(
Bytef
*
)
buf
;
strm
.
next_in
=
(
Bytef
*
)
buf
;
strm
.
avail_in
=
len
;
strm
.
avail_in
=
len
;
do
{
do
{
...
@@ -181,7 +181,7 @@ private:
...
@@ -181,7 +181,7 @@ private:
class
bz_strm
:
public
out_stream
{
class
bz_strm
:
public
out_stream
{
public
:
public
:
bool
write
(
const
void
*
buf
,
size_t
len
)
override
{
bool
write
(
const
void
*
buf
,
size_t
len
)
override
{
return
len
==
0
||
write
(
buf
,
len
,
BZ_RUN
);
return
len
==
0
||
do_
write
(
buf
,
len
,
BZ_RUN
);
}
}
~
bz_strm
()
override
{
~
bz_strm
()
override
{
...
@@ -190,7 +190,7 @@ public:
...
@@ -190,7 +190,7 @@ public:
BZ2_bzDecompressEnd
(
&
strm
);
BZ2_bzDecompressEnd
(
&
strm
);
break
;
break
;
case
ENCODE
:
case
ENCODE
:
write
(
nullptr
,
0
,
BZ_FINISH
);
do_
write
(
nullptr
,
0
,
BZ_FINISH
);
BZ2_bzCompressEnd
(
&
strm
);
BZ2_bzCompressEnd
(
&
strm
);
break
;
break
;
}
}
...
@@ -218,7 +218,7 @@ private:
...
@@ -218,7 +218,7 @@ private:
bz_stream
strm
;
bz_stream
strm
;
char
outbuf
[
CHUNK
];
char
outbuf
[
CHUNK
];
bool
write
(
const
void
*
buf
,
size_t
len
,
int
flush
)
{
bool
do_
write
(
const
void
*
buf
,
size_t
len
,
int
flush
)
{
strm
.
next_in
=
(
char
*
)
buf
;
strm
.
next_in
=
(
char
*
)
buf
;
strm
.
avail_in
=
len
;
strm
.
avail_in
=
len
;
do
{
do
{
...
@@ -257,11 +257,11 @@ public:
...
@@ -257,11 +257,11 @@ public:
class
lzma_strm
:
public
out_stream
{
class
lzma_strm
:
public
out_stream
{
public
:
public
:
bool
write
(
const
void
*
buf
,
size_t
len
)
override
{
bool
write
(
const
void
*
buf
,
size_t
len
)
override
{
return
len
==
0
||
write
(
buf
,
len
,
LZMA_RUN
);
return
len
==
0
||
do_
write
(
buf
,
len
,
LZMA_RUN
);
}
}
~
lzma_strm
()
override
{
~
lzma_strm
()
override
{
write
(
nullptr
,
0
,
LZMA_FINISH
);
do_
write
(
nullptr
,
0
,
LZMA_FINISH
);
lzma_end
(
&
strm
);
lzma_end
(
&
strm
);
}
}
...
@@ -304,7 +304,7 @@ private:
...
@@ -304,7 +304,7 @@ private:
lzma_stream
strm
;
lzma_stream
strm
;
uint8_t
outbuf
[
CHUNK
];
uint8_t
outbuf
[
CHUNK
];
bool
write
(
const
void
*
buf
,
size_t
len
,
lzma_action
flush
)
{
bool
do_
write
(
const
void
*
buf
,
size_t
len
,
lzma_action
flush
)
{
strm
.
next_in
=
(
uint8_t
*
)
buf
;
strm
.
next_in
=
(
uint8_t
*
)
buf
;
strm
.
avail_in
=
len
;
strm
.
avail_in
=
len
;
do
{
do
{
...
...
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