diff --git a/cstool/cstool.c b/cstool/cstool.c index cd3483ec3b..65ad945d2f 100644 --- a/cstool/cstool.c +++ b/cstool/cstool.c @@ -74,7 +74,7 @@ void print_insn_detail_evm(csh handle, cs_insn *ins); static void print_details(csh handle, cs_arch arch, cs_mode md, cs_insn *ins); -void print_string_hex(char *comment, unsigned char *str, size_t len) +void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; diff --git a/cstool/cstool_evm.c b/cstool/cstool_evm.c index 18b319204c..692a3f0a13 100644 --- a/cstool/cstool_evm.c +++ b/cstool/cstool_evm.c @@ -8,7 +8,6 @@ void print_string_hex(char *comment, unsigned char *str, size_t len); void print_insn_detail_evm(csh handle, cs_insn *ins) { cs_evm *evm; - int i; // detail can be NULL on "data" instruction if SKIPDATA option is turned ON if (ins->detail == NULL) diff --git a/cstool/cstool_m680x.c b/cstool/cstool_m680x.c index 841305157d..4a9a5192a0 100644 --- a/cstool/cstool_m680x.c +++ b/cstool/cstool_m680x.c @@ -60,7 +60,7 @@ void print_insn_detail_m680x(csh handle, cs_insn *insn) for (i = 0; i < m680x->op_count; i++) { cs_m680x_op *op = &(m680x->operands[i]); - char *comment; + const char *comment; switch ((int)op->type) { default: @@ -131,9 +131,9 @@ void print_insn_detail_m680x(csh handle, cs_insn *insn) } if (op->idx.inc_dec) { - char *post_pre = op->idx.flags & + const char *post_pre = op->idx.flags & M680X_IDX_POST_INC_DEC ? "post" : "pre"; - char *inc_dec = (op->idx.inc_dec > 0) ? + const char *inc_dec = (op->idx.inc_dec > 0) ? "increment" : "decrement"; printf("\t\t\t%s %s: %d\n", post_pre, inc_dec, diff --git a/cstool/cstool_tms320c64x.c b/cstool/cstool_tms320c64x.c index 882a6a520f..daede36ab1 100644 --- a/cstool/cstool_tms320c64x.c +++ b/cstool/cstool_tms320c64x.c @@ -4,7 +4,7 @@ #include #include -void print_string_hex(char *comment, unsigned char *str, size_t len); +void print_string_hex(const char *comment, unsigned char *str, size_t len); void print_insn_detail_tms320c64x(csh handle, cs_insn *ins) { diff --git a/cstool/cstool_x86.c b/cstool/cstool_x86.c index f5d2bab9ef..ff3be36fb6 100644 --- a/cstool/cstool_x86.c +++ b/cstool/cstool_x86.c @@ -5,9 +5,9 @@ #include -void print_string_hex(char *comment, unsigned char *str, size_t len); +void print_string_hex(const char *comment, unsigned char *str, size_t len); -static char *get_eflag_name(uint64_t flag) +static const char *get_eflag_name(uint64_t flag) { switch(flag) { default: @@ -129,7 +129,7 @@ static char *get_eflag_name(uint64_t flag) } } -static char *get_fpu_flag_name(uint64_t flag) +static const char *get_fpu_flag_name(uint64_t flag) { switch (flag) { default: diff --git a/cstool/getopt.h b/cstool/getopt.h index 210ac9f4e8..81af41059b 100644 --- a/cstool/getopt.h +++ b/cstool/getopt.h @@ -6,7 +6,7 @@ int opterr = 1, /* if error message should be printed */ optind = 1, /* index into parent argv vector */ optopt, /* character checked for validity */ optreset; /* reset getopt */ -char *optarg; /* argument associated with option */ +const char *optarg; /* argument associated with option */ #define BADCH (int)'?' #define BADARG (int)':' @@ -19,7 +19,7 @@ char *optarg; /* argument associated with option */ int getopt (int nargc, char * const nargv[], const char *ostr) { - static char *place = EMSG; /* option letter processing */ + static const char *place = EMSG; /* option letter processing */ const char *oli; /* option letter list index */ if (optreset || !*place) { /* update scanning pointer */ diff --git a/tests/test_arm.c b/tests/test_arm.c index d021dff847..eedcc98e44 100644 --- a/tests/test_arm.c +++ b/tests/test_arm.c @@ -14,11 +14,11 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; int syntax; }; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; diff --git a/tests/test_arm64.c b/tests/test_arm64.c index fc8f7e68de..951f7d2a20 100644 --- a/tests/test_arm64.c +++ b/tests/test_arm64.c @@ -14,10 +14,10 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; }; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; diff --git a/tests/test_basic.c b/tests/test_basic.c index 56dbd2f430..22ea2e41ba 100644 --- a/tests/test_basic.c +++ b/tests/test_basic.c @@ -12,7 +12,7 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; cs_opt_type opt_type; cs_opt_value opt_value; }; @@ -91,7 +91,7 @@ static void test() cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; cs_opt_type opt_type; cs_opt_value opt_value; }; diff --git a/tests/test_detail.c b/tests/test_detail.c index 48af3b9799..c4c61dd522 100644 --- a/tests/test_detail.c +++ b/tests/test_detail.c @@ -12,7 +12,7 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; cs_opt_type opt_type; cs_opt_value opt_value; }; diff --git a/tests/test_evm.c b/tests/test_evm.c index 1d1d88a82e..1b21f27ee8 100644 --- a/tests/test_evm.c +++ b/tests/test_evm.c @@ -14,10 +14,10 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; }; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; diff --git a/tests/test_iter.c b/tests/test_iter.c index 6c9169b73d..5ad9d3e9c8 100644 --- a/tests/test_iter.c +++ b/tests/test_iter.c @@ -13,7 +13,7 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; cs_opt_type opt_type; cs_opt_value opt_value; }; diff --git a/tests/test_m680x.c b/tests/test_m680x.c index 708bcdfcda..666161c55f 100644 --- a/tests/test_m680x.c +++ b/tests/test_m680x.c @@ -16,10 +16,10 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; }; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; @@ -85,7 +85,7 @@ static void print_insn_detail(csh handle, cs_insn *insn) for (i = 0; i < m680x->op_count; i++) { cs_m680x_op *op = &(m680x->operands[i]); - char *comment; + const char *comment; switch ((int)op->type) { default: @@ -157,9 +157,9 @@ static void print_insn_detail(csh handle, cs_insn *insn) } if (op->idx.inc_dec) { - char *post_pre = op->idx.flags & + const char *post_pre = op->idx.flags & M680X_IDX_POST_INC_DEC ? "post" : "pre"; - char *inc_dec = (op->idx.inc_dec > 0) ? + const char *inc_dec = (op->idx.inc_dec > 0) ? "increment" : "decrement"; printf("\t\t\t%s %s: %d\n", post_pre, inc_dec, @@ -328,7 +328,7 @@ static void test() cs_insn *insn; int i; size_t count; - char *nine_spaces = " "; + const char *nine_spaces = " "; if (!consistency_checks()) abort(); diff --git a/tests/test_m68k.c b/tests/test_m68k.c index cc5f786403..62b05be0c5 100644 --- a/tests/test_m68k.c +++ b/tests/test_m68k.c @@ -11,12 +11,12 @@ struct platform { cs_mode mode; unsigned char* code; size_t size; - char* comment; + const char* comment; }; static csh handle; -static void print_string_hex(char* comment, unsigned char* str, size_t len) +static void print_string_hex(const char* comment, unsigned char* str, size_t len) { unsigned char *c; diff --git a/tests/test_mips.c b/tests/test_mips.c index d3864bd35b..5645a48bc2 100644 --- a/tests/test_mips.c +++ b/tests/test_mips.c @@ -12,12 +12,12 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; }; static csh handle; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; diff --git a/tests/test_ppc.c b/tests/test_ppc.c index 0ad5de383f..f0eceea7c2 100644 --- a/tests/test_ppc.c +++ b/tests/test_ppc.c @@ -11,12 +11,12 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; }; static csh handle; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; diff --git a/tests/test_skipdata.c b/tests/test_skipdata.c index 5217210f40..e27798b3c4 100644 --- a/tests/test_skipdata.c +++ b/tests/test_skipdata.c @@ -12,7 +12,7 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; cs_opt_type opt_type; cs_opt_value opt_value; cs_opt_type opt_skipdata; diff --git a/tests/test_sparc.c b/tests/test_sparc.c index 122829a50c..369e077763 100644 --- a/tests/test_sparc.c +++ b/tests/test_sparc.c @@ -11,12 +11,12 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; }; static csh handle; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; diff --git a/tests/test_systemz.c b/tests/test_systemz.c index ec1af9dd35..6bdcc6f4db 100644 --- a/tests/test_systemz.c +++ b/tests/test_systemz.c @@ -11,12 +11,12 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; }; static csh handle; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; diff --git a/tests/test_tms320c64x.c b/tests/test_tms320c64x.c index 3dee537e02..86a6d76d78 100644 --- a/tests/test_tms320c64x.c +++ b/tests/test_tms320c64x.c @@ -10,12 +10,12 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; }; static csh handle; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; diff --git a/tests/test_x86.c b/tests/test_x86.c index 1fa1b136f4..ebabf1843b 100644 --- a/tests/test_x86.c +++ b/tests/test_x86.c @@ -14,12 +14,12 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; cs_opt_type opt_type; cs_opt_value opt_value; }; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c; @@ -31,7 +31,7 @@ static void print_string_hex(char *comment, unsigned char *str, size_t len) printf("\n"); } -static char *get_eflag_name(uint64_t flag) +static const char *get_eflag_name(uint64_t flag) { switch(flag) { default: diff --git a/tests/test_xcore.c b/tests/test_xcore.c index b382ef6b47..12cc1f1bba 100644 --- a/tests/test_xcore.c +++ b/tests/test_xcore.c @@ -11,12 +11,12 @@ struct platform { cs_mode mode; unsigned char *code; size_t size; - char *comment; + const char *comment; }; static csh handle; -static void print_string_hex(char *comment, unsigned char *str, size_t len) +static void print_string_hex(const char *comment, unsigned char *str, size_t len) { unsigned char *c;