cvs: php4 /ext/mime_magic mime_magic.c

From: Date: Tue, 21 May 2002 10:14:12 +0000
Subject: cvs: php4 /ext/mime_magic mime_magic.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12029@lists.php.net to get a copy of this message
hholzgra Tue May 21 06:14:12 2002 EDT Modified files: /php4/ext/mime_magic mime_magic.c Log: not beautifull (yet), but should fix ZTS builds Index: php4/ext/mime_magic/mime_magic.c diff -u php4/ext/mime_magic/mime_magic.c:1.4 php4/ext/mime_magic/mime_magic.c:1.5 --- php4/ext/mime_magic/mime_magic.c:1.4 Wed Mar 27 08:51:55 2002 +++ php4/ext/mime_magic/mime_magic.c Tue May 21 06:14:12 2002 @@ -15,7 +15,7 @@ | Author: Hartmut Holzgraefe <hartmut@six.de> | +----------------------------------------------------------------------+ - $Id: mime_magic.c,v 1.4 2002/03/27 13:51:55 hholzgra Exp $ + $Id: mime_magic.c,v 1.5 2002/05/21 10:14:12 hholzgra Exp $ This module contains a lot of stuff taken from Apache mod_mime_magic, so the lincense section is a little bit longer than usual: @@ -238,7 +238,7 @@ /* {{{ PHP_INI */ PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("mime_magic.magicfile", "/usr/share/misc/magic.mime", PHP_INI_SYSTEM, OnUpdateString, magicfile, zend_mime_magic_globals, mime_magic_globals) +STD_PHP_INI_ENTRY("mime_magic.magicfile", "/usr/share/misc/magic.mime", PHP_INI_SYSTEM, OnUpdateString, magicfile, zend_mime_magic_globals, mime_magic_globals) PHP_INI_END() /* }}} */ @@ -246,7 +246,7 @@ */ static void php_mime_magic_init_globals(zend_mime_magic_globals *mime_magic_globals) { - mime_magic_globals->magicfile = NULL; + mime_global.magicfile = NULL; } /* }}} */ @@ -257,11 +257,11 @@ ZEND_INIT_MODULE_GLOBALS(mime_magic, php_mime_magic_init_globals, NULL); REGISTER_INI_ENTRIES(); - if(mime_magic_globals.magicfile) { - mime_global.magicfile = mime_magic_globals.magicfile; + mime_global.magicfile = MIME_MAGIC_G(magicfile); + + if(mime_global.magicfile) { apprentice(); } - return SUCCESS; } /* }}} */ @@ -330,7 +330,7 @@ RETURN_FALSE; } - magic_set_config(); + MIME_MAGIC_G(req_dat) = magic_set_config(); if(MIME_MAGIC_OK != magic_process(filename)) { RETVAL_FALSE; @@ -877,7 +877,6 @@ magic_req_rec *req_dat = (magic_req_rec *) emalloc(sizeof(magic_req_rec)); req_dat->head = req_dat->tail = (magic_rsl *) NULL; - MIME_MAGIC_G(req_dat) = req_dat; return req_dat; } @@ -901,10 +900,13 @@ /* it is the responsibility of the caller to allocate "str" */ static int magic_rsl_add(char *str) { - magic_req_rec *req_dat = MIME_MAGIC_G(req_dat); + magic_req_rec *req_dat; magic_rsl *rsl; + TSRMLS_FETCH(); - /* make sure we have a list to put it in */ + req_dat = MIME_MAGIC_G(req_dat); + + /* make sure we have a list to put it in */ if (!req_dat) { php_error(E_WARNING, MODNAME ": request config should not be NULL"); @@ -975,7 +977,10 @@ cur_pos, /* current position within fragment */ res_pos; /* position in result string */ magic_rsl *frag; /* list-traversal pointer */ - magic_req_rec *req_dat = MIME_MAGIC_G(req_dat); + magic_req_rec *req_dat; + TSRMLS_FETCH(); + + req_dat = MIME_MAGIC_G(req_dat); /* allocate the result string */ result = (char *) emalloc(len + 1); @@ -1729,10 +1734,6 @@ static int zmagic(unsigned char *buf, int nbytes) { - unsigned char *newbuf; - int newsize; - int i; - if (buf[0] != 0x1f) return 0; switch(buf[1]) { @@ -1872,7 +1873,11 @@ magic_rsl *frag; /* list-traversal pointer */ rsl_states state; - magic_req_rec *req_dat = MIME_MAGIC_G(req_dat); + magic_req_rec *req_dat; + + TSRMLS_FETCH(); + + req_dat = MIME_MAGIC_G(req_dat); /* check if we have a result */ if (!req_dat || !req_dat->head) {

« previous php.cvs (#12029) next »