Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
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
liuqiang
skiko
Commits
549de5ab
Unverified
Commit
549de5ab
authored
Nov 01, 2021
by
Aleksandr Veselov
Committed by
GitHub
Nov 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add zero terminator to native interop strings (#333)
parent
1a0c1c53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
Native.native.kt
...ativeMain/kotlin/org/jetbrains/skia/impl/Native.native.kt
+3
-1
No files found.
skiko/src/nativeMain/kotlin/org/jetbrains/skia/impl/Native.native.kt
View file @
549de5ab
...
...
@@ -58,7 +58,9 @@ actual class InteropScope actual constructor() {
actual
fun
toInterop
(
string
:
String
?):
InteropPointer
{
return
if
(
string
!=
null
)
{
// encodeToByteArray encodes to utf8
val
pinned
=
string
.
encodeToByteArray
().
pin
()
val
utf8
=
string
.
encodeToByteArray
()
// TODO Remove array copy, use `skString(data, length)` instead of `skString(data)`
val
pinned
=
utf8
.
copyOf
(
utf8
.
size
+
1
).
pin
()
elements
.
add
(
pinned
)
val
result
=
pinned
.
addressOf
(
0
).
rawValue
result
...
...
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