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
d3b5cf82
Commit
d3b5cf82
authored
Nov 21, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small adjustments
parent
d26d804c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
stream.h
native/jni/utils/include/stream.h
+2
-2
stream.cpp
native/jni/utils/stream.cpp
+6
-10
No files found.
native/jni/utils/include/stream.h
View file @
d3b5cf82
...
...
@@ -4,7 +4,7 @@
#include <stdio.h>
#include <memory>
#include <utils.h>
//
#include <utils.h>
class
stream
;
...
...
@@ -49,7 +49,7 @@ class seekable_stream : public stream {
protected
:
size_t
_pos
=
0
;
off_t
new
_pos
(
off_t
off
,
int
whence
);
off_t
seek
_pos
(
off_t
off
,
int
whence
);
virtual
size_t
end_pos
()
=
0
;
};
...
...
native/jni/utils/stream.cpp
View file @
d3b5cf82
#include <utils.h>
#include <logging.h>
#include <stream.h>
...
...
@@ -68,22 +69,17 @@ void filter_stream::set_base(FILE *f) {
fp
=
f
;
}
off_t
seekable_stream
::
new_pos
(
off_t
off
,
int
whence
)
{
off_t
new_pos
;
off_t
seekable_stream
::
seek_pos
(
off_t
off
,
int
whence
)
{
switch
(
whence
)
{
case
SEEK_CUR
:
new_pos
=
_pos
+
off
;
break
;
return
_pos
+
off
;
case
SEEK_END
:
new_pos
=
end_pos
()
+
off
;
break
;
return
end_pos
()
+
off
;
case
SEEK_SET
:
new_pos
=
off
;
break
;
return
off
;
default
:
return
-
1
;
}
return
new_pos
;
}
byte_stream
::
byte_stream
(
uint8_t
*&
buf
,
size_t
&
len
)
:
_buf
(
buf
),
_len
(
len
)
{
...
...
@@ -106,7 +102,7 @@ int byte_stream::write(const void *buf, size_t len) {
}
off_t
byte_stream
::
seek
(
off_t
off
,
int
whence
)
{
off_t
np
=
new
_pos
(
off
,
whence
);
off_t
np
=
seek
_pos
(
off
,
whence
);
if
(
np
<
0
)
return
-
1
;
resize
(
np
,
true
);
...
...
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