Merge pull request #254 from tony/freebsd-compat
Add FreeBSD compatibility defs
This commit is contained in:
commit
d9304f17f5
@ -210,7 +210,7 @@ inline size_t filesize(FILE *f)
|
|||||||
#else // unix
|
#else // unix
|
||||||
int fd = fileno(f);
|
int fd = fileno(f);
|
||||||
//64 bits(but not in osx, where fstat64 is deprecated)
|
//64 bits(but not in osx, where fstat64 is deprecated)
|
||||||
#if !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__))
|
#if !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__))
|
||||||
struct stat64 st;
|
struct stat64 st;
|
||||||
if (fstat64(fd, &st) == 0)
|
if (fstat64(fd, &st) == 0)
|
||||||
return st.st_size;
|
return st.st_size;
|
||||||
@ -299,7 +299,7 @@ inline std::string errno_str(int err_num)
|
|||||||
else
|
else
|
||||||
return "Unkown error";
|
return "Unkown error";
|
||||||
|
|
||||||
#elif defined(__APPLE__) || ((_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE) // posix version
|
#elif defined(__FreeBSD__) || defined(__APPLE__) || ((_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE) // posix version
|
||||||
if (strerror_r(err_num, buf, buf_size) == 0)
|
if (strerror_r(err_num, buf, buf_size) == 0)
|
||||||
return std::string(buf);
|
return std::string(buf);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user