From: bernie Date: Mon, 25 Aug 2008 18:34:44 +0000 (+0000) Subject: kfile_size_t: kill and replace with kfile_off_t X-Git-Tag: 2.0.0~239 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=382c5fb24ac9e79dfa8bd452832d3b5854af83f3;p=bertos.git kfile_size_t: kill and replace with kfile_off_t git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1695 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/drv/dataflash.c b/bertos/drv/dataflash.c index 68047d5b..0f0d0604 100644 --- a/bertos/drv/dataflash.c +++ b/bertos/drv/dataflash.c @@ -343,8 +343,8 @@ static size_t dataflash_read(struct KFile *_fd, void *buf, size_t size) uint8_t *data = (uint8_t *)buf; - ASSERT(fd->fd.seek_pos + size <= (kfile_size_t)fd->fd.size); - size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos); + ASSERT(fd->fd.seek_pos + size <= (kfile_off_t)fd->fd.size); + size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos); LOG_INFO("Reading at pos[%lu]\n", fd->fd.seek_pos); @@ -395,7 +395,7 @@ static size_t dataflash_write(struct KFile *_fd, const void *_buf, size_t size) const uint8_t *data = (const uint8_t *) _buf; ASSERT(fd->fd.seek_pos + size <= (kfile_off_t)fd->fd.size); - size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos); + size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos); LOG_INFO("Writing at pos[%lu]\n", fd->fd.seek_pos); diff --git a/bertos/drv/flash25.c b/bertos/drv/flash25.c index 793fab01..a903a1c5 100644 --- a/bertos/drv/flash25.c +++ b/bertos/drv/flash25.c @@ -173,8 +173,8 @@ static size_t flash25_read(struct KFile *_fd, void *buf, size_t size) Flash25 *fd = FLASH25_CAST(_fd); - ASSERT(fd->fd.seek_pos + (kfile_size_t)size <= fd->fd.size); - size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos); + ASSERT(fd->fd.seek_pos + (kfile_off_t)size <= fd->fd.size); + size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos); //kprintf("Reading at addr[%lu], size[%d]\n", fd->seek_pos, size); CS_ENABLE(); @@ -226,9 +226,9 @@ static size_t flash25_write(struct KFile *_fd, const void *_buf, size_t size) Flash25 *fd = FLASH25_CAST(_fd); - ASSERT(fd->fd.seek_pos + (kfile_size_t)size <= fd->fd.size); + ASSERT(fd->fd.seek_pos + (kfile_off_t)size <= fd->fd.size); - size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos); + size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos); while (size) { diff --git a/bertos/fs/battfs.c b/bertos/fs/battfs.c index 481674e1..6d6b92d8 100644 --- a/bertos/fs/battfs.c +++ b/bertos/fs/battfs.c @@ -632,7 +632,7 @@ static size_t battfs_read(struct KFile *fd, void *_buf, size_t size) pgaddr_t addr_offset; pgaddr_t read_len; - size = MIN((kfile_size_t)size, fd->size - fd->seek_pos); + size = MIN((kfile_off_t)size, fd->size - fd->seek_pos); while (size) { diff --git a/bertos/kern/kfile.h b/bertos/kern/kfile.h index 4f1d8fc8..ade4895d 100644 --- a/bertos/kern/kfile.h +++ b/bertos/kern/kfile.h @@ -105,7 +105,6 @@ struct KFile; typedef int32_t kfile_off_t; ///< KFile offset type, used by kfile_seek(). -typedef uint32_t kfile_size_t; ///< KFile size type, used in struct KFile. /** * Costants for repositioning read/write file offset. @@ -195,8 +194,8 @@ typedef struct KFile DB(id_t _type); ///< Used to keep track, at runtime, of the class type. /* NOTE: these must _NOT_ be size_t on 16bit CPUs! */ - kfile_off_t seek_pos; - kfile_size_t size; // FIXME: should be kfile_off_t + kfile_off_t seek_pos; + kfile_off_t size; } KFile; /**