Fix compiler warnings related to 'const'
This commit is contained in:
@@ -52,7 +52,7 @@ WSADATA wsaData;
|
||||
|
||||
struct client_state {
|
||||
int finished;
|
||||
char *message;
|
||||
const char *message;
|
||||
int has_discovered_target;
|
||||
char *target_name;
|
||||
char *target_address;
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
|
||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-inq";
|
||||
#ifndef discard_const
|
||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
||||
#endif
|
||||
|
||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-inq";
|
||||
|
||||
void inquiry_block_limits(struct scsi_inquiry_block_limits *inq)
|
||||
{
|
||||
@@ -216,7 +219,7 @@ int main(int argc, const char *argv[])
|
||||
struct iscsi_context *iscsi;
|
||||
const char **extra_argv;
|
||||
int extra_argc = 0;
|
||||
char *url = NULL;
|
||||
const char *url = NULL;
|
||||
struct iscsi_url *iscsi_url = NULL;
|
||||
int evpd = 0, pagecode = 0;
|
||||
int show_help = 0, show_usage = 0, debug = 0;
|
||||
@@ -277,8 +280,10 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||
|
||||
if (url) free(url);
|
||||
|
||||
if (url) {
|
||||
free(discard_const(url));
|
||||
}
|
||||
|
||||
if (iscsi_url == NULL) {
|
||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||
iscsi_get_error(iscsi));
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
|
||||
#ifndef discard_const
|
||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
||||
#endif
|
||||
|
||||
int showluns;
|
||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-ls";
|
||||
|
||||
@@ -312,7 +316,7 @@ int main(int argc, const char *argv[])
|
||||
struct client_state state;
|
||||
const char **extra_argv;
|
||||
int extra_argc = 0;
|
||||
char *url = NULL;
|
||||
const char *url = NULL;
|
||||
poptContext pc;
|
||||
int res;
|
||||
int show_help = 0, show_usage = 0, debug = 0;
|
||||
@@ -374,8 +378,10 @@ int main(int argc, const char *argv[])
|
||||
|
||||
iscsi_url = iscsi_parse_portal_url(iscsi, url);
|
||||
|
||||
if (url) free(url);
|
||||
|
||||
if (url) {
|
||||
free(discard_const(url));
|
||||
}
|
||||
|
||||
if (iscsi_url == NULL) {
|
||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||
iscsi_get_error(iscsi));
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
|
||||
#ifndef discard_const
|
||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
||||
#endif
|
||||
|
||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-readcapacity16";
|
||||
|
||||
void print_usage(void)
|
||||
@@ -58,7 +62,7 @@ int main(int argc, const char *argv[])
|
||||
struct iscsi_context *iscsi;
|
||||
const char **extra_argv;
|
||||
int extra_argc = 0;
|
||||
char *url = NULL;
|
||||
const char *url = NULL;
|
||||
struct iscsi_url *iscsi_url = NULL;
|
||||
int show_help = 0, show_usage = 0, debug = 0, size_only=0;
|
||||
int res;
|
||||
@@ -119,8 +123,10 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
iscsi_url = iscsi_parse_full_url(iscsi, url);
|
||||
|
||||
if (url) free(url);
|
||||
|
||||
if (url) {
|
||||
free(discard_const(url));
|
||||
}
|
||||
|
||||
if (iscsi_url == NULL) {
|
||||
fprintf(stderr, "Failed to parse URL: %s\n",
|
||||
iscsi_get_error(iscsi));
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
#include "iscsi-private.h"
|
||||
#include "iscsi-test.h"
|
||||
|
||||
#ifndef discard_const
|
||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
||||
#endif
|
||||
|
||||
const char *initiatorname1 = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test";
|
||||
const char *initiatorname2 = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test-2";
|
||||
|
||||
@@ -478,7 +482,7 @@ int main(int argc, const char *argv[])
|
||||
|
||||
free(skipname);
|
||||
free(testname);
|
||||
free(url);
|
||||
free(discard_const(url));
|
||||
|
||||
return num_failed ? num_failed : num_skipped ? 77 : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user