From df965e200c905de75c5c331b244c5f61f9c22c38 Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Fri, 13 Jul 2001 16:58:09 +0000 Subject: [PATCH] Add fdf_set_encoding() --- NEWS | 3 +++ ext/fdf/fdf.c | 34 ++++++++++++++++++++++++++++++++++ ext/fdf/php_fdf.h | 1 + 3 files changed, 38 insertions(+) diff --git a/NEWS b/NEWS index 167443332f..34544178ba 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ PHP 4.0 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 200?, Version 4.0.7-dev +- Add fdf_set_encoding() function (Masaki YATSU, Rasmus) +- Fix return value for a failed snmpset() - now returns false (Rasmus) +- Add hostname:port support to snmp functions (nbougues@axialys.net, Rasmus) - Reversed the destruction-order of resources. This fixes the reported OCI8 "failed to rollback outstanding transactions!" message. (Thies Zend Engine) - Added option for returning XMLRPC fault packets. (Matt Allen, Sascha diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c index 78a08c3c91..6f7910813f 100644 --- a/ext/fdf/fdf.c +++ b/ext/fdf/fdf.c @@ -62,6 +62,7 @@ function_entry fdf_functions[] = { PHP_FE(fdf_set_opt, NULL) PHP_FE(fdf_set_submit_form_action, NULL) PHP_FE(fdf_set_javascript_action, NULL) + PHP_FE(fdf_set_encoding, NULL) {NULL, NULL, NULL} }; /* }}} */ @@ -685,6 +686,38 @@ PHP_FUNCTION(fdf_set_javascript_action) } /* }}} */ +/* {{{ fdf_set_encoding(int fdf_document, string encoding) + Sets FDF encoding (either "Shift-JIS" or "Unicode") */ +PHP_FUNCTION(fdf_set_encoding) { + pval **arg1, **arg2; + int id, type; + FDFDoc fdf; + FDFErc err; + FDF_TLS_VARS; + + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long_ex(arg1); + convert_to_string_ex(arg2); + id=(*arg1)->value.lval; + fdf = zend_list_find(id,&type); + if(!fdf || type!=FDF_GLOBAL(le_fdf)) { + php_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + err = FDFSetEncoding(fdf, (*arg2)->value.str.val); + + if(err != FDFErcOK) { + printf("error setting encoding\n"); + } + + RETURN_TRUE; +} +/* }}} */ + /* {{{ SAPI_POST_HANDLER_FUNC * SAPI post handler for FDF forms */ SAPI_POST_HANDLER_FUNC(fdf_post_handler) @@ -757,6 +790,7 @@ SAPI_POST_HANDLER_FUNC(fdf_post_handler) } /* }}} */ + #endif /* diff --git a/ext/fdf/php_fdf.h b/ext/fdf/php_fdf.h index e475fbe5a4..fb8f499f7e 100644 --- a/ext/fdf/php_fdf.h +++ b/ext/fdf/php_fdf.h @@ -53,6 +53,7 @@ PHP_FUNCTION(fdf_set_flags); PHP_FUNCTION(fdf_set_opt); PHP_FUNCTION(fdf_set_submit_form_action); PHP_FUNCTION(fdf_set_javascript_action); +PHP_FUNCTION(fdf_set_encoding); #else #define fdf_module_ptr NULL -- 2.40.0