summaryrefslogtreecommitdiff
path: root/ext/bcmath
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:37:27 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:37:27 -0400
commit2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b (patch)
tree41ccc042009cba53e4ce43e727fcba4c1cfbf7f3 /ext/bcmath
parentd29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (diff)
downloadphp-2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b.tar.gz
Imported Upstream version 5.2.2upstream/5.2.2
Diffstat (limited to 'ext/bcmath')
-rw-r--r--ext/bcmath/bcmath.c46
-rw-r--r--ext/bcmath/libbcmath/src/output.c2
-rw-r--r--ext/bcmath/libbcmath/src/rt.c4
-rw-r--r--ext/bcmath/package.xml2
-rw-r--r--ext/bcmath/php_bcmath.h6
5 files changed, 24 insertions, 36 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index fc8d4ee66..6cbde85cd 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: bcmath.c,v 1.62.2.2.2.2 2006/06/15 18:33:06 dmitry Exp $ */
+/* $Id: bcmath.c,v 1.62.2.2.2.5 2007/01/01 09:35:48 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -33,6 +33,7 @@
ZEND_DECLARE_MODULE_GLOBALS(bcmath);
static PHP_GINIT_FUNCTION(bcmath);
+static PHP_GSHUTDOWN_FUNCTION(bcmath);
/* {{{ arginfo */
static
@@ -124,13 +125,13 @@ zend_module_entry bcmath_module_entry = {
bcmath_functions,
PHP_MINIT(bcmath),
PHP_MSHUTDOWN(bcmath),
- PHP_RINIT(bcmath),
- PHP_RSHUTDOWN(bcmath),
+ NULL,
+ NULL,
PHP_MINFO(bcmath),
NO_VERSION_YET,
PHP_MODULE_GLOBALS(bcmath),
PHP_GINIT(bcmath),
- NULL,
+ PHP_GSHUTDOWN(bcmath),
NULL,
STANDARD_MODULE_PROPERTIES_EX
};
@@ -150,6 +151,17 @@ PHP_INI_END()
static PHP_GINIT_FUNCTION(bcmath)
{
bcmath_globals->bc_precision = 0;
+ bc_init_numbers(TSRMLS_C);
+}
+/* }}} */
+
+/* {{{ PHP_GSHUTDOWN_FUNCTION
+ */
+static PHP_GSHUTDOWN_FUNCTION(bcmath)
+{
+ _bc_free_num_ex(&bcmath_globals->_zero_, 1);
+ _bc_free_num_ex(&bcmath_globals->_one_, 1);
+ _bc_free_num_ex(&bcmath_globals->_two_, 1);
}
/* }}} */
@@ -173,28 +185,6 @@ PHP_MSHUTDOWN_FUNCTION(bcmath)
}
/* }}} */
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(bcmath)
-{
- bc_init_numbers(TSRMLS_C);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(bcmath)
-{
- _bc_free_num_ex(&BCG(_zero_), 1);
- _bc_free_num_ex(&BCG(_one_), 1);
- _bc_free_num_ex(&BCG(_two_), 1);
-
- return SUCCESS;
-}
-/* }}} */
-
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(bcmath)
@@ -461,7 +451,7 @@ PHP_FUNCTION(bcpowmod)
long scale = BCG(bc_precision);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|l", &left, &left_len, &right, &right_len, &modulous, &modulous_len, &scale) == FAILURE) {
- WRONG_PARAM_COUNT;
+ return;
}
bc_init_num(&first TSRMLS_CC);
diff --git a/ext/bcmath/libbcmath/src/output.c b/ext/bcmath/libbcmath/src/output.c
index ab49b0e36..ad4e37546 100644
--- a/ext/bcmath/libbcmath/src/output.c
+++ b/ext/bcmath/libbcmath/src/output.c
@@ -71,7 +71,7 @@ bc_out_long (val, size, space, out_char)
int len, ix;
if (space) (*out_char) (' ');
- sprintf (digits, "%ld", val);
+ snprintf(digits, sizeof(digits), "%ld", val);
len = strlen (digits);
while (size > len)
{
diff --git a/ext/bcmath/libbcmath/src/rt.c b/ext/bcmath/libbcmath/src/rt.c
index 2479104fe..5a98b68f7 100644
--- a/ext/bcmath/libbcmath/src/rt.c
+++ b/ext/bcmath/libbcmath/src/rt.c
@@ -45,7 +45,7 @@ void bc_rt_warn (char *mesg ,...)
char error_mesg [255];
va_start (args, mesg);
- vsprintf (error_mesg, mesg, args);
+ vsnprintf (error_mesg, sizeof(error_mesg), mesg, args);
va_end (args);
fprintf (stderr, "bc math warning: %s\n", error_mesg);
@@ -58,7 +58,7 @@ void bc_rt_error (char *mesg ,...)
char error_mesg [255];
va_start (args, mesg);
- vsprintf (error_mesg, mesg, args);
+ vsnprintf (error_mesg, sizeof(error_mesg), mesg, args);
va_end (args);
fprintf (stderr, "bc math error: %s\n", error_mesg);
diff --git a/ext/bcmath/package.xml b/ext/bcmath/package.xml
index 876297e9f..3ef9773fe 100644
--- a/ext/bcmath/package.xml
+++ b/ext/bcmath/package.xml
@@ -21,7 +21,7 @@ which supports numbers of any size and precision, represented as strings.
<version>5.0.0rc1</version>
<date>2004-03-19</date>
<notes>
-package.xml added to support intallation using pear installer
+package.xml added to support installation using pear installer
</notes>
<filelist>
<file role="doc" name="CREDITS"/>
diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h
index b6f144350..c3d4b6915 100644
--- a/ext/bcmath/php_bcmath.h
+++ b/ext/bcmath/php_bcmath.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_bcmath.h,v 1.20.2.1 2006/01/01 12:50:00 sniper Exp $ */
+/* $Id: php_bcmath.h,v 1.20.2.1.2.2 2007/01/01 09:35:48 sebastian Exp $ */
#ifndef PHP_BCMATH_H
#define PHP_BCMATH_H
@@ -30,8 +30,6 @@ extern zend_module_entry bcmath_module_entry;
PHP_MINIT_FUNCTION(bcmath);
PHP_MSHUTDOWN_FUNCTION(bcmath);
-PHP_RINIT_FUNCTION(bcmath);
-PHP_RSHUTDOWN_FUNCTION(bcmath);
PHP_MINFO_FUNCTION(bcmath);
PHP_FUNCTION(bcadd);