Browse Source

Merge pull request #187 from Bllacky/patch-5

Reduce the number of warnings by about 5 (Update sgminer.c)
refactor
Noel Maersk 11 years ago
parent
commit
b457461eb7
  1. 13
      sgminer.c

13
sgminer.c

@ -888,7 +888,8 @@ static char *set_pool_state(char *arg)
static char *set_quota(char *arg) static char *set_quota(char *arg)
{ {
char *semicolon = strchr(arg, ';'), *url; char *semicolon = strchr(arg, ';'), *url;
int len, qlen, quota; size_t len, qlen;
int quota;
struct pool *pool; struct pool *pool;
if (!semicolon) if (!semicolon)
@ -1507,7 +1508,7 @@ static char *parse_config(json_t *config, bool fileconf, int parent_iteration)
err = opt->cb_arg(json_string_value(val), err = opt->cb_arg(json_string_value(val),
opt->u.arg); opt->u.arg);
} else if ((opt->type & OPT_HASARG) && json_is_array(val)) { } else if ((opt->type & OPT_HASARG) && json_is_array(val)) {
int n, size = json_array_size(val); size_t n, size = json_array_size(val);
for (n = 0; n < size && !err; n++) { for (n = 0; n < size && !err; n++) {
if (json_is_string(json_array_get(val, n))) if (json_is_string(json_array_get(val, n)))
@ -1753,7 +1754,7 @@ static bool __build_gbt_txns(struct pool *pool, json_t *res_val)
for (i = 0; i < pool->gbt_txns; i++) { for (i = 0; i < pool->gbt_txns; i++) {
json_t *txn_val = json_object_get(json_array_get(txn_array, i), "data"); json_t *txn_val = json_object_get(json_array_get(txn_array, i), "data");
const char *txn = json_string_value(txn_val); const char *txn = json_string_value(txn_val);
int txn_len = strlen(txn); size_t txn_len = strlen(txn);
unsigned char *txn_bin; unsigned char *txn_bin;
cal_len = txn_len; cal_len = txn_len;
@ -1913,7 +1914,7 @@ static bool gbt_decode(struct pool *pool, json_t *res_val)
bool submitold; bool submitold;
const char *bits; const char *bits;
const char *workid; const char *workid;
int cbt_len, orig_len; size_t cbt_len, orig_len;
uint8_t *extra_len; uint8_t *extra_len;
size_t cal_len; size_t cal_len;
@ -2180,7 +2181,7 @@ static void suffix_string(uint64_t val, char *buf, size_t bufsiz, int sigdigits)
} else { } else {
/* Always show sigdigits + 1, padded on right with zeroes /* Always show sigdigits + 1, padded on right with zeroes
* followed by suffix */ * followed by suffix */
int ndigits = sigdigits - 1 - (dval > 0.0 ? floor(log10(dval)) : 0); double ndigits = sigdigits - 1 - (dval > 0.0 ? floor(log10(dval)) : 0);
snprintf(buf, bufsiz, "%*.*f%s", sigdigits + 1, ndigits, dval, suffix); snprintf(buf, bufsiz, "%*.*f%s", sigdigits + 1, ndigits, dval, suffix);
} }
@ -2686,7 +2687,7 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
{ {
char *hexstr = NULL; char *hexstr = NULL;
json_t *val, *res, *err; json_t *val, *res, *err;
char *s; // char *s;
bool rc = false; bool rc = false;
int thr_id = work->thr_id; int thr_id = work->thr_id;
struct cgpu_info *cgpu; struct cgpu_info *cgpu;

Loading…
Cancel
Save