Browse Source

Bugfix: Correct various size mismatches

Conflicts:
	util.c
Luke Dashjr 13 years ago
parent
commit
ca34505646
4 changed files with 6 additions and 6 deletions
  1. 1 1
      elist.h
  2. 1 1
      fpgautils.c
  3. 3 3
      ocl.c
  4. 1 1
      util.c

+ 1 - 1
elist.h

@@ -181,7 +181,7 @@ static inline void list_splice_init(struct list_head *list,
  * @member:	the name of the list_struct within the struct.
  * @member:	the name of the list_struct within the struct.
  */
  */
 #define list_entry(ptr, type, member) \
 #define list_entry(ptr, type, member) \
-	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+	((type *)((char *)(ptr)-(intptr_t)(&((type *)0)->member)))
 
 
 /**
 /**
  * list_for_each	-	iterate over a list
  * list_for_each	-	iterate over a list

+ 1 - 1
fpgautils.c

@@ -527,7 +527,7 @@ int serial_open(const char *devpath, unsigned long baud, uint8_t timeout, bool p
 		PurgeComm(hSerial, PURGE_TXCLEAR);
 		PurgeComm(hSerial, PURGE_TXCLEAR);
 	}
 	}
 
 
-	return _open_osfhandle((LONG)hSerial, 0);
+	return _open_osfhandle((intptr_t)hSerial, 0);
 #else
 #else
 	int fdDev = open(devpath, O_RDWR | O_CLOEXEC | O_NOCTTY);
 	int fdDev = open(devpath, O_RDWR | O_CLOEXEC | O_NOCTTY);
 
 

+ 3 - 3
ocl.c

@@ -667,7 +667,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
 					cgpu->thread_concurrency = cgpu->shaders * 5;
 					cgpu->thread_concurrency = cgpu->shaders * 5;
 			}
 			}
 				
 				
-			applog(LOG_DEBUG, "GPU %d: selecting thread concurrency of %u",gpu,  cgpu->thread_concurrency);
+			applog(LOG_DEBUG, "GPU %u: selecting thread concurrency of %lu", gpu,  (unsigned long)cgpu->thread_concurrency);
 		} else
 		} else
 			cgpu->thread_concurrency = cgpu->opt_tc;
 			cgpu->thread_concurrency = cgpu->opt_tc;
 
 
@@ -986,10 +986,10 @@ built:
 		 * 2 greater >= required amount earlier */
 		 * 2 greater >= required amount earlier */
 		if (bufsize > cgpu->max_alloc) {
 		if (bufsize > cgpu->max_alloc) {
 			applog(LOG_WARNING, "Maximum buffer memory device %d supports says %lu", gpu, (unsigned long)cgpu->max_alloc);
 			applog(LOG_WARNING, "Maximum buffer memory device %d supports says %lu", gpu, (unsigned long)cgpu->max_alloc);
-			applog(LOG_WARNING, "Your scrypt settings come to %u", bufsize);
+			applog(LOG_WARNING, "Your scrypt settings come to %lu", (unsigned long)bufsize);
 		} else
 		} else
 			bufsize = cgpu->max_alloc;
 			bufsize = cgpu->max_alloc;
-		applog(LOG_DEBUG, "Creating scrypt buffer sized %d", bufsize);
+		applog(LOG_DEBUG, "Creating scrypt buffer sized %ld", (unsigned long)bufsize);
 		clState->padbufsize = bufsize;
 		clState->padbufsize = bufsize;
 
 
 		/* This buffer is weird and might work to some degree even if
 		/* This buffer is weird and might work to some degree even if

+ 1 - 1
util.c

@@ -378,7 +378,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
 	if (likely(global_hashrate)) {
 	if (likely(global_hashrate)) {
 		char ghashrate[255];
 		char ghashrate[255];
 
 
-		sprintf(ghashrate, "X-Mining-Hashrate: %llu", global_hashrate);
+		sprintf(ghashrate, "X-Mining-Hashrate: %"PRIu64, (uint64_t)global_hashrate);
 		headers = curl_slist_append(headers, ghashrate);
 		headers = curl_slist_append(headers, ghashrate);
 	}
 	}