libmodbus: upgrade 3.1.6 -> 3.1.7

Fix-typo.patch
f1eb4bc7ccb09cd8d19ab641ee37637f8c34d16d.patch
removed since they're included in 3.1.7

Changelog:
=========
modbus_reply: fix copy & paste error in sanity check
Add SECURITY.md
Fix typo in comment
Replace obsolete AC_PROG_CC_STDC by AC_PROG_CC
Fix position of CC flags in documentation
Remove duplicate ';'
Add the baud rate of 256k for Windows
cosmetic changes in man page standardizing itemization
Fix many typos
Replace .dir-locals.el (Emacs) by .editorconfig
Include the test LICENSE in tarball
Install the NEWS and AUTHORS files
Update README.md
docs: fix simple typo, reponse -> response
Add modbus_[get|set]_indication_timeout to doc build
Fix warning issues
Move malloc before starting unit tests
Fixed MODBUS_GET_* macros in case of negative values
SPDX: change LGPL-2.1+ to LGPL-2.1-or-later

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
wangmy
2022-01-19 09:42:34 +08:00
committed by Khem Raj
parent 3ec0b14aa4
commit e3929a60d6
4 changed files with 9 additions and 96 deletions
@@ -1,52 +0,0 @@
From: =?utf-8?b?IlNaIExpbiAo5p6X5LiK5pm6KSI=?= <szlin@debian.org>
Date: Thu, 27 Sep 2018 14:51:32 +0800
Subject: Fix typo
---
doc/modbus_mapping_new_start_address.txt | 4 ++--
doc/modbus_reply.txt | 2 +-
doc/modbus_reply_exception.txt | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/modbus_mapping_new_start_address.txt b/doc/modbus_mapping_new_start_address.txt
index 4fa196a..94a81fb 100644
--- a/doc/modbus_mapping_new_start_address.txt
+++ b/doc/modbus_mapping_new_start_address.txt
@@ -21,9 +21,9 @@ The _modbus_mapping_new_start_address()_ function shall allocate four arrays to
store bits, input bits, registers and inputs registers. The pointers are stored
in modbus_mapping_t structure. All values of the arrays are initialized to zero.
-The different starting adresses make it possible to place the mapping at any
+The different starting addresses make it possible to place the mapping at any
address in each address space. This way, you can give access to values stored
-at high adresses without allocating memory from the address zero, for eg. to
+at high addresses without allocating memory from the address zero, for eg. to
make available registers from 10000 to 10009, you can use:
[source,c]
diff --git a/doc/modbus_reply.txt b/doc/modbus_reply.txt
index 0b29d6f..6b71d11 100644
--- a/doc/modbus_reply.txt
+++ b/doc/modbus_reply.txt
@@ -3,7 +3,7 @@ modbus_reply(3)
NAME
----
-modbus_reply - send a reponse to the received request
+modbus_reply - send a response to the received request
SYNOPSIS
diff --git a/doc/modbus_reply_exception.txt b/doc/modbus_reply_exception.txt
index 7e6324f..b2170be 100644
--- a/doc/modbus_reply_exception.txt
+++ b/doc/modbus_reply_exception.txt
@@ -3,7 +3,7 @@ modbus_reply_exception(3)
NAME
----
-modbus_reply_exception - send an exception reponse
+modbus_reply_exception - send an exception response
SYNOPSIS
@@ -1,32 +0,0 @@
From f1eb4bc7ccb09cd8d19ab641ee37637f8c34d16d Mon Sep 17 00:00:00 2001
From: i-ky <gl.ivanovsky@gmail.com>
Date: Tue, 10 Jul 2018 15:58:45 +0300
Subject: [PATCH] Fixed MODBUS_GET_* macros in case of negative values
In case resulting value should be negative it is incorrect to use '+' operator to construct it from pieces, because highest bytes will result in negative number after bitwise shift while others will stay positive. Replacing addition with '|' should solve the issue.
---
src/modbus.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/modbus.h b/src/modbus.h
index f6e9a5f5..c63f5ceb 100644
--- a/src/modbus.h
+++ b/src/modbus.h
@@ -245,12 +245,12 @@ MODBUS_API int modbus_reply_exception(modbus_t *ctx, const uint8_t *req,
#define MODBUS_GET_HIGH_BYTE(data) (((data) >> 8) & 0xFF)
#define MODBUS_GET_LOW_BYTE(data) ((data) & 0xFF)
#define MODBUS_GET_INT64_FROM_INT16(tab_int16, index) \
- (((int64_t)tab_int16[(index) ] << 48) + \
- ((int64_t)tab_int16[(index) + 1] << 32) + \
- ((int64_t)tab_int16[(index) + 2] << 16) + \
+ (((int64_t)tab_int16[(index) ] << 48) | \
+ ((int64_t)tab_int16[(index) + 1] << 32) | \
+ ((int64_t)tab_int16[(index) + 2] << 16) | \
(int64_t)tab_int16[(index) + 3])
-#define MODBUS_GET_INT32_FROM_INT16(tab_int16, index) ((tab_int16[(index)] << 16) + tab_int16[(index) + 1])
-#define MODBUS_GET_INT16_FROM_INT8(tab_int8, index) ((tab_int8[(index)] << 8) + tab_int8[(index) + 1])
+#define MODBUS_GET_INT32_FROM_INT16(tab_int16, index) ((tab_int16[(index)] << 16) | tab_int16[(index) + 1])
+#define MODBUS_GET_INT16_FROM_INT8(tab_int8, index) ((tab_int8[(index)] << 8) | tab_int8[(index) + 1])
#define MODBUS_SET_INT16_TO_INT8(tab_int8, index, value) \
do { \
tab_int8[(index)] = (value) >> 8; \
@@ -1,12 +0,0 @@
require libmodbus.inc
SRC_URI += "file://f1eb4bc7ccb09cd8d19ab641ee37637f8c34d16d.patch \
file://Fix-float-endianness-issue-on-big-endian-arch.patch \
file://Fix-typo.patch"
SRC_URI[md5sum] = "15c84c1f7fb49502b3efaaa668cfd25e"
SRC_URI[sha256sum] = "d7d9fa94a16edb094e5fdf5d87ae17a0dc3f3e3d687fead81835d9572cf87c16"
# this file has been created one minute after the configure file, so it doesn't get recreated during configure step
do_configure:prepend() {
rm -rf ${S}/tests/unit-test.h
}
@@ -0,0 +1,9 @@
require libmodbus.inc
SRC_URI += "file://Fix-float-endianness-issue-on-big-endian-arch.patch"
SRC_URI[sha256sum] = "7dfe958431d0570b271e1a5b329b76a658e89c614cf119eb5aadb725c87f8fbd"
# this file has been created one minute after the configure file, so it doesn't get recreated during configure step
do_configure:prepend() {
rm -rf ${S}/tests/unit-test.h
}