Skip to content

Commit

Permalink
fix implicit conversion warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gblazex committed Jul 8, 2015
1 parent f488e7f commit 7a4954f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions objc/encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
size_t
base32_encoder_last_quintent (const size_t bytes)
{
int quintets = bytes * 8 / 5;
int remainder = bytes % 5;
size_t quintets = bytes * 8 / 5;
size_t remainder = bytes % 5;
return remainder == 0 ? quintets : quintets + 1;
}

Expand All @@ -43,10 +43,10 @@ base32_encoder_buffer_size (const size_t bytes)
base32_encoder_output_padding_size (bytes);
}

static unsigned
base32_encoder_encode_bits (int position, const uint8_t *buffer)
static size_t
base32_encoder_encode_bits (size_t position, const uint8_t *buffer)
{
unsigned offset = position / 8 * 5;
size_t offset = position / 8 * 5;
switch (position % 8)
{
case 0:
Expand Down Expand Up @@ -91,19 +91,19 @@ base32_encoder_encode_bits (int position, const uint8_t *buffer)
}

static inline uint8_t
base32_encoder_encode_at_position (unsigned position, const uint8_t *buffer)
base32_encoder_encode_at_position (size_t position, const uint8_t *buffer)
{
const char *table = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
unsigned index = base32_encoder_encode_bits (position, buffer);
size_t index = base32_encoder_encode_bits (position, buffer);
return table[index];
}

void
base32_encode (uint8_t *output, const size_t outputLength,
const uint8_t *input, const size_t inputLength)
{
unsigned i;
unsigned quintets = base32_encoder_last_quintent(inputLength);
size_t i;
size_t quintets = base32_encoder_last_quintent(inputLength);
for (i = 0; i < quintets; i++)
output[i] = base32_encoder_encode_at_position (i, input);
for (i = quintets; i < outputLength; i++)
Expand Down

0 comments on commit 7a4954f

Please sign in to comment.