1 // --------------------------------------------------------------------- 2 // Copyright (C) 2015 Chris Garry 3 // 4 // This program is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program. If not, see <http://www.gnu.org/licenses/> 16 // --------------------------------------------------------------------- 17 18 19 #ifndef PIPP_UTF8_H 20 #define PIPP_UTF8_H 21 22 #ifdef HAVE_CONFIG_H 23 # include <config.h> 24 #endif 25 26 #include <cstdio> 27 #include <string> 28 29 #if defined(__unix__) || defined(OS_OSX) 30 #include <sys/param.h> // define or not BSD macro 31 #endif 32 33 // 64-bit fseek for various platforms 34 #ifdef __linux__ 35 #define fseek64 fseeko64 // Linux 36 #define ftell64 ftello64 // Linux 37 #elif defined (OS_OSX) 38 #define fseek64 fseeko // OS X 39 #define ftell64 ftello // OS X 40 #elif defined(BSD) 41 #define fseek64 fseeko // DragonFly BSD, FreeBSD, OpenBSD, NetBSD 42 #define ftell64 ftello // DragonFly BSD, FreeBSD, OpenBSD, NetBSD 43 #elif defined (__FreeBSD_kernel__) && defined (__GLIBC__) 44 #define fseek64 fseeko64 // KFreeBSD 45 #define ftell64 ftello64 // KFreeBSD 46 #elif defined (__gnu_hurd__) 47 #define fseek64 fseeko64 // GNU/Hurd 48 #define ftell64 ftello64 // GNU/Hurd 49 #elif defined(__CYGWIN__) 50 #define fseek64 fseeko // CYGWIN 51 #define ftell64 ftello // CYGWIN 52 #else 53 #define fseek64 _fseeki64 // Windows 54 #define ftell64 _ftelli64 // Windows 55 #endif 56 57 #endif // PIPP_UTF8_H 58