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
013a2e13
Commit
013a2e13
authored
Aug 31, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor code changes
parent
fbaf2bde
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
AXML.kt
app/src/main/java/com/topjohnwu/magisk/core/utils/AXML.kt
+4
-4
No files found.
app/src/main/java/com/topjohnwu/magisk/core/utils/AXML.kt
View file @
013a2e13
...
@@ -81,6 +81,7 @@ class AXML(b: ByteArray) {
...
@@ -81,6 +81,7 @@ class AXML(b: ByteArray) {
val
baos
=
RawByteStream
()
val
baos
=
RawByteStream
()
baos
.
write
(
bytes
,
0
,
dataOff
)
baos
.
write
(
bytes
,
0
,
dataOff
)
// Write string data
val
strList
=
IntArray
(
count
)
val
strList
=
IntArray
(
count
)
for
(
i
in
0
until
count
)
{
for
(
i
in
0
until
count
)
{
strList
[
i
]
=
baos
.
size
()
-
dataOff
strList
[
i
]
=
baos
.
size
()
-
dataOff
...
@@ -102,9 +103,8 @@ class AXML(b: ByteArray) {
...
@@ -102,9 +103,8 @@ class AXML(b: ByteArray) {
newBuffer
.
putInt
(
start
+
CHUNK_SIZE_OFF
,
size
+
sizeDiff
)
newBuffer
.
putInt
(
start
+
CHUNK_SIZE_OFF
,
size
+
sizeDiff
)
// Patch index table
// Patch index table
newBuffer
.
position
(
start
+
STRING_INDICES_OFF
)
newBuffer
.
position
(
start
+
STRING_INDICES_OFF
)
val
newStrList
=
newBuffer
.
asIntBuffer
()
val
newIntBuf
=
newBuffer
.
asIntBuffer
()
for
(
idx
in
strList
)
strList
.
forEach
{
newIntBuf
.
put
(
it
)
}
newStrList
.
put
(
idx
)
// Write the rest of the chunks
// Write the rest of the chunks
val
nextOff
=
start
+
size
val
nextOff
=
start
+
size
...
@@ -121,7 +121,7 @@ class AXML(b: ByteArray) {
...
@@ -121,7 +121,7 @@ class AXML(b: ByteArray) {
}
}
private
class
RawByteStream
:
ByteArrayOutputStream
()
{
private
class
RawByteStream
:
ByteArrayOutputStream
()
{
val
buf
get
()
=
buf
val
buf
:
ByteArray
get
()
=
buf
fun
align
(
alignment
:
Int
=
4
)
{
fun
align
(
alignment
:
Int
=
4
)
{
val
newCount
=
(
count
+
alignment
-
1
)
/
alignment
*
alignment
val
newCount
=
(
count
+
alignment
-
1
)
/
alignment
*
alignment
...
...
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