mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
int -> long where needed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5643 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
36b8e13f47
commit
cea551dd9c
4 changed files with 22 additions and 22 deletions
|
@ -128,7 +128,7 @@ DIR* opendir(const char* name)
|
||||||
&pdir->fatdir,
|
&pdir->fatdir,
|
||||||
entry.firstcluster,
|
entry.firstcluster,
|
||||||
&pdir->parent_dir) < 0 ) {
|
&pdir->parent_dir) < 0 ) {
|
||||||
DEBUGF("Failed opening dir '%s' (%d)\n",
|
DEBUGF("Failed opening dir '%s' (%ld)\n",
|
||||||
part, entry.firstcluster);
|
part, entry.firstcluster);
|
||||||
pdir->busy = false;
|
pdir->busy = false;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BYTES2INT32(array,pos) \
|
#define BYTES2INT32(array,pos) \
|
||||||
(array[pos] | (array[pos+1] << 8 ) | \
|
((long)array[pos] | (long)(array[pos+1] << 8 ) | \
|
||||||
(array[pos+2] << 16 ) | (array[pos+3] << 24 ))
|
((long)array[pos+2] << 16 ) | ((long)array[pos+3] << 24 ))
|
||||||
|
|
||||||
static struct partinfo part[8]; /* space for 4 partitions on 2 drives */
|
static struct partinfo part[8]; /* space for 4 partitions on 2 drives */
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ struct partinfo* disk_init(IF_MV_NONVOID(int drive))
|
||||||
pinfo[i].start = BYTES2INT32(ptr, 8);
|
pinfo[i].start = BYTES2INT32(ptr, 8);
|
||||||
pinfo[i].size = BYTES2INT32(ptr, 12);
|
pinfo[i].size = BYTES2INT32(ptr, 12);
|
||||||
|
|
||||||
DEBUGF("Part%d: Type %02x, start: %08x size: %08x\n",
|
DEBUGF("Part%d: Type %02x, start: %08lx size: %08lx\n",
|
||||||
i,pinfo[i].type,pinfo[i].start,pinfo[i].size);
|
i,pinfo[i].type,pinfo[i].start,pinfo[i].size);
|
||||||
|
|
||||||
/* extended? */
|
/* extended? */
|
||||||
|
|
|
@ -37,9 +37,9 @@
|
||||||
|
|
||||||
struct filedesc {
|
struct filedesc {
|
||||||
unsigned char cache[SECTOR_SIZE];
|
unsigned char cache[SECTOR_SIZE];
|
||||||
int cacheoffset;
|
int cacheoffset; /* invariant: 0 <= cacheoffset <= SECTOR_SIZE */
|
||||||
int fileoffset;
|
long fileoffset;
|
||||||
int size;
|
long size;
|
||||||
int attr;
|
int attr;
|
||||||
struct fat_file fatfile;
|
struct fat_file fatfile;
|
||||||
bool busy;
|
bool busy;
|
||||||
|
@ -380,7 +380,7 @@ static int flush_cache(int fd)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct filedesc* file = &openfiles[fd];
|
struct filedesc* file = &openfiles[fd];
|
||||||
int sector = file->fileoffset / SECTOR_SIZE;
|
long sector = file->fileoffset / SECTOR_SIZE;
|
||||||
|
|
||||||
DEBUGF("Flushing dirty sector cache\n");
|
DEBUGF("Flushing dirty sector cache\n");
|
||||||
|
|
||||||
|
@ -404,10 +404,10 @@ static int flush_cache(int fd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int readwrite(int fd, void* buf, int count, bool write)
|
static int readwrite(int fd, void* buf, long count, bool write)
|
||||||
{
|
{
|
||||||
int sectors;
|
long sectors;
|
||||||
int nread=0;
|
long nread=0;
|
||||||
struct filedesc* file = &openfiles[fd];
|
struct filedesc* file = &openfiles[fd];
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -416,8 +416,8 @@ static int readwrite(int fd, void* buf, int count, bool write)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LDEBUGF( "readwrite(%d,%x,%d,%s)\n",
|
LDEBUGF( "readwrite(%d,%lx,%ld,%s)\n",
|
||||||
fd,buf,count,write?"write":"read");
|
fd,(long)buf,count,write?"write":"read");
|
||||||
|
|
||||||
/* attempt to read past EOF? */
|
/* attempt to read past EOF? */
|
||||||
if (!write && count > file->size - file->fileoffset)
|
if (!write && count > file->size - file->fileoffset)
|
||||||
|
@ -469,7 +469,7 @@ static int readwrite(int fd, void* buf, int count, bool write)
|
||||||
int rc = fat_readwrite(&(file->fatfile), sectors,
|
int rc = fat_readwrite(&(file->fatfile), sectors,
|
||||||
(unsigned char*)buf+nread, write );
|
(unsigned char*)buf+nread, write );
|
||||||
if ( rc < 0 ) {
|
if ( rc < 0 ) {
|
||||||
DEBUGF("Failed read/writing %d sectors\n",sectors);
|
DEBUGF("Failed read/writing %ld sectors\n",sectors);
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
if(write && file->fatfile.eof) {
|
if(write && file->fatfile.eof) {
|
||||||
DEBUGF("No space left on device\n");
|
DEBUGF("No space left on device\n");
|
||||||
|
@ -545,7 +545,7 @@ static int readwrite(int fd, void* buf, int count, bool write)
|
||||||
}
|
}
|
||||||
|
|
||||||
file->fileoffset += nread;
|
file->fileoffset += nread;
|
||||||
LDEBUGF("fileoffset: %d\n", file->fileoffset);
|
LDEBUGF("fileoffset: %ld\n", file->fileoffset);
|
||||||
|
|
||||||
/* adjust file size to length written */
|
/* adjust file size to length written */
|
||||||
if ( write && file->fileoffset > file->size )
|
if ( write && file->fileoffset > file->size )
|
||||||
|
@ -571,14 +571,14 @@ ssize_t read(int fd, void* buf, size_t count)
|
||||||
|
|
||||||
off_t lseek(int fd, off_t offset, int whence)
|
off_t lseek(int fd, off_t offset, int whence)
|
||||||
{
|
{
|
||||||
int pos;
|
off_t pos;
|
||||||
int newsector;
|
long newsector;
|
||||||
int oldsector;
|
long oldsector;
|
||||||
int sectoroffset;
|
int sectoroffset;
|
||||||
int rc;
|
int rc;
|
||||||
struct filedesc* file = &openfiles[fd];
|
struct filedesc* file = &openfiles[fd];
|
||||||
|
|
||||||
LDEBUGF("lseek(%d,%d,%d)\n",fd,offset,whence);
|
LDEBUGF("lseek(%d,%ld,%d)\n",fd,offset,whence);
|
||||||
|
|
||||||
if ( !file->busy ) {
|
if ( !file->busy ) {
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
|
@ -649,7 +649,7 @@ off_t lseek(int fd, off_t offset, int whence)
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
int filesize(int fd)
|
off_t filesize(int fd)
|
||||||
{
|
{
|
||||||
struct filedesc* file = &openfiles[fd];
|
struct filedesc* file = &openfiles[fd];
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ extern ssize_t write(int fd, const void *buf, size_t count);
|
||||||
extern int remove(const char* pathname);
|
extern int remove(const char* pathname);
|
||||||
extern int rename(const char* path, const char* newname);
|
extern int rename(const char* path, const char* newname);
|
||||||
extern int ftruncate(int fd, off_t length);
|
extern int ftruncate(int fd, off_t length);
|
||||||
extern int filesize(int fd);
|
extern off_t filesize(int fd);
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue