Skip to content

Commit

Permalink
Change mmap_file size parameter to ssize_t
Browse files Browse the repository at this point in the history
  • Loading branch information
mahkoh committed Oct 15, 2016
1 parent 7c675a7 commit 04ea072
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static int do_browser_load(const char *name)

if (S_ISREG(st.st_mode) && cmus_is_playlist(name)) {
char *buf;
int size;
ssize_t size;

buf = mmap_file(name, &size);
if (size == -1)
Expand Down
4 changes: 2 additions & 2 deletions file.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ssize_t write_all(int fd, const void *buf, size_t count)
return count_save;
}

char *mmap_file(const char *filename, int *size)
char *mmap_file(const char *filename, ssize_t *size)
{
struct stat st;
char *buf;
Expand Down Expand Up @@ -171,7 +171,7 @@ int file_for_each_line(const char *filename,
void *data)
{
char *buf;
int size;
ssize_t size;

buf = mmap_file(filename, &size);
if (size == -1)
Expand Down
2 changes: 1 addition & 1 deletion file.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ssize_t write_all(int fd, const void *buf, size_t count);
*
* returns buffer or NULL if empty file or failed
*/
char *mmap_file(const char *filename, int *size);
char *mmap_file(const char *filename, ssize_t *size);

void buffer_for_each_line(const char *buf, int size,
int (*cb)(void *data, const char *line),
Expand Down
3 changes: 2 additions & 1 deletion job.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ static int handle_line(void *data, const char *line)
static void add_pl(const char *filename)
{
char *buf;
int size, reverse;
ssize_t size;
int reverse;

buf = mmap_file(filename, &size);
if (size == -1)
Expand Down

0 comments on commit 04ea072

Please sign in to comment.