-
Notifications
You must be signed in to change notification settings - Fork 825
uint32_t instead of int64_t as return type for GetMemorySegmentByteOffset #2432
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
Conversation
…fset and minor fixes
tlively
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Just a few small readability nits on the test.
test/example/c-api-kitchen-sink.c
Outdated
| } | ||
|
|
||
| BinaryenAddGlobal(module, "a-global", BinaryenTypeInt32(), 0, makeInt32(module, 125)); | ||
| const int32_t expected_offsets[] = { 10, 125 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const int32_t expected_offsets[] = { 10, 125 }; | |
| const uint32_t expected_offsets[] = { 10, 125 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be more readable to group all the static data about the segments here at the top instead of mixing it in with binaryen API calls.
test/example/c-api-kitchen-sink.c
Outdated
| BinaryenSetMemory(module, 1, 256, "mem", segments, segmentPassive, segmentOffsets, segmentSizes, 2, 0); | ||
|
|
||
| for (i = 0; i < BinaryenGetNumMemorySegments(module) ; i++) { | ||
| char out[15] = {0}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| char out[15] = {0}; | |
| char out[15] = {}; |
test/example/c-api-kitchen-sink.c
Outdated
| assert(BinaryenGetMemorySegmentByteOffset(module, i) == (0==i?10:125)); | ||
| assert(BinaryenGetMemorySegmentByteOffset(module, i) == expected_offsets[i]); | ||
| assert(BinaryenGetMemorySegmentByteLength(module, i) == segmentSizes[i]); | ||
| BinaryenCopyMemorySegmentData(module, i, &out[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| BinaryenCopyMemorySegmentData(module, i, &out[0]); | |
| BinaryenCopyMemorySegmentData(module, i, out); |
test/example/c-api-kitchen-sink.c
Outdated
| else { | ||
| assert(0 == strcmp("segment data 2", &out[0])); | ||
| } | ||
| assert(0 == strcmp(segments[i], &out[0])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| assert(0 == strcmp(segments[i], &out[0])); | |
| assert(0 == strcmp(segments[i], out)); |
tlively
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thank you!
and minor test fixes