From 0f551ab4dccba214bb7217be284428115ce02a10 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Wed, 10 May 2017 19:22:06 +0000
Subject: [PATCH] (tar.c) Cleanup compiler aggressive-loop-optimizations warning
tar.c: In function 'tar_checksum':
tar.c:403:44: error: iteration 8u invokes undefined behavior [-Werror=aggressive-loop-optimizations]
sum -= 0xFF & header->header.chksum[i];
^
tar.c:401:5: note: containing loop
for (i = sizeof (header->header.chksum); i-- >= 0;)
^
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/vfs/tar/tar.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/vfs/tar/tar.c b/src/vfs/tar/tar.c
index 9016a3d..8e9446f 100644
a
|
b
|
tar_checksum (const union record *header) |
387 | 387 | |
388 | 388 | recsum = tar_from_oct (8, header->header.chksum); |
389 | 389 | |
390 | | for (i = sizeof (*header); i-- >= 0;) |
| 390 | for (i = sizeof (*header); --i >= 0;) |
391 | 391 | { |
392 | 392 | /* |
393 | 393 | * We can't use unsigned char here because of old compilers, |
… |
… |
tar_checksum (const union record *header) |
398 | 398 | } |
399 | 399 | |
400 | 400 | /* Adjust checksum to count the "chksum" field as blanks. */ |
401 | | for (i = sizeof (header->header.chksum); i-- >= 0;) |
| 401 | for (i = sizeof (header->header.chksum); --i >= 0;) |
402 | 402 | { |
403 | 403 | sum -= 0xFF & header->header.chksum[i]; |
404 | 404 | signed_sum -= (char) header->header.chksum[i]; |