Skip to content

Commit

Permalink
make: LARGEFILE_SOURCE
Browse files Browse the repository at this point in the history
* writer: add implicit conversions to 32bit numbers
  • Loading branch information
indutny committed Jan 22, 2012
1 parent e022610 commit 1dab468
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CSTDFLAG = --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
CFLAGS = -g
CPPFLAGS += -Iinclude -Ideps/snappy -D_FILE_OFFSET_BITS=64
CPPFLAGS += -Iinclude -Ideps/snappy
CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
LINKFLAGS =

all: bplus.a
Expand Down
6 changes: 3 additions & 3 deletions src/writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int bp__writer_read(bp__writer_t* w,
if (cdata == NULL) return BP_EALLOC;

read = pread(w->fd, cdata, (size_t) *size, (off_t) offset);
if (read != *size) {
if ((uint32_t) read != *size) {
free(cdata);
return BP_EFILEREAD;
}
Expand Down Expand Up @@ -105,7 +105,7 @@ int bp__writer_write(bp__writer_t* w,
/* Write padding */
if (padding != sizeof(w->padding)) {
written = write(w->fd, &w->padding, (size_t) padding);
if (written != padding) return BP_EFILEWRITE;
if ((uint32_t) written != padding) return BP_EFILEWRITE;
w->filesize += padding;
}

Expand Down Expand Up @@ -135,7 +135,7 @@ int bp__writer_write(bp__writer_t* w,
free(compressed);
}

if (written != *csize) return BP_EFILEWRITE;
if ((uint32_t) written != *csize) return BP_EFILEWRITE;

/* change offset */
*offset = w->filesize;
Expand Down

0 comments on commit 1dab468

Please sign in to comment.