Type accuracy in undelfs vfs.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2010-07-21 13:09:38 +03:00 committed by Andrew Borodin
parent 57b980ccb9
commit f7ac8acd29

View File

@ -401,16 +401,16 @@ typedef struct
int f_index; /* file index into delarray */
char *buf;
int error_code; /* */
int pos; /* file position */
int current; /* used to determine current position in itereate */
int finished;
off_t pos; /* file position */
off_t current; /* used to determine current position in itereate */
gboolean finished;
ext2_ino_t inode;
int bytes_read;
long size;
off_t size;
/* Used by undelfs_read: */
char *dest_buffer; /* destination buffer */
size_t count; /* bytes to read */
size_t count; /* bytes to read */
} undelfs_file;
/* We do not support lseek */
@ -461,7 +461,7 @@ undelfs_open (struct vfs_class *me, const char *fname, int flags, mode_t mode)
return 0;
}
p->inode = inode;
p->finished = 0;
p->finished = FALSE;
p->f_index = i;
p->error_code = 0;
p->pos = 0;
@ -501,12 +501,12 @@ undelfs_dump_read (ext2_filsys param_fs, blk_t * blocknr, int blockcnt, void *pr
else
memset (p->buf, 0, param_fs->blocksize);
if (p->pos + p->count < p->current)
if (p->pos + (off_t) p->count < p->current)
{
p->finished = 1;
p->finished = TRUE;
return BLOCK_ABORT;
}
if ((size_t) p->pos > p->current + param_fs->blocksize)
if (p->pos > p->current + param_fs->blocksize)
{
p->current += param_fs->blocksize;
return 0; /* we have not arrived yet */
@ -517,11 +517,11 @@ undelfs_dump_read (ext2_filsys param_fs, blk_t * blocknr, int blockcnt, void *pr
{
/* First case: starting pointer inside this block */
if ((size_t) (p->pos + p->count) <= p->current + param_fs->blocksize)
if (p->pos + (off_t) p->count <= p->current + param_fs->blocksize)
{
/* Fully contained */
copy_count = p->count;
p->finished = p->count;
p->finished = (p->count != 0);
}
else
{
@ -533,10 +533,10 @@ undelfs_dump_read (ext2_filsys param_fs, blk_t * blocknr, int blockcnt, void *pr
else
{
/* Second case: we already have passed p->pos */
if ((size_t) (p->pos + p->count) < p->current + param_fs->blocksize)
if (p->pos + (off_t) p->count < p->current + param_fs->blocksize)
{
copy_count = (p->pos + p->count) - p->current;
p->finished = p->count;
p->finished = (p->count != 0);
}
else
{
@ -561,10 +561,10 @@ undelfs_read (void *vfs_info, char *buffer, size_t count)
p->dest_buffer = buffer;
p->current = 0;
p->finished = 0;
p->finished = FALSE;
p->count = count;
if (p->pos + p->count > p->size)
if (p->pos + (off_t) p->count > p->size)
{
p->count = p->size - p->pos;
}