Major API change:
1. Introduced a cfs_offset_t type that designates file offsets. unsigned int was insufficient on several platforms with non-volatile storage that exceed the capacity of unsigned int. 2. Switched cfs_seek signature to POSIX style with a "whence" parameter.
This commit is contained in:
parent
5e038640e2
commit
3191a2568c
6 changed files with 78 additions and 44 deletions
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: cfs-ram.c,v 1.9 2008/11/24 10:56:55 nvt-se Exp $
|
||||
* $Id: cfs-ram.c,v 1.10 2009/02/27 14:25:38 nvt-se Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
@ -127,18 +127,17 @@ cfs_write(int f, const void *buf, unsigned int len)
|
|||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned int
|
||||
cfs_seek(int f, unsigned int o)
|
||||
cfs_offset_t
|
||||
cfs_seek(int f, cfs_offset_t o, int w)
|
||||
{
|
||||
if(f == 1) {
|
||||
if(w == CFS_SEEK_SET && f == 1) {
|
||||
if(o > file.filesize) {
|
||||
o = file.filesize;
|
||||
}
|
||||
file.fileptr = o;
|
||||
return o;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
return (cfs_offset_t)-1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue