#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)
#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[] = {
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;
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");
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;
}
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;
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();