Browse Source

Fix harmless warnings with -Wsign-compare to allow cgminer to build with -W.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
56907db2d6
  1. 3
      bitforce.c
  2. 12
      cgminer.c
  3. 4
      device-gpu.c
  4. 4
      ocl.c
  5. 5
      util.c

3
bitforce.c

@ -61,9 +61,10 @@ static void BFgets(char *buf, size_t bufLen, int fd) @@ -61,9 +61,10 @@ static void BFgets(char *buf, size_t bufLen, int fd)
buf[0] = '\0';
}
static void BFwrite(int fd, const void *buf, size_t bufLen)
static void BFwrite(int fd, const void *buf, ssize_t bufLen)
{
ssize_t ret = write(fd, buf, bufLen);
if (unlikely(ret != bufLen))
quit(1, "BFwrite failed");
}

12
cgminer.c

@ -410,6 +410,7 @@ static char *add_serial(char *arg) @@ -410,6 +410,7 @@ static char *add_serial(char *arg)
static char *set_devices(char *arg)
{
int i = strtol(arg, &arg, 0);
if (*arg) {
if (*arg == '?') {
devices_enabled = -1;
@ -418,7 +419,7 @@ static char *set_devices(char *arg) @@ -418,7 +419,7 @@ static char *set_devices(char *arg)
return "Invalid device number";
}
if (i < 0 || i >= (sizeof(devices_enabled) * 8) - 1)
if (i < 0 || i >= (int)(sizeof(devices_enabled) * 8) - 1)
return "Invalid device number";
devices_enabled |= 1 << i;
return NULL;
@ -1660,7 +1661,7 @@ static void print_summary(void); @@ -1660,7 +1661,7 @@ static void print_summary(void);
void kill_work(void)
{
struct thr_info *thr;
unsigned int i;
int i;
disable_curses();
applog(LOG_INFO, "Received kill message");
@ -3255,7 +3256,7 @@ void *miner_thread(void *userdata) @@ -3255,7 +3256,7 @@ void *miner_thread(void *userdata)
/* Try to cycle approximately 5 times before each log update */
const unsigned long def_cycle = opt_log_interval / 5 ? : 1;
unsigned long cycle;
long cycle;
struct timeval tv_start, tv_end, tv_workstart, tv_lastupdate;
struct timeval diff, sdiff, wdiff;
uint32_t max_nonce = api->can_limit_work ? api->can_limit_work(mythr) : 0xffffffff;
@ -4104,7 +4105,8 @@ int main (int argc, char *argv[]) @@ -4104,7 +4105,8 @@ int main (int argc, char *argv[])
bool pools_active = false;
struct sigaction handler;
struct thr_info *thr;
unsigned int i, j, k;
unsigned int k;
int i, j;
/* This dangerous functions tramples random dynamically allocated
* variables so do it before anything at all */
@ -4243,7 +4245,7 @@ int main (int argc, char *argv[]) @@ -4243,7 +4245,7 @@ int main (int argc, char *argv[])
mining_threads = 0;
gpu_threads = 0;
if (devices_enabled) {
for (i = 0; i < (sizeof(devices_enabled) * 8) - 1; ++i) {
for (i = 0; i < (int)(sizeof(devices_enabled) * 8) - 1; ++i) {
if (devices_enabled & (1 << i)) {
if (i >= total_devices)
quit (1, "Command line options set a device that doesn't exist");

4
device-gpu.c

@ -689,8 +689,8 @@ static cl_int queue_phatk_kernel(_clState *clState, dev_blk_ctx *blk) @@ -689,8 +689,8 @@ static cl_int queue_phatk_kernel(_clState *clState, dev_blk_ctx *blk)
{
cl_uint vwidth = clState->preferred_vwidth;
cl_kernel *kernel = &clState->kernel;
unsigned int i, num = 0;
cl_int status = 0;
int i, num = 0;
uint *nonces;
CL_SET_BLKARG(ctx_a);
@ -732,8 +732,8 @@ static cl_int queue_diakgcn_kernel(_clState *clState, dev_blk_ctx *blk) @@ -732,8 +732,8 @@ static cl_int queue_diakgcn_kernel(_clState *clState, dev_blk_ctx *blk)
{
cl_uint vwidth = clState->preferred_vwidth;
cl_kernel *kernel = &clState->kernel;
unsigned int i, num = 0;
cl_int status = 0;
int i, num = 0;
uint *nonces;
nonces = alloca(sizeof(uint) * vwidth);

4
ocl.c

@ -206,7 +206,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -206,7 +206,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
return NULL;
}
if (opt_platform_id >= numPlatforms) {
if (opt_platform_id >= (int)numPlatforms) {
applog(LOG_ERR, "Specified platform that does not exist");
return NULL;
}
@ -340,7 +340,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -340,7 +340,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
if (opt_vectors)
clState->preferred_vwidth = opt_vectors;
if (opt_worksize && opt_worksize <= clState->max_work_size)
if (opt_worksize && opt_worksize <= (int)clState->max_work_size)
clState->work_size = opt_worksize;
else
clState->work_size = (clState->max_work_size <= 256 ? clState->max_work_size : 256) /

5
util.c

@ -104,7 +104,7 @@ static size_t upload_data_cb(void *ptr, size_t size, size_t nmemb, @@ -104,7 +104,7 @@ static size_t upload_data_cb(void *ptr, size_t size, size_t nmemb,
void *user_data)
{
struct upload_buffer *ub = user_data;
int len = size * nmemb;
unsigned int len = size * nmemb;
if (len > ub->len)
len = ub->len;
@ -429,8 +429,9 @@ err_out: @@ -429,8 +429,9 @@ err_out:
char *bin2hex(const unsigned char *p, size_t len)
{
int i;
unsigned int i;
char *s = malloc((len * 2) + 1);
if (!s)
return NULL;

Loading…
Cancel
Save