Skip to content

Set the binary bit on files we need to open in binary mode #303

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

Merged
merged 1 commit into from
Mar 31, 2016

Conversation

kripken
Copy link
Member

@kripken kripken commented Mar 31, 2016

This might fix binaryen on windows, which seems broken on emscripten's windows bot

@kripken
Copy link
Member Author

kripken commented Mar 31, 2016

cc @juj

@@ -29,15 +29,15 @@

namespace wasm {
template <typename T>
T read_file(const std::string &filename, bool debug);
T read_file(const std::string &filename, bool binary, bool debug);
Copy link
Member

Choose a reason for hiding this comment

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

Could you use an enum instead of a bool?

Copy link
Member Author

Choose a reason for hiding this comment

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

It would have just 2 values though, and seem inconsistent with the next param after it, which is a bool?

Copy link
Member

Choose a reason for hiding this comment

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

It's more about expressing intent: what does binary=false mean? Not a big issue, I just find it easier to document it that way.

Copy link
Member

Choose a reason for hiding this comment

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

It's a pretty common technique in C/C++ API design. It makes it much easier to understand the call site:

read_file("foo.bar", false, true); // what does this mean?

vs.

read_file("foo.bar", kAsText, kDebug);

@kripken
Copy link
Member Author

kripken commented Mar 31, 2016

Fair points. Ok, how about if we merge this (should unbreak a bot) and then fix both args as a followup?

@jfbastien jfbastien merged commit d0ae4a2 into master Mar 31, 2016
@jfbastien jfbastien deleted the binary-files-for-windows branch March 31, 2016 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants