Skip to content

Commit

Permalink
Move to long.js fork
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Jan 5, 2022
1 parent 26fa7a3 commit c644815
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 29 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/fork-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Sync Fork

on:
schedule:
- cron: '45 4 * * *' # every day at 4:44 am
workflow_dispatch: # on button click

jobs:
sync:

runs-on: ubuntu-latest

steps:
- uses: tgymnich/fork-sync@v1
with:
base: master
head: master
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ D-bus protocol client and server for node.js

[![Build Status](https://secure.travis-ci.org/sidorares/dbus-native.png)](http://travis-ci.org/sidorares/dbus-native)

Fork Status
------------

This fork is maintained with the following two changes:
* Removed the optional `abstract-socket` dependency for faster installs
* Moved to our `long.js` fork to work around a crash on `ARMv6` platforms running node 16.1+

Installation
------------

Expand Down
2 changes: 1 addition & 1 deletion lib/dbus-buffer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Long = require('long');
const Long = require('@homebridge/long');
const parseSignature = require('./signature');

// Buffer + position + global start position ( used in alignment )
Expand Down
8 changes: 3 additions & 5 deletions lib/marshallers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Buffer = require('safe-buffer').Buffer;
const align = require('./align').align;
const parseSignature = require('../lib/signature');
const Long = require('long');
const Long = require('@homebridge/long');
/**
* MakeSimpleMarshaller
* @param signature - the signature of the data you want to check
Expand Down Expand Up @@ -63,8 +63,7 @@ var MakeSimpleMarshaller = function(signature) {
// utf8 string
align(ps, 4);
const buff = Buffer.from(data, 'utf8');
ps
.word32le(buff.length)
ps.word32le(buff.length)
.put(buff)
.word8(0);
ps._offset += 5 + buff.length;
Expand All @@ -80,8 +79,7 @@ var MakeSimpleMarshaller = function(signature) {
this.check(data);
// signature
const buff = Buffer.from(data, 'ascii');
ps
.word8(data.length)
ps.word8(data.length)
.put(buff)
.word8(0);
ps._offset += 2 + buff.length;
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
"dependencies": {
"event-stream": "^4.0.0",
"hexy": "^0.2.10",
"long": "^4.0.0",
"@homebridge/long": "^5.2.1",
"optimist": "^0.6.1",
"put": "0.0.6",
"safe-buffer": "^5.1.1",
"xml2js": "^0.4.17"
},
"uncomment": {
"comment": {
"optionalDependencies": {
"abstract-socket": "^2.0.0"
}
Expand Down
79 changes: 69 additions & 10 deletions test/unmarshall-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Buffer = require('safe-buffer').Buffer;
const marshall = require('../lib/marshall');
const unmarshall = require('../lib/unmarshall');
const assert = require('assert');
const Long = require('long');
const Long = require('@homebridge/long');

var LongMaxS64 = Long.fromString('9223372036854775807', false);
var LongMinS64 = Long.fromString('-9223372036854775808', false);
Expand Down Expand Up @@ -312,34 +312,93 @@ describe('marshall/unmarshall', function() {
],
'arrays of simple types': [
['ai', [[1, 2, 3, 4, 5, 6, 7]]],
['aai', [[[300, 400, 500], [1, 2, 3, 4, 5, 6, 7]]]],
['aiai', [[1, 2, 3], [300, 400, 500]]]
[
'aai',
[
[
[300, 400, 500],
[1, 2, 3, 4, 5, 6, 7]
]
]
],
[
'aiai',
[
[1, 2, 3],
[300, 400, 500]
]
]
],
'compound types': [
['iyai', [10, 100, [1, 2, 3, 4, 5, 6]]],
// TODO: fix 'array of structs offset problem
['a(iyai)', [[[10, 100, [1, 2, 3, 4, 5, 6]], [11, 200, [15, 4, 5, 6]]]]],
[
'a(iyai)',
[
[
[10, 100, [1, 2, 3, 4, 5, 6]],
[11, 200, [15, 4, 5, 6]]
]
]
],
[
'sa(iyai)',
[
'test test test test',
[[10, 100, [1, 2, 3, 4, 5, 6]], [11, 200, [15, 4, 5, 6]]]
[
[10, 100, [1, 2, 3, 4, 5, 6]],
[11, 200, [15, 4, 5, 6]]
]
]
],
[
'a(iyai)',
[
[
[10, 100, [1, 2, 3, 4, 5, 6]],
[11, 200, [15, 4, 5, 6]]
]
]
],
[
'a(yai)',
[
[
[100, [1, 2, 3, 4, 5, 6]],
[200, [15, 4, 5, 6]]
]
]
],
['a(iyai)', [[[10, 100, [1, 2, 3, 4, 5, 6]], [11, 200, [15, 4, 5, 6]]]]],
['a(yai)', [[[100, [1, 2, 3, 4, 5, 6]], [200, [15, 4, 5, 6]]]]],
[
'a(yyai)',
[[[100, 101, [1, 2, 3, 4, 5, 6]], [200, 201, [15, 4, 5, 6]]]]
[
[
[100, 101, [1, 2, 3, 4, 5, 6]],
[200, 201, [15, 4, 5, 6]]
]
]
],
[
'a(yyyai)',
[[[100, 101, 102, [1, 2, 3, 4, 5, 6]], [200, 201, 202, [15, 4, 5, 6]]]]
[
[
[100, 101, 102, [1, 2, 3, 4, 5, 6]],
[200, 201, 202, [15, 4, 5, 6]]
]
]
],
['ai', [[1, 2, 3, 4, 5, 6]]],
['aii', [[1, 2, 3, 4, 5, 6], 10]],
['a(ai)', [[[[1, 2, 3, 4, 5, 6]], [[15, 4, 5, 6]]]]],
['aai', [[[1, 2, 3, 4, 5, 6], [15, 4, 5, 6]]]]
[
'aai',
[
[
[1, 2, 3, 4, 5, 6],
[15, 4, 5, 6]
]
]
]
],
buffers: [
['ayay', [Buffer.from([0, 1, 2, 3, 4, 5, 6, 0xff]), Buffer.from([])]]
Expand Down

0 comments on commit c644815

Please sign in to comment.