Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSharp: fix LDKStr array decoding #151

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion c_sharp/src/org/ldk/structs/Bolt11Invoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public string[] fallback_addresses() {
int ret_conv_8_len = InternalUtils.getArrayLength(ret);
string[] ret_conv_8_arr = new string[ret_conv_8_len];
for (int i = 0; i < ret_conv_8_len; i++) {
long ret_conv_8 = InternalUtils.getU32ArrayElem(ret, i);
long ret_conv_8 = InternalUtils.getU64ArrayElem(ret, i);
string ret_conv_8_conv = InternalUtils.decodeString(ret_conv_8);
ret_conv_8_arr[i] = ret_conv_8_conv;
}
Expand Down
2 changes: 1 addition & 1 deletion c_sharp/src/org/ldk/structs/Result_CVec_StrZIOErrorZ.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal Result_CVec_StrZIOErrorZ_OK(object _dummy, long ptr) : base(_dummy, ptr
int res_conv_8_len = InternalUtils.getArrayLength(res);
string[] res_conv_8_arr = new string[res_conv_8_len];
for (int i = 0; i < res_conv_8_len; i++) {
long res_conv_8 = InternalUtils.getU32ArrayElem(res, i);
long res_conv_8 = InternalUtils.getU64ArrayElem(res, i);
string res_conv_8_conv = InternalUtils.decodeString(res_conv_8);
res_conv_8_arr[i] = res_conv_8_conv;
}
Expand Down
2 changes: 1 addition & 1 deletion csharp_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def get_java_arr_elem(self, elem_ty, arr_name, idx):
elif elem_ty.rust_obj == "LDKU5":
return "InternalUtils.getU8ArrayElem(" + arr_name + ", " + idx + ")"
elif elem_ty.rust_obj == "LDKStr":
return "InternalUtils.getU32ArrayElem(" + arr_name + ", " + idx + ")"
return "InternalUtils.getU64ArrayElem(" + arr_name + ", " + idx + ")"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: mind just including it in the first if (or breaking the pointer array ones into a second if)? Its really a pointer array and should be grouped with the if for pointer arrays (endswith("Array") || c_ty == "uintptr_t").

else:
assert False

Expand Down
Loading