Skip to content

WASM: bytes in ReadResult #588

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 4 commits into from
Jul 14, 2023
Merged

WASM: bytes in ReadResult #588

merged 4 commits into from
Jul 14, 2023

Conversation

Sec-ant
Copy link
Contributor

@Sec-ant Sec-ant commented Jul 14, 2023

Safely return bytes as Uint8Array in ReadResult via emscripten::val::global

should fix the issue mentioned in #584 and 8a0c458

@Sec-ant Sec-ant changed the title wasm: bytes in ReadResult. wasm: bytes in ReadResult Jul 14, 2023
Sec-ant added 2 commits July 14, 2023 11:54
safely return bytes as `Uint8Array` in `ReadResult` via `emscripten::val::global`
@Sec-ant Sec-ant changed the title wasm: bytes in ReadResult WASM: bytes in ReadResult Jul 14, 2023
for (auto&& result : results) {
readResults.push_back({ToString(result.format()), result.text(), std::string(result.bytes().asString()),
ToString(result.error()), result.position(), result.symbologyIdentifier()});
ByteArray bytes = result.bytes();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very nice! I have one tiny improvement to suggest: this line makes a copy of result.bytes(), which is unnecessary. Either use result.bytes().data() below or change this line to const ByteArray& bytes = result.bytes(). I have not tested your changes myself, will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed now.

@axxel axxel merged commit f3387c3 into zxing-cpp:master Jul 14, 2023
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy