PHP CVS 15 CVS PHP SRC PHP 4 3 EXT MCVE MCVE C
Date: Wed, 09 Jul 2003 13:48:28 -0000

Subject: cvs: php-src(PHP_4_3) /ext/mcve mcve.c
From: bradmssw@no-spam (Brad House)

bradmssw Wed Jul 9 09:48:28 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/ext/mcve mcve.c Log:
bugfixes: typecasting issues. don't assume long and int are the same size, as they are not on 64bit architectures. New CONSTANTS were not cast at all yet. MC_TTID was cast as a long, when it should have been a MCVE_int64 (normally long long).

Index: php-src/ext/mcve/mcve.c diff -u php-src/ext/mcve/mcve.c:1.14.2.3 php-src/ext/mcve/mcve.c:1.14.2.4
--- php-src/ext/mcve/mcve.c:1.14.2.3 Mon Jul 7 23:16:38 2003
+++ php-src/ext/mcve/mcve.c Wed Jul 9 09:48:28 2003
@@no-spam -17,7 +17,7 @@no-spam +----------------------------------------------------------------------+
*/
-/* $Id: mcve.c,v 1.14.2.3 2003/07/08 03:16:38 bradmssw Exp $ */
+/* $Id: mcve.c,v 1.14.2.4 2003/07/09 13:48:28 bradmssw Exp $ */
/* standard php include(s) */
#include "php.h"
@@no-spam -588,7 +588,6 @@no-spam */
PHP_FUNCTION(mcve_setssl_files)
{
- MCVE_CONN *conn;
int retval;
zval **arg1, **arg2;
@@no-spam -841,29 +840,53 @@no-spam convert_to_long_ex(arg2);
switch (key) {
- case MC_TRANTYPE:
- case MC_PTRANNUM:
+ /* Typecast to MCVE_int64 */
case MC_TTID:
+ convert_to_long_ex(arg4);
+ retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, (MCVE_int64)Z_LVAL_PP(arg4));

+ break;
+
+ /* Typecast to long */
+
+ case MC_PTRANNUM:
+ case MC_TIMESTAMP:
+ case MC_MARKER:
+ convert_to_long_ex(arg4);
+ retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, (long)Z_LVAL_PP(arg4));

+ break;
+
+ /* Typecast to int */
case MC_ADMIN:
+ case MC_SUB:
+ case MC_TRANTYPE:
case MC_AUDITTYPE:
+ case MC_EXCHARGES:
+ case MC_INQUIRY:
+ case MC_PRIORITY:
+ case MC_CARDTYPES:
+ case MC_ORIGTYPE:
+ case MC_VOIDORIGTYPE:
convert_to_long_ex(arg4);
- retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_LVAL_PP(arg4));
+ retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, (int)Z_LVAL_PP(arg4));

break;
+ /* Typecast to double */
case MC_AMOUNT:
+ case MC_EXAMOUNT:
+ case MC_RATE:
convert_to_double_ex(arg4);
- retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_DVAL_PP(arg4));
+ retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, (double)Z_DVAL_PP(arg4));

break;
case MC_CUSTOM:
convert_to_string_ex(arg4);
convert_to_string_ex(arg5);
- retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5));

+ retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, Z_STRVAL_PP(arg4), Z_STRVAL_PP(arg5));

break;
default:
convert_to_string_ex(arg4);
- retval = MCVE_TransParam(conn, Z_LVAL_PP(arg2), key, Z_STRVAL_PP(arg4));
+ retval = MCVE_TransParam(conn, (long)Z_LVAL_PP(arg2), key, Z_STRVAL_PP(arg4));

break;
}