Skip to content

Commit

Permalink
fixes #61
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiask88 committed Nov 22, 2020
1 parent 171748a commit 486b268
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,13 @@ Returns an `object` (see [example](#example-blockinfo) above) on success or `fal

----------

#### <a name="full-upload"></a>S7Client.FullUpload(blockType, blockNum[, callback])
#### <a name="full-upload"></a>S7Client.FullUpload(blockType, blockNum, size[, callback])
Uploads a block from AG. The whole block (including header and footer) is copied into the user buffer.

- `blockType` Type of block (see table [above](#table-blocktype))
- `blockNum` Number of block
- `size` Buffer size (if smaller than the data
uploaded, only `size` bytes are copied and `errCliPartialDataRead` is returned)
- The optional `callback` parameter will be executed after completion

If `callback` is **not** set the function is **blocking** and returns a `Buffer` object on success or `false` on error.<br />
Expand Down
2 changes: 1 addition & 1 deletion src/node_snap7_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1764,8 +1764,8 @@ NAN_METHOD(S7Client::FullUpload) {
return Nan::ThrowTypeError("Wrong arguments");
}

char *bufferData = new char[Nan::To<int32_t>(info[2]).FromJust()];
int size = Nan::To<int32_t>(info[2]).FromJust();
char *bufferData = new char[size];
if (!info[3]->IsFunction()) {
int returnValue = s7client->snap7Client->FullUpload(
Nan::To<int32_t>(info[0]).FromJust(), Nan::To<int32_t>(info[1]).FromJust(), bufferData, &size);
Expand Down

0 comments on commit 486b268

Please sign in to comment.