From 884a4d518dfd8300bc54de188f95bc79d1e2e18f Mon Sep 17 00:00:00 2001 From: deuce <> Date: Tue, 29 Oct 2013 02:11:47 +0000 Subject: [PATCH] Various fixups. --- src/xpdev/filewrap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/xpdev/filewrap.c b/src/xpdev/filewrap.c index 3f2c4c7615..d1da2cf1b1 100644 --- a/src/xpdev/filewrap.c +++ b/src/xpdev/filewrap.c @@ -51,6 +51,7 @@ /* ANSI */ #include <sys/types.h> /* _dev_t */ #include <sys/stat.h> /* struct stat */ +#include <limits.h> /* struct stat */ #include "filewrap.h" /* Verify prototypes */ @@ -275,10 +276,10 @@ int DLLCALL unlock(int file, off_t offset, off_t size) return(i); } -static inline size_t +static size_t p2roundup(size_t n) { - if(n & (n-1)) { // If n isn't a power of two already... + if(n & (n-1)) { // If n isn't a power of two already... n--; n |= n >> 1; n |= n >> 2; @@ -293,7 +294,7 @@ p2roundup(size_t n) return (n); } -static inline int expandtofit(char **linep, size_t len, size_t *linecapp) +static int expandtofit(char **linep, size_t len, size_t *linecapp) { char *newline; size_t newcap; @@ -305,7 +306,7 @@ static inline int expandtofit(char **linep, size_t len, size_t *linecapp) newcap = LONG_MAX + 1; else newcap = p2roundup(len); - newline = realloc(*linep, newcap); + newline = (char *)realloc(*linep, newcap); if(newline == NULL) return -1; *linecapp = newcap; -- GitLab