diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2021-04-09 10:43:07 +0200 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2021-04-09 11:05:54 +0200 |
commit | 69e9138080ae39236de48561cf8923a86104eb35 (patch) | |
tree | ad605c6a312bcfd159bc6256fe17839826228919 /tools/firmware-utils/src/xorimage.c | |
parent | 052a30d65e90ac9b3359f4a23aa3024d102c178c (diff) | |
download | upstream-69e9138080ae39236de48561cf8923a86104eb35.tar.gz upstream-69e9138080ae39236de48561cf8923a86104eb35.tar.bz2 upstream-69e9138080ae39236de48561cf8923a86104eb35.zip |
firmware-utils: fix -Wpointer-sign warnings
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'tools/firmware-utils/src/xorimage.c')
-rw-r--r-- | tools/firmware-utils/src/xorimage.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/firmware-utils/src/xorimage.c b/tools/firmware-utils/src/xorimage.c index 4d1cd2d5de..e13531ab4a 100644 --- a/tools/firmware-utils/src/xorimage.c +++ b/tools/firmware-utils/src/xorimage.c @@ -29,15 +29,17 @@ static char default_pattern[] = "12345678"; static int is_hex_pattern; -int xor_data(uint8_t *data, size_t len, const uint8_t *pattern, int p_len, int p_off) +int xor_data(void *data, size_t len, const void *pattern, int p_len, int p_off) { - int offset = p_off; + const uint8_t *key = pattern; + uint8_t *d = data; + while (len--) { - *data ^= pattern[offset]; - data++; - offset = (offset + 1) % p_len; + *d ^= key[p_off]; + d++; + p_off = (p_off + 1) % p_len; } - return offset; + return p_off; } |