From ca594adb5a71f2bf60c1380172b8e61b075d9479 Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Tue, 10 Nov 2009 04:27:15 -0800 Subject: add const keyword to some APIs Add 'const' keyword to 'char *' parameters to allow command handlers to pass constant string arguments. These changes allow the 'args' command handler to be changed to 'const' in a subsequent patch. --- src/flash/flash.c | 2 +- src/flash/flash.h | 2 +- src/flash/lpc2900.c | 6 +++--- src/flash/nand.c | 2 +- src/flash/nand.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/flash') diff --git a/src/flash/flash.c b/src/flash/flash.c index 451abdc6..1a04e123 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -199,7 +199,7 @@ flash_bank_t *get_flash_bank_by_num(int num) } int flash_command_get_bank_by_num( - struct command_context_s *cmd_ctx, char *str, flash_bank_t **bank) + struct command_context_s *cmd_ctx, const char *str, flash_bank_t **bank) { unsigned bank_num; COMMAND_PARSE_NUMBER(uint, str, bank_num); diff --git a/src/flash/flash.h b/src/flash/flash.h index fd3c4c29..648bd738 100644 --- a/src/flash/flash.h +++ b/src/flash/flash.h @@ -326,7 +326,7 @@ flash_bank_t *get_flash_bank_by_num(int num); * @returns ERROR_OK on success, or an error indicating the problem. */ int flash_command_get_bank_by_num(struct command_context_s *cmd_ctx, - char *str, flash_bank_t **bank); + const char *str, flash_bank_t **bank); /** * Returns the flash bank like get_flash_bank_by_num(), without probing. * @param num The flash bank number. diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index f2daab4c..251f682f 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -635,7 +635,7 @@ static int lpc2900_handle_read_custom_command( struct command_context_s *cmd_ctx /* Try and open the file */ fileio_t fileio; - char *filename = args[1]; + const char *filename = args[1]; int ret = fileio_open( &fileio, filename, FILEIO_WRITE, FILEIO_BINARY ); if( ret != ERROR_OK ) { @@ -747,8 +747,8 @@ static int lpc2900_handle_write_custom_command( struct command_context_s *cmd_ct image.base_address = 0; image.start_address_set = 0; - char *filename = args[1]; - char *type = (argc >= 3) ? args[2] : NULL; + const char *filename = args[1]; + const char *type = (argc >= 3) ? args[2] : NULL; retval = image_open(&image, filename, type); if (retval != ERROR_OK) { diff --git a/src/flash/nand.c b/src/flash/nand.c index ea1cb9e6..c1be276d 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -304,7 +304,7 @@ nand_device_t *get_nand_device_by_num(int num) } int nand_command_get_device_by_num(struct command_context_s *cmd_ctx, - char *str, nand_device_t **device) + const char *str, nand_device_t **device) { unsigned num; COMMAND_PARSE_NUMBER(uint, str, num); diff --git a/src/flash/nand.h b/src/flash/nand.h index 16558c2b..5b19d5a9 100644 --- a/src/flash/nand.h +++ b/src/flash/nand.h @@ -226,7 +226,7 @@ int nand_init(struct command_context_s *cmd_ctx); /// helper for parsing a nand device command argument string int nand_command_get_device_by_num(struct command_context_s *cmd_ctx, - char *str, nand_device_t **device); + const char *str, nand_device_t **device); #define ERROR_NAND_DEVICE_INVALID (-1100) -- cgit v1.2.3