diff options
Diffstat (limited to 'ext/fileinfo/libmagic/readelf.c')
| -rw-r--r-- | ext/fileinfo/libmagic/readelf.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/ext/fileinfo/libmagic/readelf.c b/ext/fileinfo/libmagic/readelf.c index ec316b6bbd..3b0aae54c1 100644 --- a/ext/fileinfo/libmagic/readelf.c +++ b/ext/fileinfo/libmagic/readelf.c @@ -42,13 +42,13 @@ FILE_RCSID("@(#)$File: readelf.c,v 1.99 2013/11/05 15:44:01 christos Exp $") #include "magic.h" #ifdef ELFCORE -private int dophn_core(struct magic_set *, int, int, int, php_off_t, int, size_t, - php_off_t, int *); +private int dophn_core(struct magic_set *, int, int, int, zend_off_t, int, size_t, + zend_off_t, int *); #endif private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t, - php_off_t, int *, int); + zend_off_t, int *, int); private int doshn(struct magic_set *, int, int, int, off_t, int, size_t, - php_off_t, int *, int); + zend_off_t, int *, int); private size_t donote(struct magic_set *, unsigned char *, size_t, size_t, int, int, size_t, int *); @@ -144,7 +144,7 @@ getu64(int swap, uint64_t value) #define xsh_size (size_t)(clazz == ELFCLASS32 \ ? elf_getu32(swap, sh32.sh_size) \ : elf_getu64(swap, sh64.sh_size)) -#define xsh_offset (php_off_t)(clazz == ELFCLASS32 \ +#define xsh_offset (zend_off_t)(clazz == ELFCLASS32 \ ? elf_getu32(swap, sh32.sh_offset) \ : elf_getu64(swap, sh64.sh_offset)) #define xsh_type (clazz == ELFCLASS32 \ @@ -162,13 +162,13 @@ getu64(int swap, uint64_t value) #define xph_type (clazz == ELFCLASS32 \ ? elf_getu32(swap, ph32.p_type) \ : elf_getu32(swap, ph64.p_type)) -#define xph_offset (php_off_t)(clazz == ELFCLASS32 \ +#define xph_offset (zend_off_t)(clazz == ELFCLASS32 \ ? elf_getu32(swap, ph32.p_offset) \ : elf_getu64(swap, ph64.p_offset)) #define xph_align (size_t)((clazz == ELFCLASS32 \ - ? (php_off_t) (ph32.p_align ? \ + ? (zend_off_t) (ph32.p_align ? \ elf_getu32(swap, ph32.p_align) : 4) \ - : (php_off_t) (ph64.p_align ? \ + : (zend_off_t) (ph64.p_align ? \ elf_getu64(swap, ph64.p_align) : 4))) #define xph_filesz (size_t)((clazz == ELFCLASS32 \ ? elf_getu32(swap, ph32.p_filesz) \ @@ -293,8 +293,8 @@ private const char os_style_names[][8] = { #define FLAGS_IS_CORE 0x10 private int -dophn_core(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, - int num, size_t size, php_off_t fsize, int *flags) +dophn_core(struct magic_set *ms, int clazz, int swap, int fd, zend_off_t off, + int num, size_t size, zend_off_t fsize, int *flags) { Elf32_Phdr ph32; Elf64_Phdr ph64; @@ -312,7 +312,7 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, * Loop through all the program headers. */ for ( ; num; num--) { - if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -334,7 +334,7 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, * This is a PT_NOTE section; loop through all the notes * in the section. */ - if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -917,7 +917,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, Elf64_Shdr sh64; int stripped = 1; void *nbuf; - php_off_t noff, coff, name_off; + zend_off_t noff, coff, name_off; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ uint64_t cap_sf1 = 0; /* SunOS 5.x software capabilites */ char name[50]; @@ -929,7 +929,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, } for ( ; num; num--) { - if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -959,8 +959,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, switch (xsh_type) { case SHT_NOTE: nbuf = emalloc((size_t)xsh_size); - if ((noff = FINFO_LSEEK_FUNC(fd, (php_off_t)xsh_offset, SEEK_SET)) == - (php_off_t)-1) { + if ((noff = FINFO_LSEEK_FUNC(fd, (zend_off_t)xsh_offset, SEEK_SET)) == + (zend_off_t)-1) { file_badread(ms); efree(nbuf); return -1; @@ -974,7 +974,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, noff = 0; for (;;) { - if (noff >= (php_off_t)xsh_size) + if (noff >= (zend_off_t)xsh_size) break; noff = donote(ms, nbuf, (size_t)noff, (size_t)xsh_size, clazz, swap, 4, @@ -985,8 +985,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, efree(nbuf); break; case SHT_SUNW_cap: - if (FINFO_LSEEK_FUNC(fd, (php_off_t)xsh_offset, SEEK_SET) == - (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, (zend_off_t)xsh_offset, SEEK_SET) == + (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -996,7 +996,7 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, Elf64_Cap cap64; char cbuf[/*CONSTCOND*/ MAX(sizeof cap32, sizeof cap64)]; - if ((coff += xcap_sizeof) > (php_off_t)xsh_size) + if ((coff += xcap_sizeof) > (zend_off_t)xsh_size) break; if (FINFO_READ_FUNC(fd, cbuf, (size_t)xcap_sizeof) != (ssize_t)xcap_sizeof) { @@ -1099,8 +1099,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, * otherwise it's statically linked. */ private int -dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, - int num, size_t size, php_off_t fsize, int *flags, int sh_num) +dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, zend_off_t off, + int num, size_t size, zend_off_t fsize, int *flags, int sh_num) { Elf32_Phdr ph32; Elf64_Phdr ph64; @@ -1117,7 +1117,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, } for ( ; num; num--) { - if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -1161,7 +1161,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, php_off_t off, * This is a PT_NOTE section; loop through all the notes * in the section. */ - if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (php_off_t)-1) { + if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (zend_off_t)-1) { file_badseek(ms); return -1; } @@ -1204,7 +1204,7 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf, int clazz; int swap; struct stat st; - php_off_t fsize; + zend_off_t fsize; int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; @@ -1227,7 +1227,7 @@ file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf, /* * If we cannot seek, it must be a pipe, socket or fifo. */ - if((FINFO_LSEEK_FUNC(fd, (php_off_t)0, SEEK_SET) == (php_off_t)-1) && (errno == ESPIPE)) + if((FINFO_LSEEK_FUNC(fd, (zend_off_t)0, SEEK_SET) == (zend_off_t)-1) && (errno == ESPIPE)) fd = file_pipe2file(ms, fd, buf, nbytes); if (fstat(fd, &st) == -1) { |
