1 /* 2 +----------------------------------------------------------------------+ 3 | Copyright (c) The PHP Group | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | https://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Author: Anatol Belski <ab@php.net> | 14 +----------------------------------------------------------------------+ 15 */ 16 17 #ifndef PHP_LIBMAGIC_H 18 #define PHP_LIBMAGIC_H 19 20 #include "php_fileinfo.h" 21 22 #include "main/php_network.h" 23 #include "ext/standard/php_string.h" 24 #include "ext/pcre/php_pcre.h" 25 26 #ifdef PHP_WIN32 27 #include "win32/param.h" 28 #include "win32/unistd.h" 29 30 #ifdef _WIN64 31 #define FINFO_LSEEK_FUNC _lseeki64 32 #else 33 #define FINFO_LSEEK_FUNC _lseek 34 #endif 35 #define FINFO_READ_FUNC _read 36 37 #define strtoull _strtoui64 38 39 40 #define HAVE_ASCTIME_R 1 41 #define asctime_r php_asctime_r 42 #define HAVE_CTIME_R 1 43 #define ctime_r php_ctime_r 44 45 #else 46 #define FINFO_LSEEK_FUNC lseek 47 #define FINFO_READ_FUNC read 48 #endif 49 50 #if defined(__hpux) && !defined(HAVE_STRTOULL) 51 #if SIZEOF_LONG == 8 52 # define strtoull strtoul 53 #else 54 # define strtoull __strtoull 55 #endif 56 #endif 57 58 #ifndef offsetof 59 #define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD)) 60 #endif 61 62 #ifndef UINT32_MAX 63 # define UINT32_MAX (0xffffffff) 64 #endif 65 66 #ifndef PREG_OFFSET_CAPTURE 67 # define PREG_OFFSET_CAPTURE (1<<8) 68 #endif 69 70 #define abort() zend_error_noreturn(E_ERROR, "fatal libmagic error") 71 72 zend_string* convert_libmagic_pattern(const char *val, size_t len, uint32_t options); 73 74 #endif /* PHP_LIBMAGIC_H */ 75