1
1
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
Slava Zanko 2010-07-21 13:09:38 +03:00 коммит произвёл Andrew Borodin
родитель 57b980ccb9
Коммит f7ac8acd29

Просмотреть файл

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