Bugfix: Correct signed/unsigned warnings

This commit is contained in:
Luke Dashjr
2012-09-29 10:12:18 +00:00
parent 7f153402d6
commit 071714935b
3 changed files with 7 additions and 7 deletions

View File

@@ -31,7 +31,7 @@ bool build_merkle_root(unsigned char *mrklroot_out, blktemplate_t *tmpl, unsigne
if (!dblsha256(&hashes[0], cbtxndata, cbtxndatasz))
return false;
for (int i = 0; i < tmpl->txncount; ++i)
for (unsigned long i = 0; i < tmpl->txncount; ++i)
if (!dblsha256(&hashes[32 * (i + 1)], tmpl->txns[i].data, tmpl->txns[i].datasz))
return false;
@@ -42,7 +42,7 @@ bool build_merkle_root(unsigned char *mrklroot_out, blktemplate_t *tmpl, unsigne
memcpy(&hashes[32 * hashcount], &hashes[32 * (hashcount - 1)], 32);
++hashcount;
}
for (int i = 0; i < hashcount; i += 2)
for (size_t i = 0; i < hashcount; i += 2)
// This is where we overlap input and output, on the first pair
if (!dblsha256(&hashes[i / 2 * 32], &hashes[32 * i], 64))
return false;

View File

@@ -179,7 +179,7 @@ void my_flip(void *data, size_t datasz) {
char *cdata = (char*)data;
--datasz;
size_t hds = datasz / 2;
for (int i = 0; i <= hds; ++i)
for (size_t i = 0; i <= hds; ++i)
{
int altp = datasz - i;
char c = cdata[i];
@@ -320,7 +320,7 @@ json_t *blkmk_submit_jansson(blktemplate_t *tmpl, const unsigned char *data, uns
return NULL;
if (!(tmpl->mutations & BMAb_COINBASE))
for (int i = 0; i < tmpl->txncount; ++i)
for (unsigned long i = 0; i < tmpl->txncount; ++i)
{
memcpy(&blk[offs], tmpl->txns[i].data, tmpl->txns[i].datasz);
offs += tmpl->txns[i].datasz;

View File

@@ -36,14 +36,14 @@ static const char *capnames[] = {
};
const char *blktmpl_capabilityname(gbt_capabilities_t caps) {
for (int i = 0; i < sizeof(capnames); ++i)
for (unsigned int i = 0; i < sizeof(capnames); ++i)
if (caps & (1 << i))
return capnames[i];
return NULL;
}
gbt_capabilities_t blktmpl_getcapability(const char *n) {
for (int i = 0; i < sizeof(capnames); ++i)
for (unsigned int i = 0; i < sizeof(capnames); ++i)
if (capnames[i] && !strcasecmp(n, capnames[i]))
return 1 << i;
return 0;
@@ -90,7 +90,7 @@ void blktxn_free(struct blktxn_t *bt) {
}
void blktmpl_free(blktemplate_t *tmpl) {
for (int i = 0; i < tmpl->txncount; ++i)
for (unsigned long i = 0; i < tmpl->txncount; ++i)
blktxn_free(&tmpl->txns[i]);
free(tmpl->txns);
if (tmpl->cbtxn)