cvs: php4 /ext/com conversion.c conversion.h
| From: | Harald Radi | Date: | Thu, 04 Oct 2001 18:24:44 +0000 |
| Subject: | cvs: php4 /ext/com conversion.c conversion.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-7646@lists.php.net to get a copy of this message | ||
phanto Thu Oct 4 14:24:44 2001 EDT
Modified files:
/php4/ext/com conversion.c conversion.h
Log:
no message
Index: php4/ext/com/conversion.c
diff -u php4/ext/com/conversion.c:1.39 php4/ext/com/conversion.c:1.40
--- php4/ext/com/conversion.c:1.39 Tue Sep 25 17:57:49 2001
+++ php4/ext/com/conversion.c Thu Oct 4 14:24:43 2001
@@ -157,12 +157,12 @@
switch (V_VT(var_arg)) {
case VT_UI1:
convert_to_long_ex(&pval_arg);
- V_UI1(var_arg) = (unsigned char)Z_LVAL_P(pval_arg);
+ V_UI1(var_arg) = (unsigned char) Z_LVAL_P(pval_arg);
break;
case VT_I2:
convert_to_long_ex(&pval_arg);
- V_I2(var_arg) = (short)Z_LVAL_P(pval_arg);
+ V_I2(var_arg) = (short) Z_LVAL_P(pval_arg);
break;
case VT_I4:
@@ -172,7 +172,7 @@
case VT_R4:
convert_to_double_ex(&pval_arg);
- V_R4(var_arg) = (float)Z_DVAL_P(pval_arg);
+ V_R4(var_arg) = (float) Z_DVAL_P(pval_arg);
break;
case VT_R8:
@@ -182,7 +182,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:
@@ -278,7 +282,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:
@@ -584,9 +594,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.7 php4/ext/com/conversion.h:1.8
--- php4/ext/com/conversion.h:1.7 Mon Sep 24 11:56:16 2001
+++ php4/ext/com/conversion.h Thu Oct 4 14:24:43 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);