Skip to content

Commit 15ffa35

Browse files
committed
Use the new macros for memcmp and memcpy
1 parent 8768b8e commit 15ffa35

5 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/transform/LZCodec.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ bool LZXCodec<T>::inverseV6(SliceArray<kanzi::byte>& input, SliceArray<kanzi::by
582582
do {
583583
// The stream decoder supplies trailing padding for this
584584
// 16-byte copy, which may write up to 15 bytes past mEnd.
585-
memcpy(&dst[dstIdx], &dst[ref], 16);
585+
KANZI_MEM_CP16(&dst[dstIdx], &dst[ref]);
586586
ref += 16;
587587
dstIdx += 16;
588588
} while (dstIdx < mEnd);
@@ -732,7 +732,7 @@ bool LZXCodec<T>::inverseV5(SliceArray<kanzi::byte>& input, SliceArray<kanzi::by
732732
do {
733733
// The stream decoder supplies trailing padding for this
734734
// 16-byte copy, which may write up to 15 bytes past mEnd.
735-
memcpy(&dst[dstIdx], &dst[ref], 16);
735+
KANZI_MEM_CP16(&dst[dstIdx], &dst[ref]);
736736
ref += 16;
737737
dstIdx += 16;
738738
} while (dstIdx < mEnd);
@@ -972,7 +972,7 @@ bool LZPCodec::inverse(SliceArray<kanzi::byte>& input, SliceArray<kanzi::byte>&
972972
do {
973973
// The stream decoder supplies trailing padding for this
974974
// 16-byte copy, which may write up to 15 bytes past mEnd.
975-
memcpy(&dst[dstIdx], &dst[ref], 16);
975+
KANZI_MEM_CP16(&dst[dstIdx], &dst[ref]);
976976
ref += 16;
977977
dstIdx += 16;
978978
} while (dstIdx < mEnd);

src/transform/LZCodec.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ namespace kanzi {
180180
// Callers provide trailing padding for this 16-byte copy, which may
181181
// read and write up to 15 bytes past the requested literal length.
182182
for (int i = 0; i < len; i += 16)
183-
memcpy(&dst[i], &src[i], 16);
183+
KANZI_MEM_CP16(&dst[i], &src[i]);
184184
}
185185

186186
template <bool T>

src/transform/RLT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ bool RLT::forward(SliceArray<kanzi::byte>& input, SliceArray<kanzi::byte>& outpu
124124
if (prev == src[srcIdx]) {
125125
const uint32 v = 0x01010101 * uint32(prev);
126126

127-
if (KANZI_MEM_EQ4(&v, &src[srcIdx])) {
127+
if (KANZI_MEM_EQ4(reinterpret_cast<const kanzi::byte*>(&v), &src[srcIdx])) {
128128
srcIdx += 4; run += 4;
129129

130130
if ((run < MAX_RUN4) && (srcIdx < srcEnd4))

src/transform/ROLZCodec.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ namespace kanzi {
292292

293293
if (dstIdx - ref >= 8) {
294294
while (matchLen > 0) {
295-
memcpy(&buf[dstIdx], &buf[ref], 8);
295+
KANZI_MEM_CP8(&buf[dstIdx], &buf[ref]);
296296
ref += 8;
297297
dstIdx += 8;
298298
matchLen -= 8;

src/transform/TextCodec.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ limitations under the License.
1818
#define knz_TextCodec
1919

2020
#include "../Context.hpp"
21+
#include "../Memory.hpp"
2122
#include "../Transform.hpp"
2223

2324

@@ -269,7 +270,7 @@ namespace kanzi {
269270
while (length >= 4) {
270271
length -= 4;
271272

272-
if (memcmp(&src[length], &dst[length], 4) != 0)
273+
if (!KANZI_MEM_EQ4(&src[length], &dst[length]))
273274
return false;
274275
}
275276

0 commit comments

Comments
 (0)