summaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-09-28 15:37:56 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-09-29 08:43:27 +0200
commit3a693ef526575633cc350a69aa1a5d1f08e64c46 (patch)
tree6af64277137ac59254bf20d7d3ca175728a709bd /src/target
parentecad76061f6edff5db67ad05e6514dff6cd6efc7 (diff)
downloadopenocd+libswd-3a693ef526575633cc350a69aa1a5d1f08e64c46.tar.gz
openocd+libswd-3a693ef526575633cc350a69aa1a5d1f08e64c46.tar.bz2
openocd+libswd-3a693ef526575633cc350a69aa1a5d1f08e64c46.tar.xz
openocd+libswd-3a693ef526575633cc350a69aa1a5d1f08e64c46.zip
fileio: refactor struct fileio to be an opaque structure
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/target')
-rw-r--r--src/target/etm.c2
-rw-r--r--src/target/image.c6
-rw-r--r--src/target/target.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/target/etm.c b/src/target/etm.c
index 9da69550..c71c5d19 100644
--- a/src/target/etm.c
+++ b/src/target/etm.c
@@ -1897,7 +1897,7 @@ COMMAND_HANDLER(handle_etm_load_command)
return ERROR_FAIL;
}
- if (file.size % 4)
+ if (fileio_size(&file) % 4)
{
command_print(CMD_CTX, "size isn't a multiple of 4, no valid trace data");
fileio_close(&file);
diff --git a/src/target/image.c b/src/target/image.c
index d36fbc34..e77e1901 100644
--- a/src/target/image.c
+++ b/src/target/image.c
@@ -158,7 +158,7 @@ static int image_ihex_buffer_complete_inner(struct image *image, char *lpszLine,
/* we can't determine the number of sections that we'll have to create ahead of time,
* so we locally hold them until parsing is finished */
- ihex->buffer = malloc(fileio->size >> 1);
+ ihex->buffer = malloc(fileio_size(fileio) >> 1);
cooked_bytes = 0x0;
image->num_sections = 0;
section[image->num_sections].private = &ihex->buffer[cooked_bytes];
@@ -537,7 +537,7 @@ static int image_mot_buffer_complete_inner(struct image *image, char *lpszLine,
/* we can't determine the number of sections that we'll have to create ahead of time,
* so we locally hold them until parsing is finished */
- mot->buffer = malloc(fileio->size >> 1);
+ mot->buffer = malloc(fileio_size(fileio) >> 1);
cooked_bytes = 0x0;
image->num_sections = 0;
section[image->num_sections].private = &mot->buffer[cooked_bytes];
@@ -747,7 +747,7 @@ int image_open(struct image *image, const char *url, const char *type_string)
image->num_sections = 1;
image->sections = malloc(sizeof(struct imagesection));
image->sections[0].base_address = 0x0;
- image->sections[0].size = image_binary->fileio.size;
+ image->sections[0].size = fileio_size(&image_binary->fileio);
image->sections[0].flags = 0;
}
else if (image->type == IMAGE_IHEX)
diff --git a/src/target/target.c b/src/target/target.c
index c37432a3..fcdcc363 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2649,8 +2649,8 @@ COMMAND_HANDLER(handle_dump_image_command)
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{
command_print(CMD_CTX,
- "dumped %ld bytes in %fs (%0.3f KiB/s)", (long)fileio.size,
- duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
+ "dumped %ld bytes in %fs (%0.3f KiB/s)", (long)fileio_size(&fileio),
+ duration_elapsed(&bench), duration_kbps(&bench, fileio_size(&fileio)));
}
return retval;