From 9a97f0cf6ee422e235e80e088d83714488f58200 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Tue, 25 Nov 2014 18:21:15 +0100 Subject: [PATCH] api: fix size_t printf exception in vstudio --- api.cpp | 4 ++-- ccminer.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api.cpp b/api.cpp index a9bf8d5..26a6829 100644 --- a/api.cpp +++ b/api.cpp @@ -232,10 +232,10 @@ static char *getpoolnfo(char *params) cbin2hex(nonce, (const char*) stratum.job.xnonce2, stratum.xnonce2_size); } - sprintf(p, "URL=%s;USER=%s;H=%u;JOB=%s;DIFF=%.6f;N2SZ=%zd;N2=0x%s;PING=%u;DISCO=%u;UPTIME=%u|", + snprintf(p, MYBUFSIZ, "URL=%s;USER=%s;H=%u;JOB=%s;DIFF=%.6f;N2SZ=%d;N2=0x%s;PING=%u;DISCO=%u;UPTIME=%u|", stratum.url, rpc_user ? rpc_user : "", stratum.job.height, jobid, stratum.job.diff, - stratum.xnonce2_size, nonce, stratum.answer_msec, + (int) stratum.xnonce2_size, nonce, stratum.answer_msec, stratum.disconnects, (uint32_t) (time(NULL) - stratum.tm_connected)); return p; diff --git a/ccminer.cpp b/ccminer.cpp index 5fe114f..0b165ac 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -1528,7 +1528,7 @@ static bool stratum_handle_response(char *buf) gettimeofday(&tv_answer, NULL); timeval_subtract(&diff, &tv_answer, &stratum.tv_submit); // store time required to the pool to answer to a submit - stratum.answer_msec = (1000.0 * diff.tv_sec) + (uint32_t) (0.001 * diff.tv_usec); + stratum.answer_msec = (1000 * diff.tv_sec) + (uint32_t) (0.001 * diff.tv_usec); share_result(json_is_true(res_val), err_val ? json_string_value(json_array_get(err_val, 1)) : NULL);