summaryrefslogtreecommitdiff
path: root/src/target/target.c
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-13 14:44:53 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-16 15:47:09 -0800
commit51862bb98c26e9b3f03d46ae0f8ceb434f0743d0 (patch)
tree78cb65e732581369d51937ca7ba1de670313f016 /src/target/target.c
parent69df712d1d06b2c698bed3de086b9f734de73b7e (diff)
downloadopenocd+libswd-51862bb98c26e9b3f03d46ae0f8ceb434f0743d0.tar.gz
openocd+libswd-51862bb98c26e9b3f03d46ae0f8ceb434f0743d0.tar.bz2
openocd+libswd-51862bb98c26e9b3f03d46ae0f8ceb434f0743d0.tar.xz
openocd+libswd-51862bb98c26e9b3f03d46ae0f8ceb434f0743d0.zip
fileio: improve API types
Use size_t instead of uint32_t when specifying file sizes. Update all consumers up through the layers to use size_t when required. These changes should be safe, but the higher-levels will need to be updated further to receive the intended benefits (i.e. large file support). Add error checking for fileio_read and file_write. Previously, all errors were being silently ignored, so this change might cause some problems for some people in some cases. However, it gives us the chance to handle any errors that do occur at higher-levels, rather than burying our heads in the sand.
Diffstat (limited to 'src/target/target.c')
-rw-r--r--src/target/target.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/target/target.c b/src/target/target.c
index f141e933..c00c2ed9 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2399,7 +2399,7 @@ static COMMAND_HELPER(parse_load_image_command_args, struct image *image,
COMMAND_HANDLER(handle_load_image_command)
{
uint8_t *buffer;
- uint32_t buf_cnt;
+ size_t buf_cnt;
uint32_t image_size;
uint32_t min_address = 0;
uint32_t max_address = 0xffffffff;
@@ -2519,7 +2519,7 @@ COMMAND_HANDLER(handle_dump_image_command)
int retval = ERROR_OK;
while (size > 0)
{
- uint32_t size_written;
+ size_t size_written;
uint32_t this_run_size = (size > 560) ? 560 : size;
retval = target_read_buffer(target, address, this_run_size, buffer);
if (retval != ERROR_OK)
@@ -2553,7 +2553,7 @@ COMMAND_HANDLER(handle_dump_image_command)
static COMMAND_HELPER(handle_verify_image_command_internal, int verify)
{
uint8_t *buffer;
- uint32_t buf_cnt;
+ size_t buf_cnt;
uint32_t image_size;
int i;
int retval;
@@ -2674,7 +2674,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, int verify)
}
} else
{
- command_print(cmd_ctx, "address 0x%08" PRIx32 " length 0x%08" PRIx32 "",
+ command_print(cmd_ctx, "address 0x%08" PRIx32 " length 0x%08zx",
image.sections[i].base_address,
buf_cnt);
}
@@ -4537,7 +4537,7 @@ static void free_fastload(void)
COMMAND_HANDLER(handle_fast_load_image_command)
{
uint8_t *buffer;
- uint32_t buf_cnt;
+ size_t buf_cnt;
uint32_t image_size;
uint32_t min_address = 0;
uint32_t max_address = 0xffffffff;