Skip to content
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
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -486,3 +486,4 @@ a license to everyone to use it as detailed in LICENSE.)
* popomen <[email protected]>
* Sebastián Gurin (cancerberoSgx) <[email protected]>
* Benedikt Meurer <[email protected]> (copyright owned by Google, LLC)
* Jiulong Wang <[email protected]>
4 changes: 2 additions & 2 deletions src/embind/embind.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ var LibraryEmbind = {
// Looping here to support possible embedded '0' bytes
for (var i = 0; i <= length; ++i) {
var currentBytePtr = value + 4 + i;
if (HEAPU8[currentBytePtr] == 0 || i == length) {
if (i == length || HEAPU8[currentBytePtr] == 0) {
var maxRead = currentBytePtr - decodeStartPtr;
var stringSegment = UTF8ToString(decodeStartPtr, maxRead);
if (str === undefined) {
Expand Down Expand Up @@ -748,7 +748,7 @@ var LibraryEmbind = {
// Looping here to support possible embedded '0' bytes
for (var i = 0; i <= length; ++i) {
var currentBytePtr = value + 4 + i * charSize;
if (HEAP[currentBytePtr >> shift] == 0 || i == length) {
if (i == length || HEAP[currentBytePtr >> shift] == 0) {
var maxReadBytes = currentBytePtr - decodeStartPtr;
var stringSegment = decodeString(decodeStartPtr, maxReadBytes);
if (str === undefined) {
Expand Down