Merge pull request #8 from luke-jr/avoid_ssize_t

Avoid ssize_t
This commit is contained in:
Luke Dashjr
2018-06-03 23:14:43 +00:00
committed by GitHub
3 changed files with 9 additions and 2 deletions

View File

@@ -15,7 +15,6 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include "libbase58.h"
@@ -147,7 +146,7 @@ bool b58enc(char *b58, size_t *b58sz, const void *data, size_t binsz)
{
const uint8_t *bin = data;
int carry;
ssize_t i, j, high, zcount = 0;
size_t i, j, high, zcount = 0;
size_t size;
while (zcount < binsz && !bin[zcount])
@@ -164,6 +163,10 @@ bool b58enc(char *b58, size_t *b58sz, const void *data, size_t binsz)
carry += 256 * buf[j];
buf[j] = carry % 58;
carry /= 58;
if (!j) {
// Otherwise j wraps to maxint which is > high
break;
}
}
}