From 94781061cfd937c37407e6dc4545bfa457aa7971 Mon Sep 17 00:00:00 2001 From: Dave Hickin Date: Fri, 4 Mar 2016 22:56:43 +0000 Subject: [PATCH 1/5] fixed bitSet serialization (cherry picked from commit 65ff7ab1c3d8a532472b39af40acaf3480008a8b) Unit tests omitted as require API change. --- src/misc/bitSet.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/misc/bitSet.cpp b/src/misc/bitSet.cpp index 2da4fd8..2b485c0 100644 --- a/src/misc/bitSet.cpp +++ b/src/misc/bitSet.cpp @@ -322,12 +322,14 @@ namespace epics { namespace pvData { SerializeHelper::writeSize(len, buffer, flusher); flusher->ensureBuffer(len); - - for (uint32 i = 0; i < n - 1; i++) + + n = len / 8; + for (uint32 i = 0; i < n; i++) buffer->putLong(words[i]); - - for (uint64 x = words[n - 1]; x != 0; x >>= 8) - buffer->putByte((int8) (x & 0xff)); + + if (n < wordsInUse) + for (uint64 x = words[wordsInUse - 1]; x != 0; x >>= 8) + buffer->putByte((int8) (x & 0xff)); } void BitSet::deserialize(ByteBuffer* buffer, DeserializableControl* control) { From 0c2c6a4173fcf113d94b97a7d237b02b7a6ebcf7 Mon Sep 17 00:00:00 2001 From: Dave Hickin Date: Thu, 18 Feb 2016 18:56:04 +0000 Subject: [PATCH 2/5] Fix win32 deserialization test fail (cherry picked from commit 336a8b3bc2fb7c3123756a8e93082dbe85ecfaee) --- src/misc/bitSet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc/bitSet.cpp b/src/misc/bitSet.cpp index 2b485c0..8bfbabb 100644 --- a/src/misc/bitSet.cpp +++ b/src/misc/bitSet.cpp @@ -358,7 +358,7 @@ namespace epics { namespace pvData { words[j] = 0; for (uint32 remaining = (bytes - longs * 8), j = 0; j < remaining; j++) - words[i] |= (buffer->getByte() & 0xffL) << (8 * j); + words[i] |= (buffer->getByte() & 0xffLL) << (8 * j); } From acd19c10d008b1b48a3d06dd4bdfbb548ba56842 Mon Sep 17 00:00:00 2001 From: Dave Hickin Date: Fri, 4 Mar 2016 23:51:12 +0000 Subject: [PATCH 3/5] BitSet: truncation in or_and For "this |= set1 & set2" the result size should be "max(this, min(set1, set2))" while at present it is "min(set1, set2)" resulting in truncation if the LHS is longer than the RHS. (cherry picked from commit d4292d81f2391a5bb5e5747f0f6ceacec028c1e2) Number of tests planned corrected. --- src/misc/bitSet.cpp | 3 ++- testApp/misc/testBitSet.cpp | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/misc/bitSet.cpp b/src/misc/bitSet.cpp index 8bfbabb..de19ea9 100644 --- a/src/misc/bitSet.cpp +++ b/src/misc/bitSet.cpp @@ -279,7 +279,8 @@ namespace epics { namespace pvData { uint32 inUse = (set1.wordsInUse < set2.wordsInUse) ? set1.wordsInUse : set2.wordsInUse; ensureCapacity(inUse); - wordsInUse = inUse; + if(inUse>wordsInUse) + wordsInUse = inUse; // Perform logical AND on words in common for (uint32 i = 0; i < inUse; i++) diff --git a/testApp/misc/testBitSet.cpp b/testApp/misc/testBitSet.cpp index 36fc645..6cb2a3b 100644 --- a/testApp/misc/testBitSet.cpp +++ b/testApp/misc/testBitSet.cpp @@ -146,12 +146,19 @@ static void testOperators() b1.or_and(b2, b3); str = toString(b1); testOk1(str == "{2, 128}"); + + b1.clear(); b1.set(1); + b2.clear(); + b3.clear(); b3.set(1); + std::cout<<"# "< Date: Sat, 5 Mar 2016 01:58:59 +0000 Subject: [PATCH 4/5] Add release notes for 5.0.4 --- documentation/RELEASE_NOTES.html | 27 +++++++++++++++++++++++++++ documentation/RELEASE_NOTES.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 1f0a423..d82aa6e 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -1,3 +1,30 @@ +

Release 5.0.4

+ +

The changes since release 5.0.3 are:

+ +
    +
  • Fixed bitset serialization (issue #24)
  • +
  • Fixed truncation in BitSet::or_and (issue #27)
  • +
+ +

Fixed bitset serialization (issue #24)

+ +

C++ bitset serialization was not consistent with the C++ deserialization and +Java code in some instances (depending on the endianness of the serializer and deserializer) when the number of bits was 56-63 modulo 64. C++ serialization +has been fixed.

+ +

Fix exposed issue in deserialization on 32-bit platforms which +has also been corrected.

+ +

Fixed truncation in BitSet::or_and (issue #27)

+ +

If n, n1 and n2 words are used to store the values of the bitsets bitset, +bitset1 and bitset2 respectively then max(n, min(n1,n2)) words are needed +to store bitset.or_(bitset1, bitset2).

+ +

Previously min(n1,n2) words were used and the result would be truncated in +some instances. This has been fixed.

+

Release 5.0.3

The only change since release 5.0.2 is:

diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index 20abbb2..bc0429b 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -1,3 +1,32 @@ +Release 5.0.4 +============= + +The changes since release 5.0.3 are: + +* Fixed bitset serialization (issue #24) +* Fixed truncation in BitSet::or_and (issue #27) + +Fixed bitset serialization (issue #24) +-------------------------------------- + +C++ bitset serialization was not consistent with the C++ deserialization and +Java code in some instances (depending on the endianness of the serializer and deserializer) when the number of bits was 56-63 modulo 64. C++ serialization +has been fixed. + +Fix exposed issue in deserialization on 32-bit platforms which +has also been corrected. + +Fixed truncation in BitSet::or_and (issue #27) +---------------------------------------------- + +If n, n1 and n2 words are used to store the values of the bitsets bitset, +bitset1 and bitset2 respectively then max(n, min(n1,n2)) words are needed +to store bitset.or_(bitset1, bitset2). + +Previously min(n1,n2) words were used and the result would be truncated in +some instances. This has been fixed. + + Release 5.0.3 ============= From fda9144505dc72ca323c53fbd6a1136a6a4f7ee9 Mon Sep 17 00:00:00 2001 From: Dave Hickin Date: Mon, 7 Mar 2016 11:04:08 +0000 Subject: [PATCH 5/5] Split long line in README.md --- documentation/RELEASE_NOTES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index bc0429b..abbafc7 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -10,7 +10,8 @@ Fixed bitset serialization (issue #24) -------------------------------------- C++ bitset serialization was not consistent with the C++ deserialization and -Java code in some instances (depending on the endianness of the serializer and deserializer) when the number of bits was 56-63 modulo 64. C++ serialization +Java code in some instances (depending on the endianness of the serializer and +deserializer) when the number of bits was 56-63 modulo 64. C++ serialization has been fixed. Fix exposed issue in deserialization on 32-bit platforms which