Browse Source

Multiple compiler warning fixes.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
88761e6cf2
  1. 19
      cpu-miner.c
  2. 4
      findnonce.c
  3. 5
      ocl.c
  4. 2
      ocl.h
  5. 12
      util.c

19
cpu-miner.c

@ -127,7 +127,7 @@ static enum sha256_algos opt_algo = ALGO_SSE2_64; @@ -127,7 +127,7 @@ static enum sha256_algos opt_algo = ALGO_SSE2_64;
#else
static enum sha256_algos opt_algo = ALGO_C;
#endif
static int nDevs;
static unsigned int nDevs;
static int opt_n_threads = 1;
static int num_processors;
static int scan_intensity = 5;
@ -642,7 +642,7 @@ static void *miner_thread(void *userdata) @@ -642,7 +642,7 @@ static void *miner_thread(void *userdata)
/* Cpu affinity only makes sense if the number of threads is a multiple
* of the number of CPUs */
if (!(opt_n_threads % num_processors))
affine_to_cpu(mythr->id, mythr->id % num_processors);
affine_to_cpu(thr_id - nDevs, thr_id % num_processors);
while (1) {
struct work work __attribute__((aligned(128)));
@ -671,7 +671,7 @@ static void *miner_thread(void *userdata) @@ -671,7 +671,7 @@ static void *miner_thread(void *userdata)
#ifdef WANT_X8664_SSE2
case ALGO_SSE2_64: {
unsigned int rc5 =
int rc5 =
scanhash_sse2_64(thr_id, work.midstate, work.data + 64,
work.hash1, work.hash,
work.target,
@ -683,7 +683,7 @@ static void *miner_thread(void *userdata) @@ -683,7 +683,7 @@ static void *miner_thread(void *userdata)
#ifdef WANT_SSE2_4WAY
case ALGO_4WAY: {
unsigned int rc4 =
int rc4 =
ScanHash_4WaySSE2(thr_id, work.midstate, work.data + 64,
work.hash1, work.hash,
work.target,
@ -907,7 +907,7 @@ out: @@ -907,7 +907,7 @@ out:
static void restart_threads(void)
{
int i;
unsigned int i;
for (i = 0; i < opt_n_threads + nDevs; i++)
work_restart[i].restart = 1;
@ -988,7 +988,7 @@ out: @@ -988,7 +988,7 @@ out:
static void show_usage(void)
{
int i;
unsigned int i;
printf("minerd version %s\n\n", VERSION);
printf("Usage:\tminerd [options]\n\nSupported options:\n");
@ -1004,7 +1004,8 @@ static void show_usage(void) @@ -1004,7 +1004,8 @@ static void show_usage(void)
static void parse_arg (int key, char *arg)
{
int v, i;
int v;
unsigned int i;
switch(key) {
case 'a':
@ -1108,7 +1109,7 @@ static void parse_arg (int key, char *arg) @@ -1108,7 +1109,7 @@ static void parse_arg (int key, char *arg)
static void parse_config(void)
{
int i;
unsigned int i;
json_t *val;
if (!json_is_object(opt_config))
@ -1156,7 +1157,7 @@ static void parse_cmdline(int argc, char *argv[]) @@ -1156,7 +1157,7 @@ static void parse_cmdline(int argc, char *argv[])
int main (int argc, char *argv[])
{
struct thr_info *thr;
int i;
unsigned int i;
char name[32];
#ifdef WIN32

4
findnonce.c

@ -136,7 +136,7 @@ void postcalc_hash(struct thr_info *thr, dev_blk_ctx *blk, struct work *work, ui @@ -136,7 +136,7 @@ void postcalc_hash(struct thr_info *thr, dev_blk_ctx *blk, struct work *work, ui
cl_uint A, B, C, D, E, F, G, H;
cl_uint W[16];
cl_uint nonce;
cl_uint best_g = ~0;
cl_uint best_g = 0xFFFFFFFF;
uint32_t end = start + 1026;
for (nonce = start; nonce != end; nonce+=1) {
@ -183,6 +183,6 @@ void postcalc_hash(struct thr_info *thr, dev_blk_ctx *blk, struct work *work, ui @@ -183,6 +183,6 @@ void postcalc_hash(struct thr_info *thr, dev_blk_ctx *blk, struct work *work, ui
}
}
out:
if (unlikely(best_g == ~0))
if (unlikely(best_g == 0xFFFFFFFF))
applog(LOG_ERR, "No best_g found! Error in OpenCL code?");
}

5
ocl.c

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
#define _GNU_SOURCE
#include <signal.h>
#include <stdlib.h>
#include <string.h>
@ -154,7 +155,7 @@ void patch_opcodes(char *w, unsigned remaining) @@ -154,7 +155,7 @@ void patch_opcodes(char *w, unsigned remaining)
}
}
_clState *initCl(int gpu, char *name, size_t nameSize)
_clState *initCl(unsigned int gpu, char *name, size_t nameSize)
{
bool hasBitAlign = false;
cl_int status = 0;
@ -241,7 +242,7 @@ _clState *initCl(int gpu, char *name, size_t nameSize) @@ -241,7 +242,7 @@ _clState *initCl(int gpu, char *name, size_t nameSize)
printf("\t%i\t%s\n", i, pbuff);
}
if (gpu >= 0 && gpu < numDevices) {
if (gpu < numDevices) {
char pbuff[100];
status = clGetDeviceInfo(devices[gpu], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
if(status != CL_SUCCESS)

2
ocl.h

@ -16,7 +16,7 @@ typedef struct { @@ -16,7 +16,7 @@ typedef struct {
extern char *file_contents(const char *filename, int *length);
extern int clDevicesNum();
extern _clState *initCl(int gpu, char *name, size_t nameSize);
extern _clState *initCl(unsigned int gpu, char *name, size_t nameSize);
extern cl_uint preferred_vwidth;
extern size_t max_work_size;

12
util.c

@ -72,7 +72,7 @@ void applog(int prio, const char *fmt, ...) @@ -72,7 +72,7 @@ void applog(int prio, const char *fmt, ...)
else {
char *f;
int len;
struct timeval tv = { };
struct timeval tv;
struct tm tm, *tm_p;
gettimeofday(&tv, NULL);
@ -135,7 +135,7 @@ static size_t upload_data_cb(void *ptr, size_t size, size_t nmemb, @@ -135,7 +135,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;
@ -205,14 +205,14 @@ json_t *json_rpc_call(CURL *curl, const char *url, @@ -205,14 +205,14 @@ json_t *json_rpc_call(CURL *curl, const char *url,
{
json_t *val, *err_val, *res_val;
int rc;
struct data_buffer all_data = { };
struct data_buffer all_data;
struct upload_buffer upload_data;
json_error_t err = { };
json_error_t err;
struct curl_slist *headers = NULL;
char len_hdr[64], user_agent_hdr[128];
char curl_err_str[CURL_ERROR_SIZE];
long timeout = longpoll ? (60 * 60) : (60 * 10);
struct header_info hi = { };
struct header_info hi ;
bool lp_scanning = false;
/* it is assumed that 'curl' is freshly [re]initialized at this pt */
@ -323,7 +323,7 @@ err_out: @@ -323,7 +323,7 @@ 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