Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ref

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ref - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

test/alloc.js

8

History.md
0.0.11 / 2012-05-17
===================
- always do string type coersion, like on `alloc()`
- add a "bool" type, which works with JS `true`/`false` values
0.0.10 / 2012-05-15
==================
===================

@@ -5,0 +11,0 @@ - fix compiler error on Solaris

@@ -113,3 +113,3 @@

}
return buffer.type
return exports.coerceType(buffer.type)
}

@@ -177,3 +177,4 @@

exports.alloc = function alloc (type, value) {
exports.alloc = function alloc (_type, value) {
var type = exports.coerceType(_type)
debug('allocating Buffer for type with "size"', type.size)

@@ -467,3 +468,19 @@ var size

/**
* the "bool" type should return/accept JS true/false values
* XXX: should "int8" always be used here?
*/
exports.types.bool = {
size: exports.sizeof.bool
, indirection: 1
, get: function get (buf, offset) {
return exports.types.int8.get(buf, offset) ? true : false
}
, set: function set (buf, offset, val) {
return exports.types.int8.set(buf, offset, val ? 1 : 0)
}
}
// "typedef"s for the variable-sized types

@@ -470,0 +487,0 @@ ;[ 'byte', 'char', 'uchar', 'short', 'ushort', 'int', 'uint', 'long'

2

package.json

@@ -19,3 +19,3 @@ { "name": "ref"

]
, "version": "0.0.10"
, "version": "0.0.11"
, "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)"

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

@@ -71,2 +71,4 @@ ref

---
#### `Buffer#address()` → Number

@@ -76,2 +78,4 @@

---
#### `Buffer#isNull()` → Boolean

@@ -81,2 +85,4 @@

---
#### `Buffer#ref()` → Buffer

@@ -90,2 +96,4 @@

---
#### `Buffer#deref()` → ???

@@ -100,2 +108,4 @@

---
#### `Buffer#readObject(Number offset)` → Object

@@ -106,2 +116,4 @@

---
#### `Buffer#writeObject(Object obj, Number offset)` → undefined

@@ -113,2 +125,4 @@

---
#### `Buffer#readPointer(Number offset, Number size)` → Buffer

@@ -120,2 +134,4 @@

---
#### `Buffer#writePointer(Buffer pointer, Number offset)` → undefined

@@ -128,2 +144,4 @@

---
#### `Buffer#readCString(Number offset)` → String

@@ -137,2 +155,4 @@

---
#### `Buffer#writeCString(String string, Number offset, String encoding)` → undefined

@@ -143,2 +163,4 @@

---
#### `Buffer#readInt64[native-endianness](Number offset)` → Number|String

@@ -150,2 +172,4 @@

---
#### `Buffer#writeInt64[native-endianness](Number|String value, Number offset)` → undefined

@@ -158,2 +182,4 @@

---
#### `Buffer#readUInt64[native-endianness](Number offset)` → Number|String

@@ -166,2 +192,4 @@

---
#### `Buffer#writeUInt64[native-endianness](Number|String value, Number offset)` → undefined

@@ -174,2 +202,4 @@

---
#### `Buffer#reinterpret(Number size)` → Buffer

@@ -176,0 +206,0 @@

@@ -14,5 +14,14 @@

var type = ref.coerceType('void *')
assert(type !== ref.types.void)
assert.equal(type.indirection, ref.types.void.indirection + 1)
})
it('should coerce the "type" property of a Buffer', function () {
var buf = new Buffer(ref.sizeof.int)
buf.type = 'int'
var type = ref.getType(buf)
assert.strictEqual(ref.types.int, type)
assert.strictEqual('int', buf.type)
})
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc