@socketsupply/ltp
Advanced tools
Comparing version 2.4.0 to 3.0.0
@@ -96,4 +96,5 @@ var LengthDelimited = require('./length-delimited') | ||
var terminal = end-1 | ||
if(buffer[terminal] != 0) | ||
if(buffer[terminal] != 0) { | ||
throw new Error('invalid string termination:' +buffer[terminal]+' (0x'+buffer[terminal].toString(16)+'), at:'+(terminal-start)) | ||
} | ||
var value = buffer.toString('utf8', start, terminal) | ||
@@ -100,0 +101,0 @@ string.decode.bytes = end - start |
{ | ||
"name": "@socketsupply/ltp", | ||
"version": "2.4.0", | ||
"version": "3.0.0", | ||
"description": "A schemaful parseless binary format, like a simpler version of captnproto. fast access to fields without allocating memory", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -64,3 +64,3 @@ var fs = require('fs') | ||
baz = start+O.encode.bytes | ||
ltp.codex.string_u8.encode('baz', memory, strlen(baz)+1, baz) | ||
ltp.codex.string_u8.encode('baz', memory, strlen(baz), baz) | ||
console.log(memory.slice(start, start+30)) | ||
@@ -167,4 +167,4 @@ | ||
*/ | ||
var _len = wasm.encode__basic_name(start, strlen(cstring)+1, cstring, free) | ||
console.log(_len, strlen(cstring)+1) | ||
var _len = wasm.encode__basic_name(start, strlen(cstring), cstring, free) | ||
// console.log(_len, strlen(cstring)) | ||
console.log(memory.slice(free, free+_len)) | ||
@@ -214,3 +214,3 @@ free += _len | ||
memcpy(cstring2, cstring, strlen(cstring)+1) | ||
memcpy(cstring2, cstring, strlen(cstring)) | ||
console.log('start-cstring2', decode_cstring(cstring2)) | ||
@@ -229,4 +229,4 @@ | ||
// console.log('decode__basic_name', wasm.encode__basic_name(start)) | ||
console.log('raw', memory.slice(start, free+10)) | ||
free += wasm.encode__basic_name(start, strlen(cstring)+1, cstring, free) | ||
t.equal(strlen(cstring), 5) | ||
free += wasm.encode__basic_name(start, strlen(cstring), cstring, free) | ||
t.equal(free, start+6+1+5+1, 'free pointer must be correct') | ||
@@ -262,6 +262,3 @@ console.log('raw', memory.slice(start, free+10)) | ||
t.equal(strlen(cstring2), string.length-1, "correct string length") | ||
console.log(strlen(cstring2)) | ||
//XXX encode string shouldn't copy the 0 from the string. it should copy the non-zero | ||
// chars and then add a zero at the end. | ||
var bytes = wasm.encode__simpler(start2, 100, 1000, strlen(cstring2)+1, cstring2) | ||
var bytes = wasm.encode__simpler(start2, 100, 1000, strlen(cstring2), cstring2) | ||
console.log(memory.slice(start2, start2+32)) | ||
@@ -284,3 +281,3 @@ console.log(bytes) | ||
memory.write(string, cstring2=start2, 'utf8') | ||
var bytes = wasm.encode__bigName(start, strlen(cstring2)+1, cstring2) | ||
var bytes = wasm.encode__bigName(start, strlen(cstring2), cstring2) | ||
console.log(memory.slice(start, start+32)) | ||
@@ -306,3 +303,3 @@ t.equal(wasm.encoding_length__bigName(strlen(cstring2)), bytes) | ||
b.copy(memory, fixed_64) | ||
var bytes = wasm.encode__fixedbuf(_start3, 4, cstring2, fixed_32, fixed_64) | ||
var bytes = wasm.encode__fixedbuf(_start3, 3, cstring2, fixed_32, fixed_64) | ||
t.equal(bytes, 2+4+32+64) | ||
@@ -325,3 +322,3 @@ t.equal(wasm.encoding_length__fixedbuf(3), bytes); | ||
memory.write(string, cstring2=start4+100, 'utf8') | ||
var bytes = wasm.encode__typeLengthBuf(start4, 4, cstring2) | ||
var bytes = wasm.encode__typeLengthBuf(start4, 3, cstring2) | ||
t.equal(wasm.decode__typeLengthBuf_type(start4), 0x99) | ||
@@ -328,0 +325,0 @@ t.equal(wasm.decode__typeLengthBuf_length(start4), 1+2+2+4) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
1
119753
22
1794