Browse Source

Bugfix: Use const qualifier in cgpu_info and device_api structures where applicable, to clean up some warnings

Luke Dashjr 14 years ago
parent
commit
31fc657eb4
3 changed files with 8 additions and 8 deletions
  1. 1 1
      cgminer.c
  2. 1 1
      driver-icarus.c
  3. 6 6
      miner.h

+ 1 - 1
cgminer.c

@@ -3641,7 +3641,7 @@ void *miner_thread(void *userdata)
 	struct thr_info *mythr = userdata;
 	const int thr_id = mythr->id;
 	struct cgpu_info *cgpu = mythr->cgpu;
-	struct device_api *api = cgpu->api;
+	const struct device_api *api = cgpu->api;
 
 	/* Try to cycle approximately 5 times before each log update */
 	const unsigned long def_cycle = opt_log_interval / 5 ? : 1;

+ 1 - 1
driver-icarus.c

@@ -396,7 +396,7 @@ static void icarus_shutdown(struct thr_info *thr)
 		icarus = thr->cgpu;
 
 		if (icarus->device_path)
-			free(icarus->device_path);
+			free((void*)icarus->device_path);
 
 		close(icarus->device_fd);
 

+ 6 - 6
miner.h

@@ -195,8 +195,8 @@ struct thr_info;
 struct work;
 
 struct device_api {
-	char*dname;
-	char*name;
+	const char*dname;
+	const char*name;
 
 	// API-global functions
 	void (*api_detect)();
@@ -254,10 +254,10 @@ enum dev_reason {
 
 struct cgpu_info {
 	int cgminer_id;
-	struct device_api *api;
+	const struct device_api *api;
 	int device_id;
-	char *name;
-	char *device_path;
+	const char *name;
+	const char *device_path;
 	FILE *device_file;
 	union {
 #ifdef USE_ZTEX
@@ -287,7 +287,7 @@ struct cgpu_info {
 	int virtual_adl;
 	int intensity;
 	bool dynamic;
-	char *kname;
+	const char *kname;
 #ifdef HAVE_OPENCL
 	cl_uint vwidth;
 	size_t work_size;