From: Klas Lindfors Date: Mon, 3 Mar 2014 10:00:43 +0000 (+0100) Subject: constify to get rid of more warnings X-Git-Tag: v1.15.1~18 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76e2f16955562981f0f55cb4138db6f69976ef14;p=yubikey-personalization constify to get rid of more warnings --- diff --git a/tests/test_args_to_config.c b/tests/test_args_to_config.c index afc5c03..5c6b78e 100644 --- a/tests/test_args_to_config.c +++ b/tests/test_args_to_config.c @@ -54,7 +54,7 @@ struct ykp_config_t { struct config_st *ykcore_config; }; -void _yktest_hexdump(char *prefix, void *buffer, int size, int break_on) +void _yktest_hexdump(const char *prefix, const void *buffer, int size, int break_on) { unsigned char *p = buffer; int i; @@ -99,7 +99,7 @@ void _check_success(int rc, YKP_CONFIG *cfg, unsigned char expected[], int calle assert(config_matches_expected == true); } -int _test_config (YKP_CONFIG *cfg, YK_STATUS *st, int argc, char **argv) +int _test_config (YKP_CONFIG *cfg, YK_STATUS *st, int argc, const char **argv) { const char *infname = NULL; const char *outfname = NULL; @@ -170,7 +170,7 @@ YK_STATUS * _test_init_st(int major, int minor, int build) * Utility function to parse arguments and just return the result code. * The calling function does the assert() to get function name in assert output. */ -int _parse_args_rc(int argc, char *argv[]) +int _parse_args_rc(int argc, const char *argv[]) { YKP_CONFIG *cfg = ykp_alloc(); YK_STATUS *st = _test_init_st(2, 2, 0); @@ -202,7 +202,7 @@ void _test_config_slot1(void) 0x00, 0x46, 0xc0 }; - char *argv[] = { + const char *argv[] = { "unittest", "-1", NULL }; @@ -233,7 +233,7 @@ void _test_config_static_slot2(void) 0x00, 0xe9, 0xf5 }; - char *argv[] = { + const char *argv[] = { "unittest", "-2", "-a303132333435363738393a3b3c3d3e3f", NULL }; @@ -252,7 +252,7 @@ void _test_too_old_key(void) YK_STATUS *st = _test_init_st(1, 3, 0); int rc = 0; - char *argv[] = { + const char *argv[] = { "unittest", "-oshort-ticket", NULL }; @@ -272,7 +272,7 @@ void _test_too_new_key(void) YK_STATUS *st = _test_init_st(2, 2, 0); int rc = 0; - char *argv[] = { + const char *argv[] = { "unittest", "-oticket-first", NULL }; @@ -316,7 +316,7 @@ void _test_non_config_args(void) unsigned char scan_map[sizeof(SCAN_MAP)]; - char *argv[] = { + const char *argv[] = { "unittest", "-1", "-sout", "-iin", "-c313233343536", "-y", "-v", NULL }; @@ -373,7 +373,7 @@ void _test_oath_hotp_nist_160_bits(void) 0x00, 0x6a, 0xb9 }; - char *argv[] = { + const char *argv[] = { "unittest", "-1", "-a303132333435363738393a3b3c3d3e3f40414243", "-ooath-hotp", "-o-append-cr", NULL }; @@ -406,7 +406,7 @@ void _test_extended_flags1(void) 0x00, 0x03, 0x95, 0x56, 0x00, 0x00, 0x00, }; - char *argv[] = { + const char *argv[] = { "unittest", "-2", "-a303132333435363738393a3b3c3d3e3f40414243", "-ochal-resp", "-ochal-hmac", "-ohmac-lt64", "-oserial-api-visible", NULL @@ -423,7 +423,7 @@ void _test_extended_flags1(void) void _test_two_slots1(void) { /* Test that it is not possible to choose slot more than once */ - char *argv[] = { + const char *argv[] = { "unittest", "-1", "-1", NULL }; @@ -434,7 +434,7 @@ void _test_two_slots1(void) void _test_two_slots2(void) { /* Test that it is not possible to choose slot more than once */ - char *argv[] = { + const char *argv[] = { "unittest", "-2", "-1", NULL }; @@ -445,7 +445,7 @@ void _test_two_slots2(void) void _test_two_modes_at_once1(void) { /* Test that it is not possible to choose mode (OATH-HOTP/CHAL-RESP) more than once */ - char *argv[] = { + const char *argv[] = { "unittest", "-ochal-resp", "-ooath-hotp", NULL }; @@ -456,7 +456,7 @@ void _test_two_modes_at_once1(void) void _test_two_modes_at_once2(void) { /* Test that it is not possible to choose mode (OATH-HOTP/CHAL-RESP) more than once */ - char *argv[] = { + const char *argv[] = { "unittest", "-ochal-resp", "-ochal-resp", NULL }; @@ -467,7 +467,7 @@ void _test_two_modes_at_once2(void) void _test_mode_after_other_option(void) { /* Test that it is not possible to set mode after other options */ - char *argv[] = { + const char *argv[] = { "unittest", "-ohmac-lt64", "-ochal-resp", NULL }; @@ -480,7 +480,7 @@ void _test_key_mixed_case1(void) /* Make sure key with mixed case is rejected (parsing function yubikey_hex_decode * only handles lower case hex) */ - char *argv[] = { + const char *argv[] = { "unittest", "-1", "-a0000000000000000000000000000000E", NULL }; @@ -491,7 +491,7 @@ void _test_key_mixed_case1(void) void _test_uid_for_oath(void) { /* Test that it is not possible to specify UID with OATH */ - char *argv[] = { + const char *argv[] = { "unittest", "-ooath-hotp", "-ouid=h:010203040506", NULL }; @@ -502,7 +502,7 @@ void _test_uid_for_oath(void) void _test_uid_for_chal_resp(void) { /* Test that it is not possible to specify UID with Challenge Response */ - char *argv[] = { + const char *argv[] = { "unittest", "-ochal-resp", "-ouid=h:010203040506", NULL }; @@ -513,7 +513,7 @@ void _test_uid_for_chal_resp(void) void _test_swap_with_slot(void) { /* Test that you can not both swap and set slot */ - char *argv[] = { + const char *argv[] = { "unittest", "-x", "-1", NULL }; @@ -524,7 +524,7 @@ void _test_swap_with_slot(void) void _test_slot_with_update(void) { /* Test the update must be before slot */ - char *argv[] = { + const char *argv[] = { "unittest", "-1", "-u", NULL }; @@ -535,7 +535,7 @@ void _test_slot_with_update(void) void _test_swap_with_update(void) { /* Test the update must be before slot */ - char *argv[] = { + const char *argv[] = { "unittest", "-u", "-x", NULL }; @@ -548,7 +548,7 @@ void _test_ndef_for_neo_beta(void) YKP_CONFIG *cfg = ykp_alloc(); YK_STATUS *st = _test_init_st(2, 1, 7); - char *argv[] = { + const char *argv[] = { "unittest", "-nhttps://my.yubico.com/neo/", NULL }; @@ -568,7 +568,7 @@ void _test_ndef_with_non_neo(void) YKP_CONFIG *cfg = ykp_alloc(); YK_STATUS *st = _test_init_st(2, 2, 4); - char *argv[] = { + const char *argv[] = { "unittest", "-nhttps://my.yubico.com/neo/", NULL }; @@ -586,7 +586,7 @@ void _test_slot_two_with_neo_beta(void) YKP_CONFIG *cfg = ykp_alloc(); YK_STATUS *st = _test_init_st(2, 1, 7); - char *argv[] = { + const const char *argv[] = { "unittest", "-2", NULL }; int argc = 2; @@ -602,8 +602,9 @@ void _test_ndef2_with_neo_beta(void) YKP_CONFIG *cfg = ykp_alloc(); YK_STATUS *st = _test_init_st(2, 1, 7); - char *argv[] = { + const const char *argv[] = { "unittest", "-2", "-nhttps://my.yubico.com/neo/", + NULL }; int argc = 2; @@ -618,7 +619,7 @@ void _test_ndef2_with_neo(void) YKP_CONFIG *cfg = ykp_alloc(); YK_STATUS *st = _test_init_st(3, 0, 0); - char *argv[] = { + const const char *argv[] = { "unittest", "-2", "-nhttps://my.yubico.com/neo/", NULL };