1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-10 23:08:07 +00:00

Revert "Multiple compiler warning fixes."

This reverts commit a5cbfbde2610e9f60e14b41a4e0595bcb34c772a.

Broke.
This commit is contained in:
Con Kolivas 2011-06-23 21:09:22 +10:00
parent 88761e6cf2
commit 4cd5f47efa
5 changed files with 20 additions and 22 deletions

View File

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

View File

@ -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 A, B, C, D, E, F, G, H;
cl_uint W[16]; cl_uint W[16];
cl_uint nonce; cl_uint nonce;
cl_uint best_g = 0xFFFFFFFF; cl_uint best_g = ~0;
uint32_t end = start + 1026; uint32_t end = start + 1026;
for (nonce = start; nonce != end; nonce+=1) { 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
} }
} }
out: out:
if (unlikely(best_g == 0xFFFFFFFF)) if (unlikely(best_g == ~0))
applog(LOG_ERR, "No best_g found! Error in OpenCL code?"); applog(LOG_ERR, "No best_g found! Error in OpenCL code?");
} }

5
ocl.c
View File

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

2
ocl.h
View File

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

12
util.c
View File

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