-
Notifications
You must be signed in to change notification settings - Fork 35
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
Move read bytes utilities to Encoding #558
Conversation
byte[] bytes = new byte[length]; | ||
try { | ||
readBytes(buffer, bytes); | ||
} catch (BufferUnderflowException e) { |
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.
This catch shouldn't be needed as readBytes
already checks the length.
Or we could replace the checks in those read
methods with handling for BufferUnderflowException
.
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.
removed
return readName(buffer, true); | ||
} | ||
|
||
public static String readName(ByteBuffer buffer, boolean checkMalformed) { |
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.
Nit: copy Javadoc from above or make it @see
the above
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.
done
|
||
/** | ||
* Read a symbol name from the buffer as UTF-8 String. | ||
* See <a href="https://www.w3.org/TR/wasm-core-1/#names%E2%91%A0">2.2.4. Names</a> of the WebAssembly Core Specification. |
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.
The link is broken: the extra %E2%91%A0
at the end of the URL shouldn't be there.
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.
good catch, fixed!
@@ -11,6 +13,126 @@ public final class Encoding { | |||
|
|||
private Encoding() {} | |||
|
|||
static int readInt(ByteBuffer buffer) { |
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.
Do these need to be public? Could they be needed for parsing custom sections?
This is just a question to consider. It's fine to leave them private for now.
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.
In the current status I think that there are quite a few changes necessary to offer a proper, usable and generic API to parse custom sections ...
I would not try to predict the future, and welcome effort in this direction when someone needs it.
Opening visibility is not going to be a breaking change.
Fix #521