Skip to content

Commit

Permalink
Fix compilation on 32bit system
Browse files Browse the repository at this point in the history
  • Loading branch information
pali committed Sep 22, 2012
1 parent 6d69da6 commit b0130e5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/dump.c
Expand Up @@ -203,7 +203,7 @@ int check_badblocks(char *mtddev)
} else { } else {
char readbuf[2048]; // XXX hardcoded like mtd-utils?? ugly! char readbuf[2048]; // XXX hardcoded like mtd-utils?? ugly!
// dummy -- should be removed // dummy -- should be removed
if (pread(fd, readbuf, meminfo.writesize, i) != meminfo.writesize) { if (pread(fd, readbuf, meminfo.writesize, i) != (ssize_t)meminfo.writesize) {
perror("pread"); perror("pread");
goto closeall; goto closeall;
} }
Expand Down
2 changes: 1 addition & 1 deletion src/fiasco.c
Expand Up @@ -38,7 +38,7 @@
#define FIASCO_WRITE_ERROR(file, fd, ...) do { ERROR_INFO_STR(file, __VA_ARGS__); if ( fd >= 0 ) close(fd); return -1; } while (0) #define FIASCO_WRITE_ERROR(file, fd, ...) do { ERROR_INFO_STR(file, __VA_ARGS__); if ( fd >= 0 ) close(fd); return -1; } while (0)
#define READ_OR_FAIL(fiasco, buf, size) do { if ( read(fiasco->fd, buf, size) != size ) { FIASCO_READ_ERROR(fiasco, "Cannot read %d bytes", size); } } while (0) #define READ_OR_FAIL(fiasco, buf, size) do { if ( read(fiasco->fd, buf, size) != size ) { FIASCO_READ_ERROR(fiasco, "Cannot read %d bytes", size); } } while (0)
#define READ_OR_RETURN(fiasco, buf, size) do { if ( read(fiasco->fd, buf, size) != size ) return fiasco; } while (0) #define READ_OR_RETURN(fiasco, buf, size) do { if ( read(fiasco->fd, buf, size) != size ) return fiasco; } while (0)
#define WRITE_OR_FAIL(file, fd, buf, size) do { if ( ! simulate ) { if ( write(fd, buf, size) != size ) { FIASCO_WRITE_ERROR(file, fd, "Cannot write %d bytes", size); } } } while (0) #define WRITE_OR_FAIL(file, fd, buf, size) do { if ( ! simulate ) { if ( write(fd, buf, size) != (ssize_t)size ) { FIASCO_WRITE_ERROR(file, fd, "Cannot write %d bytes", size); } } } while (0)


struct fiasco * fiasco_alloc_empty(void) { struct fiasco * fiasco_alloc_empty(void) {


Expand Down
4 changes: 2 additions & 2 deletions src/image.c
Expand Up @@ -320,7 +320,7 @@ void image_free(struct image * image) {


} }


void image_seek(struct image * image, off_t whence) { void image_seek(struct image * image, size_t whence) {


if ( whence > image->size ) if ( whence > image->size )
return; return;
Expand All @@ -339,7 +339,7 @@ void image_seek(struct image * image, off_t whence) {


size_t image_read(struct image * image, void * buf, size_t count) { size_t image_read(struct image * image, void * buf, size_t count) {


off_t cur; size_t cur;
ssize_t ret; ssize_t ret;
size_t new_count = 0; size_t new_count = 0;
size_t ret_count = 0; size_t ret_count = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/image.h
Expand Up @@ -51,9 +51,9 @@ struct image {
int fd; int fd;
int is_shared_fd; int is_shared_fd;
uint32_t align; uint32_t align;
off_t offset; size_t offset;
off_t cur; size_t cur;
off_t acur; size_t acur;
char * orig_filename; char * orig_filename;
}; };


Expand All @@ -66,7 +66,7 @@ struct image_list {
struct image * image_alloc_from_file(const char * file, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout); struct image * image_alloc_from_file(const char * file, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout);
struct image * image_alloc_from_shared_fd(int fd, size_t size, size_t offset, uint16_t hash, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout); struct image * image_alloc_from_shared_fd(int fd, size_t size, size_t offset, uint16_t hash, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout);
void image_free(struct image * image); void image_free(struct image * image);
void image_seek(struct image * image, off_t whence); void image_seek(struct image * image, size_t whence);
size_t image_read(struct image * image, void * buf, size_t count); size_t image_read(struct image * image, void * buf, size_t count);
void image_print_info(struct image * image); void image_print_info(struct image * image);
void image_list_add(struct image_list ** list, struct image * image); void image_list_add(struct image_list ** list, struct image * image);
Expand Down

0 comments on commit b0130e5

Please sign in to comment.