-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix the case when file size is greater than 2G (#323)
- Loading branch information
1 parent
eb1ecc8
commit f81cacd
Showing
1 changed file
with
12 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
/* global mergeInto, LibraryManager, Module, UTF32ToString, UTF8ToString */ | ||
|
||
|
||
mergeInto(LibraryManager.library, { | ||
jsOpen: function (filename) { | ||
const handle = Module.extractor.open(UTF32ToString(filename)); | ||
Module.setTempRet0(handle / 0x100000000 | 0); | ||
Module.setTempRet0((handle / 0x100000000) | 0); | ||
return handle % 0x100000000; | ||
}, | ||
jsCreate: function (filename) { | ||
const handle = Module.extractor.create(UTF32ToString(filename)); | ||
Module.setTempRet0(handle / 0x100000000 | 0); | ||
Module.setTempRet0((handle / 0x100000000) | 0); | ||
return handle % 0x100000000; | ||
}, | ||
jsClose: function (handleLo, handleHi) { | ||
return Module.extractor.close(handleLo + handleHi * 0x100000000); | ||
return Module.extractor.close((handleLo >>> 0) + handleHi * 0x100000000); | ||
}, | ||
jsRead: function (handleLo, handleHi, buf, size) { | ||
return Module.extractor.read(handleLo + handleHi * 0x100000000, buf, size); | ||
return Module.extractor.read((handleLo >>> 0) + handleHi * 0x100000000, buf, size); | ||
}, | ||
jsWrite: function (handleLo, handleHi, buf, size) { | ||
return Module.extractor.write(handleLo + handleHi * 0x100000000, buf, size); | ||
return Module.extractor.write((handleLo >>> 0) + handleHi * 0x100000000, buf, size); | ||
}, | ||
jsTell: function (handleLo, handleHi) { | ||
const pos = Module.extractor.tell(handleLo + handleHi * 0x100000000); | ||
Module.setTempRet0(pos / 0x100000000 | 0); | ||
const pos = Module.extractor.tell((handleLo >>> 0) + handleHi * 0x100000000); | ||
Module.setTempRet0((pos / 0x100000000) | 0); | ||
return pos % 0x100000000; | ||
}, | ||
jsSeek: function (handleLo, handleHi, offsetLo, offsetHi, method) { | ||
return Module.extractor.seek(handleLo + handleHi * 0x100000000, offsetLo + offsetHi * 0x100000000, UTF8ToString(method)); | ||
return Module.extractor.seek( | ||
(handleLo >>> 0) + handleHi * 0x100000000, | ||
(offsetLo >>> 0) + offsetHi * 0x100000000, | ||
UTF8ToString(method), | ||
); | ||
}, | ||
}); |