]> granicus.if.org Git - php/commitdiff
Per Sterling's request I'm committing this.
authorfoobar <sniper@php.net>
Sun, 27 May 2001 19:43:16 +0000 (19:43 +0000)
committerfoobar <sniper@php.net>
Sun, 27 May 2001 19:43:16 +0000 (19:43 +0000)
This works fine for me now. (I'm using external iconv libs)

ext/iconv/iconv.c
ext/iconv/php_iconv.h

index 7067bab1acf5adf628ffedfd795c8bae01cc3536..77a3bc79603bb8e76c81aba0e49d1a951caa9625 100644 (file)
 #endif
 
 #include "php.h"
-#include "php_ini.h"
 
 #if HAVE_ICONV
 
+#include <iconv.h>
+
+#include "php_globals.h"
 #include "php_iconv.h"
 #include "ext/standard/info.h"
 #include "ext/standard/php_output.h"
+#include "SAPI.h"
+#include "php_ini.h"
 
-ZEND_DECLARE_MODULE_GLOBALS(iconv)
 
 #if HAVE_LIBICONV
 #define icv_open(a,b) libiconv_open(a,b)
@@ -43,9 +46,6 @@ ZEND_DECLARE_MODULE_GLOBALS(iconv)
 #endif
 
 
-/* True global resources - no need for thread safety here */
-static int le_iconv;
-
 /* Every user visible function must have an entry in iconv_functions[].
 */
 function_entry iconv_functions[] = {
@@ -59,28 +59,29 @@ function_entry iconv_functions[] = {
 zend_module_entry iconv_module_entry = {
        "iconv",
        iconv_functions,
-       PHP_MINIT(iconv),
-       PHP_MSHUTDOWN(iconv),
+       PHP_MINIT(miconv),
+       PHP_MSHUTDOWN(miconv),
        NULL,
        NULL,
-       PHP_MINFO(iconv),
+       PHP_MINFO(miconv),
        STANDARD_MODULE_PROPERTIES
 };
 
+ZEND_DECLARE_MODULE_GLOBALS(iconv)
+
 #ifdef COMPILE_DL_ICONV
 ZEND_GET_MODULE(iconv)
 #endif
 
 int php_iconv_string(char *, char **, char *, char *);
 
-
 PHP_INI_BEGIN()
-        STD_PHP_INI_ENTRY("iconv.input_encoding",              ICONV_INPUT_ENCODING,           PHP_INI_ALL,            OnUpdateString,  input_encoding,                zend_iconv_globals,  iconv_globals)
-        STD_PHP_INI_ENTRY("iconv.output_encoding",             ICONV_OUTPUT_ENCODING,          PHP_INI_ALL,            OnUpdateString,  output_encoding,               zend_iconv_globals,  iconv_globals)
-        STD_PHP_INI_ENTRY("iconv.internal_encoding",           ICONV_INTERNAL_ENCODING,                PHP_INI_ALL,            OnUpdateString,  internal_encoding,             zend_iconv_globals,  iconv_globals)
+        STD_PHP_INI_ENTRY("iconv.input_encoding",        ICONV_INPUT_ENCODING,    PHP_INI_ALL, OnUpdateString,  input_encoding,        zend_iconv_globals,  iconv_globals)
+        STD_PHP_INI_ENTRY("iconv.output_encoding",       ICONV_OUTPUT_ENCODING,   PHP_INI_ALL, OnUpdateString,  output_encoding,       zend_iconv_globals,  iconv_globals)
+        STD_PHP_INI_ENTRY("iconv.internal_encoding", ICONV_INTERNAL_ENCODING, PHP_INI_ALL, OnUpdateString,  internal_encoding, zend_iconv_globals,  iconv_globals)
 PHP_INI_END()
 
-static void
+static void 
 php_iconv_init_globals(zend_iconv_globals *iconv_globals)
 {
        iconv_globals->input_encoding = NULL;
@@ -88,20 +89,20 @@ php_iconv_init_globals(zend_iconv_globals *iconv_globals)
        iconv_globals->internal_encoding = NULL;
 }
 
-PHP_MINIT_FUNCTION(iconv)
+PHP_MINIT_FUNCTION(miconv)
 {
        ZEND_INIT_MODULE_GLOBALS(iconv, php_iconv_init_globals, NULL);
        REGISTER_INI_ENTRIES();
        return SUCCESS;
 }
 
-PHP_MSHUTDOWN_FUNCTION(iconv)
+PHP_MSHUTDOWN_FUNCTION(miconv)
 {
        UNREGISTER_INI_ENTRIES();
        return SUCCESS;
 }
 
-PHP_MINFO_FUNCTION(iconv)
+PHP_MINFO_FUNCTION(miconv)
 {
        php_info_print_table_start();
        php_info_print_table_header(2, "iconv support", "enabled");
@@ -153,11 +154,8 @@ int php_iconv_string(char *in_p, char **out, char *in_charset, char *out_charset
 PHP_FUNCTION(iconv)
 {
     zval **in_charset, **out_charset, **in_buffer;
-    unsigned int in_size, out_size;
-    char *out_buffer, *in_p, *out_p;
-    size_t result;
-    typedef unsigned int ucs4_t;
-
+       char *out_buffer;
+       
     if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &in_charset, &out_charset, &in_buffer) == FAILURE) {
         WRONG_PARAM_COUNT;
     }
@@ -166,8 +164,7 @@ PHP_FUNCTION(iconv)
     convert_to_string_ex(out_charset);
     convert_to_string_ex(in_buffer);
 
-       if (php_iconv_string(Z_STRVAL_PP(in_buffer), &out_buffer, 
-                                                Z_STRVAL_PP(in_charset), Z_STRVAL_PP(out_charset)) == SUCCESS) {
+       if (php_iconv_string(Z_STRVAL_PP(in_buffer), &out_buffer, Z_STRVAL_PP(in_charset), Z_STRVAL_PP(out_charset)) == SUCCESS) {
                RETVAL_STRING(out_buffer, 0);
        } else {
                RETURN_FALSE;
@@ -179,7 +176,6 @@ PHP_FUNCTION(iconv)
    Returns str in output buffer converted to the iconv.output_encoding character set */
 PHP_FUNCTION(ob_iconv_handler)
 {
-       int coding;
        char *out_buffer;
        zval **zv_string, **zv_status;
        SLS_FETCH();
index 0f9e36204d58204f7fceb3bd22dae813eb1a3a75..2178fa2e4e1aed77923c333370557b55f31c0e1e 100644 (file)
 #ifndef PHP_ICONV_H
 #define PHP_ICONV_H
 
-#include <iconv.h>
-#include "php.h"
-#include "SAPI.h"
-
-extern zend_module_entry iconv_module_entry;
-#define phpext_iconv_ptr &iconv_module_entry
-
 #ifdef PHP_WIN32
 #define PHP_ICONV_API __declspec(dllexport)
 #else
 #define PHP_ICONV_API
 #endif
 
-PHP_MINIT_FUNCTION(iconv);
-PHP_MSHUTDOWN_FUNCTION(iconv);
-PHP_RINIT_FUNCTION(iconv);
-PHP_RSHUTDOWN_FUNCTION(iconv);
-PHP_MINFO_FUNCTION(iconv);
+extern zend_module_entry iconv_module_entry;
+#define phpext_iconv_ptr &iconv_module_entry
+
+PHP_MINIT_FUNCTION(miconv);
+PHP_MSHUTDOWN_FUNCTION(miconv);
+PHP_MINFO_FUNCTION(miconv);
 
 PHP_FUNCTION(iconv);
 PHP_FUNCTION(ob_iconv_handler);