- ditch some warnings
[m6w6/ext-http] / php_http_cache_api.h
index be73fa6aea310173cdc431441b7a290c701560ff..e6c0838c8cec6a62c2715b842588f1acf7194e50 100644 (file)
@@ -1,16 +1,13 @@
 /*
-   +----------------------------------------------------------------------+
-   | PECL :: http                                                         |
-   +----------------------------------------------------------------------+
-   | This source file is subject to version 3.0 of the PHP license, that  |
-   | is bundled with this package in the file LICENSE, and is available   |
-   | through the world-wide-web at http://www.php.net/license/3_0.txt.    |
-   | If you did not receive a copy of the PHP license and are unable to   |
-   | obtain it through the world-wide-web, please send a note to          |
-   | license@php.net so we can mail you a copy immediately.               |
-   +----------------------------------------------------------------------+
-   | Copyright (c) 2004-2005 Michael Wallner <mike@php.net>               |
-   +----------------------------------------------------------------------+
+    +--------------------------------------------------------------------+
+    | PECL :: http                                                       |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted provided that the conditions mentioned |
+    | in the accompanying LICENSE file are met.                          |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2004-2005, Michael Wallner <mike@php.net>            |
+    +--------------------------------------------------------------------+
 */
 
 /* $Id$ */
 
 ZEND_EXTERN_MODULE_GLOBALS(http);
 
-#define http_cache_global_init() _http_cache_global_init(INIT_FUNC_ARGS_PASSTHRU)
-extern STATUS _http_cache_global_init(INIT_FUNC_ARGS);
-
 typedef enum {
        HTTP_ETAG_CRC32 = -3,
        HTTP_ETAG_MD5 = -2,
        HTTP_ETAG_SHA1 = -1,
 } http_etag_mode;
 
+extern PHP_MINIT_FUNCTION(http_cache);
+
 #ifdef HTTP_HAVE_MHASH
 static void *http_etag_alloc_mhash_digest(size_t size)
 {
@@ -78,8 +74,8 @@ static inline void *_http_etag_init(TSRMLS_D)
        switch (mode)
        {
                case HTTP_ETAG_CRC32:
-                       ctx = emalloc(sizeof(unsigned int));
-                       memset(ctx, 1, sizeof(unsigned int));
+                       ctx = emalloc(sizeof(uint));
+                       *((uint *) ctx) = ~0;
                break;
                
                case HTTP_ETAG_SHA1:
@@ -113,9 +109,9 @@ static inline void _http_etag_free(void **ctx_ptr TSRMLS_DC)
        switch (mode)
        {
                case HTTP_ETAG_CRC32:
-                       if (*((unsigned int **) ctx_ptr)) {
-                               efree(*((unsigned int **) ctx_ptr));
-                               *((unsigned int **) ctx_ptr) = NULL;
+                       if (*((uint **) ctx_ptr)) {
+                               efree(*((uint **) ctx_ptr));
+                               *((uint **) ctx_ptr) = NULL;
                        }
                break;
                
@@ -158,8 +154,8 @@ static inline char *_http_etag_finish(void **ctx_ptr TSRMLS_DC)
        switch (mode)
        {
                case HTTP_ETAG_CRC32:
-                       **((unsigned int **) ctx_ptr) = ~**((unsigned int **) ctx_ptr);
-                       etag = http_etag_digest(*((const unsigned char **) ctx_ptr), sizeof(unsigned int));
+                       **((uint **) ctx_ptr) = ~**((uint **) ctx_ptr);
+                       etag = http_etag_digest(*((const unsigned char **) ctx_ptr), sizeof(uint));
                break;
                
                case HTTP_ETAG_SHA1:
@@ -200,12 +196,12 @@ static inline void _http_etag_update(void *ctx, const char *data_ptr, size_t dat
        {
                case HTTP_ETAG_CRC32:
                {
-                       unsigned int i, c = *((unsigned int *) ctx);
+                       uint i, c = *((uint *) ctx);
                        
                        for (i = 0; i < data_len; ++i) {
                                c = CRC32(c, data_ptr[i]);
                        }
-                       *((unsigned int *)ctx) = c;
+                       *((uint *)ctx) = c;
                }
                break;