aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <swo-dev@marcschink.de>2019-09-07 21:24:58 +0200
committerMarc Schink <swo-dev@marcschink.de>2019-09-07 21:48:47 +0200
commit6d456701ddbcdb90ea81c03d4b4bfee4cb216503 (patch)
tree5357922f7e0cb6512c40a9a31bc350ef4d8a3fbd
parenta509ec63e1e7369fa9fd1c75ae06372d7e87e161 (diff)
Declare variables in for-loops (C99-style)HEADmaster
Signed-off-by: Marc Schink <swo-dev@marcschink.de>
-rw-r--r--libswo/decoder.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libswo/decoder.c b/libswo/decoder.c
index 9dd1ad9..b0c0227 100644
--- a/libswo/decoder.c
+++ b/libswo/decoder.c
@@ -183,11 +183,10 @@ static int decode_cond_payload(struct libswo_context *ctx, uint32_t *value)
static uint32_t decode_payload(const uint8_t *buffer, uint8_t size)
{
uint32_t tmp;
- unsigned int i;
tmp = 0;
- for (i = 0; i < size; i++)
+ for (unsigned int i = 0; i < size; i++)
tmp |= (buffer[i] << (i * 8));
return tmp;
@@ -196,7 +195,6 @@ static uint32_t decode_payload(const uint8_t *buffer, uint8_t size)
static bool decode_sync_packet(struct libswo_context *ctx)
{
size_t i;
- size_t j;
size_t num_bits;
uint8_t tmp;
@@ -215,7 +213,7 @@ static bool decode_sync_packet(struct libswo_context *ctx)
num_bits += 8;
}
- for (j = 0; j < 8; j++, num_bits++)
+ for (size_t j = 0; j < 8; j++, num_bits++)
if (tmp & (1 << j))
break;