Browse Source

Merge branch 'bugfix_format' into bfgminer

Conflicts:
	libztex.c
	miner.c
Luke Dashjr 13 years ago
parent
commit
ae96559e15
6 changed files with 22 additions and 21 deletions
  1. 3 3
      api.c
  2. 4 4
      driver-icarus.c
  3. 1 1
      ft232r.c
  4. 1 1
      libztex.c
  5. 7 7
      miner.c
  6. 6 5
      ocl.c

+ 3 - 3
api.c

@@ -1114,9 +1114,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
 				sprintf(buf, "%s", *((bool *)(root->data)) ? TRUESTR : FALSESTR);
 				sprintf(buf, "%s", *((bool *)(root->data)) ? TRUESTR : FALSESTR);
 				break;
 				break;
 			case API_TIMEVAL:
 			case API_TIMEVAL:
-				sprintf(buf, "%ld.%06ld",
-					((struct timeval *)(root->data))->tv_sec,
-					((struct timeval *)(root->data))->tv_usec);
+				sprintf(buf, "%"PRIu64".%06lu",
+					(uint64_t)((struct timeval *)(root->data))->tv_sec,
+					(unsigned long)((struct timeval *)(root->data))->tv_usec);
 				break;
 				break;
 			case API_TEMP:
 			case API_TEMP:
 				sprintf(buf, "%.2f", *((float *)(root->data)));
 				sprintf(buf, "%.2f", *((float *)(root->data)));

+ 4 - 4
driver-icarus.c

@@ -880,11 +880,11 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 			estimate_hashes = 0xffffffff;
 			estimate_hashes = 0xffffffff;
 
 
 		if (opt_debug) {
 		if (opt_debug) {
-			applog(LOG_DEBUG, "%s %u no nonce = 0x%08" PRIx64 " hashes (%ld.%06lds)",
+			applog(LOG_DEBUG, "%s %u no nonce = 0x%08"PRIx64" hashes (%"PRId64".%06lus)",
 					icarus->api->name,
 					icarus->api->name,
 					icarus->device_id,
 					icarus->device_id,
 					(uint64_t)estimate_hashes,
 					(uint64_t)estimate_hashes,
-					elapsed.tv_sec, elapsed.tv_usec);
+					(int64_t)elapsed.tv_sec, (unsigned long)elapsed.tv_usec);
 		}
 		}
 
 
 		return estimate_hashes;
 		return estimate_hashes;
@@ -910,12 +910,12 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
 	hash_count *= info->fpga_count;
 	hash_count *= info->fpga_count;
 
 
 	if (opt_debug) {
 	if (opt_debug) {
-		applog(LOG_DEBUG, "%s %u nonce = 0x%08x = 0x%08" PRIx64 " hashes (%ld.%06lds)",
+		applog(LOG_DEBUG, "%s %u nonce = 0x%08x = 0x%08" PRIx64 " hashes (%"PRId64".%06lus)",
 				icarus->api->name,
 				icarus->api->name,
 				icarus->device_id,
 				icarus->device_id,
 				nonce,
 				nonce,
 				(uint64_t)hash_count,
 				(uint64_t)hash_count,
-				elapsed.tv_sec, elapsed.tv_usec);
+				(int64_t)elapsed.tv_sec, (unsigned long)elapsed.tv_usec);
 	}
 	}
 
 
 	if (info->do_default_detection && elapsed.tv_sec >= DEFAULT_DETECT_THRESHOLD) {
 	if (info->do_default_detection && elapsed.tv_sec >= DEFAULT_DETECT_THRESHOLD) {

+ 1 - 1
ft232r.c

@@ -358,7 +358,7 @@ ssize_t ft232r_read(struct ft232r_device_handle *dev, void *data, size_t count)
 	ibufsLen -= count;
 	ibufsLen -= count;
 	if (ibufsLen) {
 	if (ibufsLen) {
 		memmove(ibufs, &ibufs[count], ibufsLen);
 		memmove(ibufs, &ibufs[count], ibufsLen);
-		applog(LOG_DEBUG, "ft232r_read: %u bytes extra", ibufsLen);
+		applog(LOG_DEBUG, "ft232r_read: %"PRIu64" bytes extra", (uint64_t)ibufsLen);
 	}
 	}
 	return count;
 	return count;
 }
 }

