cvs: php4(PHP_4_0_7) /ext/com conversion.c conversion.h
| From: | Harald Radi | Date: | Fri, 05 Oct 2001 09:49:45 +0000 |
| Subject: | cvs: php4(PHP_4_0_7) /ext/com conversion.c conversion.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-7658@lists.php.net to get a copy of this message | ||
phanto Fri Oct 5 05:49:45 2001 EDT
Modified files: (Branch: PHP_4_0_7)
/php4/ext/com conversion.c conversion.h
Log:
MFH
fixed boolean -1 vs. 1 conflict
Index: php4/ext/com/conversion.c
diff -u php4/ext/com/conversion.c:1.33.2.4 php4/ext/com/conversion.c:1.33.2.5
--- php4/ext/com/conversion.c:1.33.2.4 Tue Sep 25 12:29:43 2001
+++ php4/ext/com/conversion.c Fri Oct 5 05:49:44 2001
@@ -187,7 +187,11 @@
case VT_BOOL:
convert_to_boolean_ex(&pval_arg);
- V_BOOL(var_arg) = (short)Z_LVAL_P(pval_arg);
+ if (Z_LVAL_P(pval_arg)) {
+ V_BOOL(var_arg) = VT_TRUE;
+ } else {
+ V_BOOL(var_arg) = VT_FALSE;
+ }
break;
case VT_ERROR:
@@ -281,7 +285,13 @@
case VT_BOOL|VT_BYREF:
convert_to_boolean(pval_arg);
- V_BOOLREF(var_arg) = (short FAR*) &Z_LVAL_P(pval_arg);
+ /* emalloc or malloc ? */
+ V_BOOLREF(var_arg) = (short FAR*) pemalloc(sizeof(short), 1);
+ if (Z_LVAL_P(pval_arg)) {
+ *V_BOOLREF(var_arg) = VT_TRUE;
+ } else {
+ *V_BOOLREF(var_arg) = VT_TRUE;
+ }
break;
case VT_ERROR|VT_BYREF:
@@ -587,9 +597,17 @@
case VT_BOOL:
if (V_ISBYREF(var_arg)) {
- ZVAL_BOOL(pval_arg, *V_BOOLREF(var_arg));
+ if (*V_BOOLREF(var_arg)) {
+ ZVAL_BOOL(pval_arg, Z_TRUE);
+ } else {
+ ZVAL_BOOL(pval_arg, Z_FALSE);
+ }
} else {
- ZVAL_BOOL(pval_arg, V_BOOL(var_arg));
+ if (V_BOOL(var_arg)) {
+ ZVAL_BOOL(pval_arg, Z_TRUE);
+ } else {
+ ZVAL_BOOL(pval_arg, Z_FALSE);
+ }
}
break;
Index: php4/ext/com/conversion.h
diff -u php4/ext/com/conversion.h:1.6 php4/ext/com/conversion.h:1.6.2.1
--- php4/ext/com/conversion.h:1.6 Tue Aug 14 08:47:08 2001
+++ php4/ext/com/conversion.h Fri Oct 5 05:49:44 2001
@@ -1,6 +1,14 @@
#ifndef CONVERSION_H
#define CONVERSION_H
+/* isn't this defined somewhere else ? */
+
+#define Z_TRUE 1
+#define Z_FALSE 0
+
+#define VT_TRUE -1
+#define VT_FALSE 0
+
BEGIN_EXTERN_C()
PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage TSRMLS_DC);