Skip to content

Commit

Permalink
Make lime_pack support large files
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRichtmann committed Jun 25, 2019
1 parent a4c6612 commit e304753
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/lime_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ typedef struct {


/* Discover how many bytes there are in the file */
off_t file_size(FILE *fp)
n_uint64_t file_size(FILE *fp)
{
off_t oldpos = ftello(fp);
off_t length;
n_uint64_t oldpos = ftello(fp);
n_uint64_t length;

if (DCAPL(fseeko)(fp, 0L,SEEK_END) == -1)
return -1;
Expand Down Expand Up @@ -117,7 +117,7 @@ int write_buf(char *buf, n_uint64_t bytes, LimeWriter *dg)
return EXIT_SUCCESS;
}

int min(int i, int j){
n_uint64_t mino(n_uint64_t i, n_uint64_t j){
return i < j ? i : j;
}

Expand Down Expand Up @@ -249,8 +249,8 @@ int main(int argc, char *argv[])

/* Buffered copy */
bytes_left = bytes;
while(bytes_left > 0){
bytes_to_copy = min(MAXBUF,bytes_left);
while(bytes_left > (n_uint64_t)0){
bytes_to_copy = mino((n_uint64_t)MAXBUF,bytes_left);
if( bytes_to_copy != fread(buf,1,bytes_to_copy,fp_src))
{
fprintf(stderr, "Error reading %s\n", curr.filename);
Expand Down

0 comments on commit e304753

Please sign in to comment.