mirror of
https://github.com/status-im/react-native.git
synced 2025-02-24 23:28:12 +00:00
Terminate startup code with a null byte, too (indexed file random access bundles)
Reviewed By: javache Differential Revision: D3310269 fbshipit-source-id: d0fbf5afd6baecf50ec568e8694a15c96e6a9c85
This commit is contained in:
parent
f71329946c
commit
9092198b1b
@ -67,13 +67,14 @@ function writeBuffers(stream, buffers) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nullTerminatedBuffer(contents, encoding) {
|
||||||
|
return Buffer.concat([Buffer(contents, encoding), nullByteBuffer]);
|
||||||
|
}
|
||||||
|
|
||||||
function moduleToBuffer(id, code, encoding) {
|
function moduleToBuffer(id, code, encoding) {
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
buffer: Buffer.concat([
|
buffer: nullTerminatedBuffer(code, encoding),
|
||||||
Buffer(code, encoding),
|
|
||||||
nullByteBuffer // create \0-terminated strings
|
|
||||||
])
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ function buildTableAndContents(startupCode, modules, encoding) {
|
|||||||
// - code blob char[] null-terminated code strings, starting with
|
// - code blob char[] null-terminated code strings, starting with
|
||||||
// the startup code
|
// the startup code
|
||||||
|
|
||||||
const startupCodeBuffer = Buffer(startupCode, encoding);
|
const startupCodeBuffer = nullTerminatedBuffer(startupCode, encoding);
|
||||||
const moduleBuffers = buildModuleBuffers(modules, encoding);
|
const moduleBuffers = buildModuleBuffers(modules, encoding);
|
||||||
const table = buildModuleTable(startupCodeBuffer, moduleBuffers);
|
const table = buildModuleTable(startupCodeBuffer, moduleBuffers);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user