+ 1 - 1
libztex.c

@@ -736,7 +736,7 @@ int libztex_scanDevices(struct libztex_dev_list*** devs_p)
 	do {
 	do {
 		cnt = libusb_get_device_list(NULL, &list);
 		cnt = libusb_get_device_list(NULL, &list);
 		if (unlikely(cnt < 0)) {
 		if (unlikely(cnt < 0)) {
-			applog(LOG_ERR, "Ztex scan devices: Failed to list usb devices with err %d", cnt);
+			applog(LOG_ERR, "Ztex scan devices: Failed to list usb devices with err %"PRId64, (int64_t)cnt);
 			goto done;
 			goto done;
 		}
 		}
 
 

+ 7 - 7
miner.c

@@ -1723,7 +1723,7 @@ static bool work_decode(struct pool *pool, struct work *work, json_t *val)
 			static bool appenderr = false;
 			static bool appenderr = false;
 			if (ae <= 0) {
 			if (ae <= 0) {
 				if (opt_coinbase_sig) {
 				if (opt_coinbase_sig) {
-					applog((appenderr ? LOG_DEBUG : LOG_WARNING), "Cannot append coinbase signature at all on pool %u (%d)", pool->pool_no, ae);
+					applog((appenderr ? LOG_DEBUG : LOG_WARNING), "Cannot append coinbase signature at all on pool %u (%"PRId64")", pool->pool_no, (int64_t)ae);
 					appenderr = true;
 					appenderr = true;
 				}
 				}
 			} else if (ae >= 3 || opt_coinbase_sig) {
 			} else if (ae >= 3 || opt_coinbase_sig) {
@@ -1748,14 +1748,14 @@ static bool work_decode(struct pool *pool, struct work *work, json_t *val)
 					memcpy(tmp, opt_coinbase_sig, ae);
 					memcpy(tmp, opt_coinbase_sig, ae);
 					tmp[ae] = '\0';
 					tmp[ae] = '\0';
 					applog((truncatewarning ? LOG_DEBUG : LOG_WARNING),
 					applog((truncatewarning ? LOG_DEBUG : LOG_WARNING),
-					       "Pool %u truncating appended coinbase signature at %d bytes: %s(%s)",
-					       pool->pool_no, ae, tmp, &opt_coinbase_sig[ae]);
+					       "Pool %u truncating appended coinbase signature at %"PRId64" bytes: %s(%s)",
+					       pool->pool_no, (int64_t)ae, tmp, &opt_coinbase_sig[ae]);
 					free(tmp);
 					free(tmp);
 					truncatewarning = true;
 					truncatewarning = true;
 				}
 				}
 				ae = blkmk_append_coinbase_safe(work->tmpl, cbappend, ae);
 				ae = blkmk_append_coinbase_safe(work->tmpl, cbappend, ae);
 				if (ae <= 0) {
 				if (ae <= 0) {
-					applog((appenderr ? LOG_DEBUG : LOG_WARNING), "Error appending coinbase signature (%d)", ae);
+					applog((appenderr ? LOG_DEBUG : LOG_WARNING), "Error appending coinbase signature (%"PRId64")", (int64_t)ae);
 					appenderr = true;
 					appenderr = true;
 				} else
 				} else
 					appenderr = false;
 					appenderr = false;
@@ -5489,10 +5489,10 @@ bool parse_stratum_response(struct pool *pool, char *s)
 		 && json_is_array(res_val)) {
 		 && json_is_array(res_val)) {
 			// Check that the transactions actually hash to the merkle links
 			// Check that the transactions actually hash to the merkle links
 			{
 			{
-				size_t maxtx = 1 << pool->swork.merkles;
-				size_t mintx = maxtx >> 1;
+				unsigned maxtx = 1 << pool->swork.merkles;
+				unsigned mintx = maxtx >> 1;
 				--maxtx;
 				--maxtx;
-				size_t acttx = json_array_size(res_val);
+				unsigned acttx = (unsigned)json_array_size(res_val);
 				if (acttx < mintx || acttx > maxtx) {
 				if (acttx < mintx || acttx > maxtx) {
 					applog(LOG_WARNING, "Pool %u is sending mismatched block contents to us (%u is not %u-%u)",
 					applog(LOG_WARNING, "Pool %u is sending mismatched block contents to us (%u is not %u-%u)",
 					       pool->pool_no, acttx, mintx, maxtx);
 					       pool->pool_no, acttx, mintx, maxtx);

+ 6 - 5
ocl.c

@@ -539,7 +539,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
 		applog(LOG_ERR, "Error %d: Failed to clGetDeviceInfo when trying to get CL_DEVICE_MAX_WORK_GROUP_SIZE", status);
 		applog(LOG_ERR, "Error %d: Failed to clGetDeviceInfo when trying to get CL_DEVICE_MAX_WORK_GROUP_SIZE", status);
 		return NULL;
 		return NULL;
 	}
 	}
-	applog(LOG_DEBUG, "Max work group size reported %d", clState->max_work_size);
+	applog(LOG_DEBUG, "Max work group size reported %"PRId64, (int64_t)clState->max_work_size);
 
 
 	status = clGetDeviceInfo(devices[gpu], CL_DEVICE_MAX_MEM_ALLOC_SIZE , sizeof(cl_ulong), (void *)&cgpu->max_alloc, NULL);
 	status = clGetDeviceInfo(devices[gpu], CL_DEVICE_MAX_MEM_ALLOC_SIZE , sizeof(cl_ulong), (void *)&cgpu->max_alloc, NULL);
 	if (status != CL_SUCCESS) {
 	if (status != CL_SUCCESS) {
@@ -795,7 +795,7 @@ build:
 		sprintf(CompilerOptions, "-D WORKSIZE=%d -D VECTORS%d -D WORKVEC=%d",
 		sprintf(CompilerOptions, "-D WORKSIZE=%d -D VECTORS%d -D WORKVEC=%d",
 			(int)clState->wsize, clState->vwidth, (int)clState->wsize * clState->vwidth);
 			(int)clState->wsize, clState->vwidth, (int)clState->wsize * clState->vwidth);
 	}
 	}
-	applog(LOG_DEBUG, "Setting worksize to %d", clState->wsize);
+	applog(LOG_DEBUG, "Setting worksize to %"PRId64, (int64_t)clState->wsize);
 	if (clState->vwidth > 1)
 	if (clState->vwidth > 1)
 		applog(LOG_DEBUG, "Patched source to suit %d vectors", clState->vwidth);
 		applog(LOG_DEBUG, "Patched source to suit %d vectors", clState->vwidth);
 
 
@@ -868,7 +868,8 @@ build:
 			break;
 			break;
 
 
 	/* copy over all of the generated binaries. */
 	/* copy over all of the generated binaries. */
-	applog(LOG_DEBUG, "Binary size for gpu %d found in binary slot %d: %d", gpu, slot, binary_sizes[slot]);
+	applog(LOG_DEBUG, "Binary size for gpu %u found in binary slot %u: %"PRId64,
+	       gpu, (unsigned)slot, (int64_t)binary_sizes[slot]);
 	if (!binary_sizes[slot]) {
 	if (!binary_sizes[slot]) {
 		applog(LOG_ERR, "OpenCL compiler generated a zero sized binary, FAIL!");
 		applog(LOG_ERR, "OpenCL compiler generated a zero sized binary, FAIL!");
 		return NULL;
 		return NULL;
@@ -950,8 +951,8 @@ built:
 	free(binaries);
 	free(binaries);
 	free(binary_sizes);
 	free(binary_sizes);
 
 
-	applog(LOG_INFO, "Initialising kernel %s with%s bitalign, %d vectors and worksize %d",
-	       filename, clState->hasBitAlign ? "" : "out", clState->vwidth, clState->wsize);
+	applog(LOG_INFO, "Initialising kernel %s with%s bitalign, %"PRId64" vectors and worksize %"PRIu64,
+	       filename, clState->hasBitAlign ? "" : "out", (int64_t)clState->vwidth, (uint64_t)clState->wsize);
 
 
 	if (!prog_built) {
 	if (!prog_built) {
 		/* create a cl program executable for all the devices specified */
 		/* create a cl program executable for all the devices specified */