Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Avoid ssize_t" #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ TESTS = \
tests/decode-zero.sh \
tests/encode.sh \
tests/encode-b58c.sh \
tests/encode-b58c-high.sh \
tests/encode-fail.sh \
tests/encode-neg-index.sh \
tests/encode-small.sh
Expand Down
7 changes: 2 additions & 5 deletions base58.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>

#include "libbase58.h"

Expand Down Expand Up @@ -146,7 +147,7 @@ bool b58enc(char *b58, size_t *b58sz, const void *data, size_t binsz)
{
const uint8_t *bin = data;
int carry;
size_t i, j, high, zcount = 0;
ssize_t i, j, high, zcount = 0;
size_t size;

while (zcount < binsz && !bin[zcount])
Expand All @@ -163,10 +164,6 @@ 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;
}
}
}

Expand Down
3 changes: 0 additions & 3 deletions tests/encode-b58c-high.sh

This file was deleted.