Skip to content

Commit 40ce5b4

Browse files
authored
Merge branch 'Fastcode:main' into main
2 parents 3572b3d + 4b945eb commit 40ce5b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+23626
-904
lines changed

.github/workflows/formatting.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ jobs:
3333
uses: DoozyX/clang-format-lint-action@v0.13
3434
with:
3535
source: './src'
36-
exclude: './src/mio ./src/xxhash ./src/zstr'
36+
exclude: './src/third-party'
3737
extensions: 'h,c,cpp,hpp'
3838
clangFormatVersion: 12

binding.gyp

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"targets": [
33
{
4-
"target_name": "nbs_decoder",
4+
"target_name": "nbsdecoder",
55
"sources": [
66
"src/binding.cpp",
77
"src/Decoder.cpp",
88
"src/Encoder.cpp",
99
"src/Hash.cpp",
1010
"src/Packet.cpp",
1111
"src/Timestamp.cpp",
12-
"src/xxhash/xxhash.c",
12+
"src/third-party/xxhash/xxhash.c",
1313
],
1414
"cflags": [],
1515
"include_dirs": [
@@ -62,6 +62,10 @@
6262
[
6363
'OS=="win"',
6464
{
65+
"dependencies": ["zlib"],
66+
"include_dirs": [
67+
"src/third-party/zlib",
68+
],
6569
"defines": ["_HAS_EXCEPTIONS=1", "NOMINMAX=1"],
6670
"msvs_settings": {
6771
"VCCLCompilerTool": {
@@ -71,6 +75,35 @@
7175
},
7276
],
7377
],
74-
}
75-
]
78+
},
79+
],
80+
"conditions": [
81+
['OS == "win"', {
82+
"targets": [
83+
# Compile zlib for linking on Windows only
84+
{
85+
"target_name": "zlib",
86+
"type": "static_library",
87+
"dependencies": [],
88+
"sources": [
89+
"src/third-party/zlib/adler32.c",
90+
"src/third-party/zlib/compress.c",
91+
"src/third-party/zlib/crc32.c",
92+
"src/third-party/zlib/deflate.c",
93+
"src/third-party/zlib/gzclose.c",
94+
"src/third-party/zlib/gzlib.c",
95+
"src/third-party/zlib/gzread.c",
96+
"src/third-party/zlib/gzwrite.c",
97+
"src/third-party/zlib/infback.c",
98+
"src/third-party/zlib/inffast.c",
99+
"src/third-party/zlib/inflate.c",
100+
"src/third-party/zlib/inftrees.c",
101+
"src/third-party/zlib/trees.c",
102+
"src/third-party/zlib/uncompr.c",
103+
"src/third-party/zlib/zutil.c",
104+
],
105+
},
106+
],
107+
}],
108+
],
76109
}

nbsdecoder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const bindings = require('bindings');
22

33
const binding = bindings({
4-
bindings: 'nbs_decoder',
4+
bindings: 'nbsdecoder',
55
});
66

77
module.exports.NbsDecoder = binding.Decoder;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "nbsdecoder.js",
3-
"version": "0.4.1",
3+
"version": "0.4.4",
44
"description": "Node.js module for interacting with NUClear Binary Stream files",
55
"main": "nbsdecoder.js",
66
"types": "nbsdecoder.d.ts",
77
"engines": {
8-
"node": ">=18.17.0"
8+
"node": ">=14.14.0"
99
},
1010
"files": [
1111
"nbsdecoder.js",

src/Decoder.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "Index.hpp"
88
#include "Packet.hpp"
99
#include "TypeSubtype.hpp"
10-
#include "mio/mmap.hpp"
10+
#include "third-party/mio/mmap.hpp"
1111

1212
namespace nbs {
1313
class Decoder : public Napi::ObjectWrap<Decoder> {

src/Encoder.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <napi.h>
66

77
#include "Packet.hpp"
8-
#include "zstr/zstr.hpp"
8+
#include "third-party/zstr/zstr.hpp"
99

1010
namespace nbs {
1111
class Encoder : public Napi::ObjectWrap<Encoder> {

src/Hash.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <napi.h>
55

6-
#include "xxhash/xxhash.h"
6+
#include "third-party/xxhash/xxhash.h"
77

88
namespace nbs {
99

src/Index.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include "IndexItem.hpp"
1010
#include "TypeSubtype.hpp"
11-
#include "zstr/zstr.hpp"
11+
#include "third-party/zstr/zstr.hpp"
12+
1213
namespace nbs {
1314

1415
using IndexIterator = std::vector<IndexItemFile>::iterator;

src/IndexItem.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <fstream>
66
#include <vector>
77

8-
#include "mio/mmap.hpp"
8+
#include "third-party/mio/mmap.hpp"
99

1010
namespace nbs {
1111
// Make the packing match what it would be in the file.

src/Timestamp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace nbs {
3030
uint64_t seconds = ts.Get("seconds").As<Napi::Number>().Int64Value();
3131
uint64_t nanos = ts.Get("nanos").As<Napi::Number>().Int64Value();
3232

33-
timestamp = seconds * 1e9 + nanos;
33+
timestamp = seconds * 1000000000L + nanos;
3434
}
3535
else {
3636
throw std::runtime_error("expected positive number or BigInt or timestamp object");

0 commit comments

Comments
 (0)