From cd752220872d074818e0ee76e3945b200136398b Mon Sep 17 00:00:00 2001 From: Kyle Ambroff-Kao Date: Sun, 15 Sep 2019 14:45:20 -0700 Subject: Fix support for large files on Haiku diff --git a/bon_io.cpp b/bon_io.cpp index bb482f0..4a1c3a6 100644 --- a/bon_io.cpp +++ b/bon_io.cpp @@ -292,7 +292,7 @@ int CFileOp::m_open(CPCCHAR base_name, bool create) else { flags = O_RDWR; -#ifdef _LARGEFILE64_SOURCE +#if defined(_LARGEFILE64_SOURCE) && !defined(__HAIKU__) flags |= O_LARGEFILE; #endif } diff --git a/configure.in b/configure.in index 4e75dd2..715819c 100644 --- a/configure.in +++ b/configure.in @@ -94,6 +94,7 @@ AC_TRY_RUN([#ifndef _LARGEFILE64_SOURCE #include int main () { +#ifndef __HAIKU__ int fd; off64_t i = off64_t(1) << 32 + 1; const char * const name = "test.2g"; @@ -117,6 +118,7 @@ int main () { exit(1); } close(fd); +#endif return 0; }], large_file="yes") if [[ -n "$large_file" ]]; then diff --git a/port.h.in b/port.h.in index 70d748e..5cacfbc 100644 --- a/port.h.in +++ b/port.h.in @@ -23,7 +23,7 @@ // UNIX here typedef struct timeval TIMEVAL_TYPE; -#ifdef _LARGEFILE64_SOURCE +#if defined(_LARGEFILE64_SOURCE) && !defined(__HAIKU__) #define OFF_TYPE off64_t #define file_lseek lseek64 #define file_creat creat64 -- 2.23.0 From 1eb02eff5cf2312be970d008eb4f3af507d93f74 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Thu, 26 Sep 2019 19:18:42 +0200 Subject: gcc2 patch diff --git a/Makefile.in b/Makefile.in index 4f14819..121f30c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -8,7 +8,7 @@ SCRIPTS=bon_csv2txt prefix=@prefix@ eprefix=@exec_prefix@ #MORE_WARNINGS=-Weffc++ -WFLAGS=-Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security -Wswitch-enum -Winit-self $(MORE_WARNINGS) +WFLAGS=-Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security $(MORE_WARNINGS) CFLAGS=-O2 @debug@ -DNDEBUG $(WFLAGS) $(MORECFLAGS) CXX=@CXX@ $(CFLAGS) LINK=@CXX@ diff --git a/bon_time.cpp b/bon_time.cpp index 2da4f3d..f0da4af 100644 --- a/bon_time.cpp +++ b/bon_time.cpp @@ -6,6 +6,16 @@ #include #include +/* min and max comparisons */ +#if defined(__GNUC__) && __GNUC__ < 3 +# ifndef min +# define min(a,b) ((a)>(b)?(b):(a)) +# endif +# ifndef max +# define max(a,b) ((a)>(b)?(a):(b)) +# endif +#endif + void BonTimer::start() { m_dur.start(); -- 2.23.0