You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ref-array

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ref-array - npm Package Compare versions

Comparing version

to
0.0.3

t.js

19

lib/array.js

@@ -140,7 +140,7 @@

// the ref "type" interface
ArrayType.size = ArrayType.BYTES_PER_ELEMENT * fixedLength
ArrayType.alignment = type.alignment
ArrayType.indirection = 1
if (fixedLength > 0) {
// this "type" is probably going in a ref-struct or being used manually
ArrayType.size = ArrayType.BYTES_PER_ELEMENT * fixedLength
ArrayType.alignment = type.alignment
ArrayType.indirection = 1
ArrayType.get = get

@@ -150,2 +150,5 @@ ArrayType.set = set

// this "type" is probably an argument/return value for a node-ffi function
ArrayType.size = _ref.sizeof.pointer
ArrayType.alignment = _ref.alignof.pointer
ArrayType.indirection = 1
ArrayType.get = getRef

@@ -210,3 +213,10 @@ ArrayType.set = setRef

function setRef (buffer, offset, value) {
assert(0, 'implement!!!')
debug('Array reference "type" setter for buffer at offset', offset)
var ptr
if (value instanceof this) {
ptr = value.buffer
} else {
ptr = new this(value).buffer
}
_ref.writePointer(buffer, offset, ptr)
}

@@ -216,3 +226,2 @@

* Returns a reference to the backing buffer of this Array instance.
* node-ffi calls this function when passed an instance of the arraytype.
*

@@ -219,0 +228,0 @@ * i.e. if the array represents `int[]` (a.k.a. `int *`),

{ "name": "ref-array"
, "description": "Create C \"array\" instances on top of Buffers"
, "keywords": [ "array", "ref" ]
, "version": "0.0.2"
, "version": "0.0.3"
, "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)"

@@ -6,0 +6,0 @@ , "repository": { "type": "git", "url": "git://github.com/TooTallNate/ref-array.git" }

@@ -38,4 +38,4 @@

it('should have the type\'s size be 0 by default', function () {
assert.equal(0, Int32Array.size)
it('should have the type\'s size be pointer-sized by default', function () {
assert.equal(ref.sizeof.pointer, Int32Array.size)
})

@@ -42,0 +42,0 @@