summaryrefslogtreecommitdiff
path: root/src/helper/fileio.c
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-09-29 09:11:01 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-09-29 18:56:07 +0200
commit3931b99d142d337ea6558fd09aad2e0812c04507 (patch)
tree20ca8392b75964e038b941b607dcce8162513b2d /src/helper/fileio.c
parent3a693ef526575633cc350a69aa1a5d1f08e64c46 (diff)
downloadopenocd+libswd-3931b99d142d337ea6558fd09aad2e0812c04507.tar.gz
openocd+libswd-3931b99d142d337ea6558fd09aad2e0812c04507.tar.bz2
openocd+libswd-3931b99d142d337ea6558fd09aad2e0812c04507.tar.xz
openocd+libswd-3931b99d142d337ea6558fd09aad2e0812c04507.zip
fileio: fileio_size() can now fail
Part of making the fileio API more robust. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/helper/fileio.c')
-rw-r--r--src/helper/fileio.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/helper/fileio.c b/src/helper/fileio.c
index 7c862e47..9ae01344 100644
--- a/src/helper/fileio.c
+++ b/src/helper/fileio.c
@@ -245,8 +245,18 @@ int fileio_write_u32(struct fileio *fileio_p, uint32_t data)
return retval;
}
-int fileio_size(struct fileio *fileio_p)
+/**
+ * FIX!!!!
+ *
+ * For now this can not fail, but that's because a seek was executed
+ * on startup.
+ *
+ * Avoiding the seek on startup opens up for using streams.
+ *
+ */
+int fileio_size(struct fileio *fileio_p, int *size)
{
struct fileio_internal *fileio = fileio_p->fp;
- return fileio->size;
+ *size = fileio->size;
+ return ERROR_OK;
}