summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compression/lzxpress.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/compression/lzxpress.c b/lib/compression/lzxpress.c
index 0396c9ddcb..a4ded7e455 100644
--- a/lib/compression/lzxpress.c
+++ b/lib/compression/lzxpress.c
@@ -34,6 +34,7 @@
#include "replace.h"
#include "lzxpress.h"
+#include "../lib/util/byteorder.h"
#define __BUF_POS_CONST(buf,ofs)(((const uint8_t *)buf)+(ofs))
@@ -130,11 +131,11 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed,
if (best_len < 10) {
/* Classical meta-data */
metadata = (uint16_t)(((best_offset - 1) << 3) | (best_len - 3));
- dest[metadata_size / sizeof(uint16_t)] = metadata;
+ SSVAL(dest, metadata_size / sizeof(uint16_t), metadata);
metadata_size += sizeof(uint16_t);
} else {
metadata = (uint16_t)(((best_offset - 1) << 3) | 7);
- dest[metadata_size / sizeof(uint16_t)] = metadata;
+ SSVAL(dest, metadata_size / sizeof(uint16_t), metadata);
metadata_size = sizeof(uint16_t);
if (best_len < (15 + 7 + 3)) {
@@ -199,7 +200,7 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed,
indic_bit++;
if ((indic_bit - 1) % 32 > (indic_bit % 32)) {
- *(uint32_t *)indic_pos = indic;
+ SIVAL(indic_pos, 0, indic);
indic = 0;
indic_pos = &compressed[compressed_pos];
compressed_pos += sizeof(uint32_t);
@@ -213,7 +214,7 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed,
uncompressed_pos++;
compressed_pos++;
if (((indic_bit - 1) % 32) > (indic_bit % 32)){
- *(uint32_t *)indic_pos = indic;
+ SIVAL(indic_pos, 0, indic);
indic = 0;
indic_pos = &compressed[compressed_pos];
compressed_pos += sizeof(uint32_t);
@@ -225,7 +226,7 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed,
indic |= 0 << (32 - ((indic_bit % 32) + 1));
*(uint32_t *)&compressed[compressed_pos] = 0;
- *(uint32_t *)indic_pos = indic;
+ SIVAL(indic_pos, 0, indic);
compressed_pos += sizeof(uint32_t);
}