cvs: php4(EXPERIMENTAL) /ext/com COM.c conversion.c
| From: | Harald Radi | Date: | Wed, 18 Jul 2001 19:40:38 +0000 |
| Subject: | cvs: php4(EXPERIMENTAL) /ext/com COM.c conversion.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6255@lists.php.net to get a copy of this message | ||
phanto Wed Jul 18 15:40:38 2001 EDT
Modified files: (Branch: EXPERIMENTAL)
/php4/ext/com COM.c conversion.c
Log:
MFH and VT_DATE patch
Index: php4/ext/com/COM.c
diff -u php4/ext/com/COM.c:1.29.2.1 php4/ext/com/COM.c:1.29.2.2
--- php4/ext/com/COM.c:1.29.2.1 Thu Jul 12 19:40:54 2001
+++ php4/ext/com/COM.c Wed Jul 18 15:40:37 2001
@@ -370,26 +370,21 @@
FILE *typelib_file;
char *typelib_name_buffer;
char *strtok_buf = NULL;
-#if SUPPORT_INTERACTIVE
int interactive;
- ELS_FETCH();
-
- interactive = EG(interactive);
-#endif
+ CLS_FETCH();
+ interactive = CG(interactive);
if(!new_value || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL)
{
return FAILURE;
}
-#if SUPPORT_INTERACTIVE
if(interactive)
{
printf("Loading type libraries...");
fflush(stdout);
}
-#endif
typelib_name_buffer = (char *) emalloc(sizeof(char)*1024);
@@ -431,13 +426,11 @@
ptr--;
}
-
-#if SUPPORT_INTERACTIVE
if(interactive)
{
printf("\rLoading %-60s\r", typelib_name);
}
-#endif
+
if((pTL = php_COM_find_typelib(typelib_name, mode)) != NULL)
{
php_COM_load_typelib(pTL, mode);
@@ -448,12 +441,10 @@
efree(typelib_name_buffer);
fclose(typelib_file);
-#if SUPPORT_INTERACTIVE
if(interactive)
{
printf("\r%70s\r", "");
}
-#endif
return SUCCESS;
}
Index: php4/ext/com/conversion.c
diff -u php4/ext/com/conversion.c:1.22.2.1 php4/ext/com/conversion.c:1.22.2.2
--- php4/ext/com/conversion.c:1.22.2.1 Thu Jul 12 19:40:54 2001
+++ php4/ext/com/conversion.c Wed Jul 18 15:40:37 2001
@@ -12,8 +12,8 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Harald Radi <h.radi@nme.at> |
- | Alan Brown <abrown@pobox.com> |
+ | Author: Harald Radi <h.radi@nme.at> |
+ | Alan Brown <abrown@pobox.com> |
| Paul Shortis <pshortis@dataworx.com.au> |
+----------------------------------------------------------------------+
*/
@@ -241,6 +241,7 @@
struct tm *phptime;
phptime = gmtime(&(pval_arg->value.lval));
+ memset(&wintime, 0, sizeof(wintime));
wintime.wYear = phptime->tm_year + 1900;
wintime.wMonth = phptime->tm_mon + 1;
@@ -251,6 +252,7 @@
SystemTimeToVariantTime(&wintime, &V_DATE(var_arg));
}
+ break;
case VT_BSTR:
convert_to_string_ex(&pval_arg);
@@ -338,6 +340,7 @@
struct tm *phptime;
phptime = gmtime(&(pval_arg->value.lval));
+ memset(&wintime, 0, sizeof(wintime));
wintime.wYear = phptime->tm_year + 1900;
wintime.wMonth = phptime->tm_mon + 1;
@@ -348,6 +351,7 @@
SystemTimeToVariantTime(&wintime, var_arg->pdate);
}
+ break;
case VT_BSTR|VT_BYREF:
convert_to_string(pval_arg);
@@ -472,7 +476,7 @@
if (1 != (Dims = SafeArrayGetDim(array)))
{
php_error(E_WARNING,"Unsupported: multi-dimensional (%d) SafeArrays", Dims);
- ZVAL_FALSE(pval_arg);
+ ZVAL_NULL(pval_arg);
return FAILURE;
}
SafeArrayLock( array);
@@ -551,7 +555,7 @@
else switch(var_arg->vt & ~VT_BYREF)
{
case VT_EMPTY:
- var_uninit(pval_arg);
+ ZVAL_NULL(pval_arg);
break;
case VT_UI1:
@@ -666,10 +670,13 @@
if(V_ISBYREF(var_arg))
{
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg),
persistent, codepage);
+ SysFreeString(*V_BSTRREF(var_arg));
+ efree(V_BSTRREF(var_arg));
}
else
{
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg),
persistent, codepage);
+ SysFreeString(V_BSTR(var_arg));
}
Z_TYPE_P(pval_arg) = IS_STRING;
@@ -689,6 +696,8 @@
VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
}
+ memset(&phptime, 0, sizeof(phptime));
+
phptime.tm_year = wintime.wYear - 1900;
phptime.tm_mon = wintime.wMonth - 1;
phptime.tm_mday = wintime.wDay;
@@ -737,7 +746,7 @@
else
{
ALLOC_COM(obj);
- php_COM_set(obj, V_DISPATCH(var_arg), FALSE);
+ php_COM_set(obj, V_DISPATCH(var_arg), TRUE);
ZVAL_COM(pval_arg, obj);
}