-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KMP] Fix issue: memory leak found in Base58.decode in iOS (#4031)
* Fix kmp issue: memory leak found in Base58.decode in iOS * Remove unused functions * Fix failed test cases * Revert "Fix failed test cases" This reverts commit 57eee39. * Revert val -> value argument name refactoring * Output better indentation * Revert changes in TWEthereumAbiFunction.h * Fix inconsistent naming --------- Co-authored-by: satoshiotomakan <127754187+satoshiotomakan@users.noreply.github.com>
- Loading branch information
1 parent
00a8744
commit 2ed7098
Showing
9 changed files
with
149 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<% | ||
method = locals[:method] | ||
more_index = locals[:more_index] || 0 | ||
|
||
method.parameters.each do |param| -%> | ||
<% if param.type.name == :data -%> | ||
<% if param.type.is_nullable -%> | ||
<%= ' ' * more_index %> val <%= KotlinHelper.fix_name(param.name) %>Data = if (<%= KotlinHelper.fix_name(param.name) %> == null) { | ||
<%= ' ' * more_index %> null | ||
<%= ' ' * more_index %> } else { | ||
<%= ' ' * more_index %> TWDataCreateWithBytes(<%= KotlinHelper.fix_name(param.name) %>.toUByteArray().toCValues(), <%= KotlinHelper.fix_name(param.name) %>.size.toULong()) | ||
<%= ' ' * more_index %> } | ||
<% else -%> | ||
<%= ' ' * more_index %> val <%= KotlinHelper.fix_name(param.name) %>Data = TWDataCreateWithBytes(<%= KotlinHelper.fix_name(param.name) %>.toUByteArray().toCValues(), <%= KotlinHelper.fix_name(param.name) %>.size.toULong()) | ||
<% end -%> | ||
<% elsif param.type.name == :string -%> | ||
<% if param.type.is_nullable -%> | ||
<%= ' ' * more_index %> val <%= KotlinHelper.fix_name(param.name) %>String = if (<%= KotlinHelper.fix_name(param.name) %> == null) { | ||
<%= ' ' * more_index %> null | ||
<%= ' ' * more_index %> } else { | ||
<%= ' ' * more_index %> TWStringCreateWithUTF8Bytes(<%= KotlinHelper.fix_name(param.name) %>) | ||
<%= ' ' * more_index %> } | ||
<% else -%> | ||
<%= ' ' * more_index %> val <%= KotlinHelper.fix_name(param.name) %>String = TWStringCreateWithUTF8Bytes(<%= KotlinHelper.fix_name(param.name) %>) | ||
<% end -%> | ||
<% end -%> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<% | ||
method = locals[:method] | ||
more_index = locals[:more_index] || 0 | ||
|
||
method.parameters.each do |param| -%> | ||
<% if param.type.name == :data -%> | ||
<% if param.type.is_nullable -%> | ||
<%= ' ' * more_index %> if (<%= KotlinHelper.fix_name(param.name) %>Data != null) { | ||
<%= ' ' * more_index %> TWDataDelete(<%= KotlinHelper.fix_name(param.name) %>Data) | ||
<%= ' ' * more_index %> } | ||
<% else -%> | ||
<%= ' ' * more_index %> TWDataDelete(<%= KotlinHelper.fix_name(param.name) %>Data) | ||
<% end -%> | ||
<% elsif param.type.name == :string -%> | ||
<% if param.type.is_nullable -%> | ||
<%= ' ' * more_index %> if (<%= KotlinHelper.fix_name(param.name) %>String != null) { | ||
<%= ' ' * more_index %> TWStringDelete(<%= KotlinHelper.fix_name(param.name) %>String) | ||
<%= ' ' * more_index %> } | ||
<% else -%> | ||
<%= ' ' * more_index %> TWStringDelete(<%= KotlinHelper.fix_name(param.name) %>String) | ||
<% end -%> | ||
<% end -%> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters