You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jm...@apache.org on 2018/01/10 01:43:06 UTC

[incubator-plc4x] branch master updated: may need a extra byte if not on byte boundry

This is an automated email from the ASF dual-hosted git repository.

jmclean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git


The following commit(s) were added to refs/heads/master by this push:
     new 85fb9cb  may need a extra byte if not on byte boundry
85fb9cb is described below

commit 85fb9cb7088624432187e0f0b1a16cd276f3f1d3
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Wed Jan 10 12:42:58 2018 +1100

    may need a extra byte if not on byte boundry
---
 .../s7/src/main/java/org/apache/plc4x/java/s7/netty/S7Protocol.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/S7Protocol.java b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/S7Protocol.java
index bd6ea9c..ff7746c 100644
--- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/S7Protocol.java
+++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/S7Protocol.java
@@ -242,7 +242,7 @@ public class S7Protocol extends MessageToMessageCodec<IsoTPMessage, S7Message> {
                         (messageType == MessageType.ACK_DATA)) {
                         DataTransportSize dataTransportSize = DataTransportSize.valueOf(userData.readByte());
                         short length = (dataTransportSize.isSizeInBits()) ?
-                            (short) (userData.readShort() / 8) : userData.readShort();
+                            (short) Math.ceil(userData.readShort() / 8.0) : userData.readShort();
                         byte[] data = new byte[length];
                         userData.readBytes(data);
                         // Initialize a rudimentary payload (This is updated in the Plc4XS7Protocol class

-- 
To stop receiving notification emails like this one, please contact
['"commits@plc4x.apache.org" <co...@plc4x.apache.org>'].