pajoye Thu Nov 6 13:56:49 2008 UTC Modified files: /php-src/ext/fileinfo config.w32 fileinfo.c /php-src/ext/fileinfo/libmagic apprentice.c softmagic.c Log: - MFH - add 64bit typedef support - fix vc6 build (1/2) - still broken/does not build cleanly, more to come http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/config.w32?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/fileinfo/config.w32 diff -u php-src/ext/fileinfo/config.w32:1.3 php-src/ext/fileinfo/config.w32:1.4 --- php-src/ext/fileinfo/config.w32:1.3 Thu Jul 31 13:14:22 2008 +++ php-src/ext/fileinfo/config.w32 Thu Nov 6 13:56:48 2008 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.3 2008/07/31 13:14:22 pajoye Exp $ +// $Id: config.w32,v 1.4 2008/11/06 13:56:48 pajoye Exp $ // vim:ft=javascript ARG_ENABLE("fileinfo", "fileinfo support", "no"); @@ -13,6 +13,10 @@ magic.c print.c \ readelf.c softmagic.c"; + if (VCVERS <1500) { + ADD_FLAG('CFLAGS', '/Zm1000'); + } + EXTENSION('fileinfo', 'fileinfo.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname); ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo"); } else { http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/fileinfo.c?r1=1.38&r2=1.39&diff_format=u Index: php-src/ext/fileinfo/fileinfo.c diff -u php-src/ext/fileinfo/fileinfo.c:1.38 php-src/ext/fileinfo/fileinfo.c:1.39 --- php-src/ext/fileinfo/fileinfo.c:1.38 Sun Nov 2 21:10:07 2008 +++ php-src/ext/fileinfo/fileinfo.c Thu Nov 6 13:56:48 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: fileinfo.c,v 1.38 2008/11/02 21:10:07 felipe Exp $ */ +/* $Id: fileinfo.c,v 1.39 2008/11/06 13:56:48 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -324,7 +324,7 @@ RETURN_FALSE; } - if (file && *file) { /* user specified filed, perform open_basedir checks */ + if (file && *file) { /* user specified file, perform open_basedir checks */ if (!VCWD_REALPATH(file, resolved_path)) { RETURN_FALSE; } @@ -533,9 +533,6 @@ php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb", REPORT_ERRORS, NULL, context); if (!stream) { - if (mimetype_emu) { - magic_close(magic); - } RETVAL_FALSE; goto clean; } @@ -545,6 +542,7 @@ } break; } + default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only process string or stream arguments"); } http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/libmagic/apprentice.c?r1=1.17&r2=1.18&diff_format=u Index: php-src/ext/fileinfo/libmagic/apprentice.c diff -u php-src/ext/fileinfo/libmagic/apprentice.c:1.17 php-src/ext/fileinfo/libmagic/apprentice.c:1.18 --- php-src/ext/fileinfo/libmagic/apprentice.c:1.17 Sun Nov 2 16:09:26 2008 +++ php-src/ext/fileinfo/libmagic/apprentice.c Thu Nov 6 13:56:49 2008 @@ -584,7 +584,7 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs, struct magic_entry **marray, uint32_t *marraycount) { - zstr buffer; + char buffer[BUFSIZ + 1]; char *line; size_t line_len; size_t lineno = 0; @@ -598,13 +598,14 @@ #else stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL); #endif + if (stream == NULL) { if (errno != ENOENT) file_error(ms, errno, "cannot read magic file `%s'", fn); (*errs)++; } else { - buffer.v = emalloc(BUFSIZ+1); + /* read and parse this file */ for (ms->line = 1; (line = php_stream_get_line(stream, buffer , BUFSIZ, &line_len)) != NULL; ms->line++) { if (line_len == 0) /* null line, garbage, etc */ @@ -652,7 +653,7 @@ if (parse(ms, marray, marraycount, line, lineno, action) != 0) (*errs)++; } - efree(buffer.v); + php_stream_close(stream); } } http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/libmagic/softmagic.c?r1=1.9&r2=1.10&diff_format=u Index: php-src/ext/fileinfo/libmagic/softmagic.c diff -u php-src/ext/fileinfo/libmagic/softmagic.c:1.9 php-src/ext/fileinfo/libmagic/softmagic.c:1.10 --- php-src/ext/fileinfo/libmagic/softmagic.c:1.9 Thu Nov 6 02:58:14 2008 +++ php-src/ext/fileinfo/libmagic/softmagic.c Thu Nov 6 13:56:49 2008 @@ -582,16 +582,16 @@ if (m->num_mask) \ switch (m->mask_op & FILE_OPS_MASK) { \ case FILE_OPADD: \ - p->fld += cast m->num_mask; \ + p->fld += cast (int64_t)m->num_mask; \ break; \ case FILE_OPMINUS: \ - p->fld -= cast m->num_mask; \ + p->fld -= cast (int64_t)m->num_mask; \ break; \ case FILE_OPMULTIPLY: \ - p->fld *= cast m->num_mask; \ + p->fld *= cast (int64_t)m->num_mask; \ break; \ case FILE_OPDIVIDE: \ - p->fld /= cast m->num_mask; \ + p->fld /= cast (int64_t)m->num_mask; \ break; \ } \ @@ -1865,7 +1865,7 @@ case 'x': if ((ms->flags & MAGIC_DEBUG) != 0) (void) fprintf(stderr, "%llu == *any* = 1\n", - (unsigned long long)v); + (uint64_t)v); matched = 1; break; @@ -1873,7 +1873,7 @@ matched = v != l; if ((ms->flags & MAGIC_DEBUG) != 0) (void) fprintf(stderr, "%llu != %llu = %d\n", - (unsigned long long)v, (unsigned long long)l, + (uint64_t)v, (uint64_t)l, matched); break; @@ -1881,7 +1881,7 @@ matched = v == l; if ((ms->flags & MAGIC_DEBUG) != 0) (void) fprintf(stderr, "%llu == %llu = %d\n", - (unsigned long long)v, (unsigned long long)l, + (uint64_t)v, (uint64_t)l, matched); break; @@ -1890,14 +1890,14 @@ matched = v > l; if ((ms->flags & MAGIC_DEBUG) != 0) (void) fprintf(stderr, "%llu > %llu = %d\n", - (unsigned long long)v, - (unsigned long long)l, matched); + (uint64_t)v, + (uint64_t)l, matched); } else { matched = (int64_t) v > (int64_t) l; if ((ms->flags & MAGIC_DEBUG) != 0) (void) fprintf(stderr, "%lld > %lld = %d\n", - (long long)v, (long long)l, matched); + (uint64_t)v, (uint64_t)l, matched); } break; @@ -1906,14 +1906,14 @@ matched = v < l; if ((ms->flags & MAGIC_DEBUG) != 0) (void) fprintf(stderr, "%llu < %llu = %d\n", - (unsigned long long)v, - (unsigned long long)l, matched); + (uint64_t)v, + (uint64_t)l, matched); } else { matched = (int64_t) v < (int64_t) l; if ((ms->flags & MAGIC_DEBUG) != 0) (void) fprintf(stderr, "%lld < %lld = %d\n", - (long long)v, (long long)l, matched); + (int64_t)v, (int64_t)l, matched); } break; @@ -1921,16 +1921,16 @@ matched = (v & l) == l; if ((ms->flags & MAGIC_DEBUG) != 0) (void) fprintf(stderr, "((%llx & %llx) == %llx) = %d\n", - (unsigned long long)v, (unsigned long long)l, - (unsigned long long)l, matched); + (uint64_t)v, (uint64_t)l, + (uint64_t)l, matched); break; case '^': matched = (v & l) != l; if ((ms->flags & MAGIC_DEBUG) != 0) (void) fprintf(stderr, "((%llx & %llx) != %llx) = %d\n", - (unsigned long long)v, (unsigned long long)l, - (unsigned long long)l, matched); + (uint64_t)v, (uint64_t)l, + (uint64_t)l, matched); break; default:
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php