Skip to content
This repository was archived by the owner on Jan 17, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion node-eclib.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,15 @@ ECLib.prototype = {
hd: 0,
ct: 0
};
}
},

/**
* Get fragment's header size
* @return {Number} header size
*/
getHeaderSize: function() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love some documentation here.

return addon.EclGetHeaderSize();
},
}

module.exports = ECLib;
Expand Down
6 changes: 6 additions & 0 deletions src/cpp/libmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ NAN_METHOD(EclDestroy) {
return ;
}

NAN_METHOD(EclGetHeaderSize) {
Nan::HandleScope scope;
uint32_t header_size = sizeof(fragment_header_t);
info.GetReturnValue().Set(header_size);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: You forgot a newline there.


NAN_METHOD(EclFragmentsNeeded) {
Nan::HandleScope scope;
info.GetReturnValue()
Expand Down
1 change: 1 addition & 0 deletions src/cpp/libmain.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

NAN_METHOD(EclCreate);
NAN_METHOD(EclDestroy);
NAN_METHOD(EclGetHeaderSize);
NAN_METHOD(EclFragmentsNeeded);
NAN_METHOD(EclGetFragmentMetadata);
NAN_METHOD(EclIsInvalidFragment);
Expand Down
1 change: 1 addition & 0 deletions src/cpp/node-eclib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ NAN_MODULE_INIT(Init) {
NAN_EXPORT(target, EclEncode);
NAN_EXPORT(target, EclEncodeV);
NAN_EXPORT(target, EclDecode);
NAN_EXPORT(target, EclGetHeaderSize);
NAN_EXPORT(target, EclReconstructFragment);
NAN_EXPORT(target, EclFragmentsNeeded);
NAN_EXPORT(target, EclGetFragmentMetadata);
Expand Down