Skip to content

Commit 503ac7c

Browse files
author
Harald Radi
committed
MFH and VT_DATE patch
1 parent c4f9121 commit 503ac7c

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

ext/com/COM.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -370,26 +370,21 @@ static PHP_INI_MH(OnTypelibFileChange)
370370
FILE *typelib_file;
371371
char *typelib_name_buffer;
372372
char *strtok_buf = NULL;
373-
#if SUPPORT_INTERACTIVE
374373
int interactive;
375-
ELS_FETCH();
376-
377-
interactive = EG(interactive);
378-
#endif
379374

375+
CLS_FETCH();
376+
interactive = CG(interactive);
380377

381378
if(!new_value || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL)
382379
{
383380
return FAILURE;
384381
}
385382

386-
#if SUPPORT_INTERACTIVE
387383
if(interactive)
388384
{
389385
printf("Loading type libraries...");
390386
fflush(stdout);
391387
}
392-
#endif
393388

394389
typelib_name_buffer = (char *) emalloc(sizeof(char)*1024);
395390

@@ -431,13 +426,11 @@ static PHP_INI_MH(OnTypelibFileChange)
431426
ptr--;
432427
}
433428

434-
435-
#if SUPPORT_INTERACTIVE
436429
if(interactive)
437430
{
438431
printf("\rLoading %-60s\r", typelib_name);
439432
}
440-
#endif
433+
441434
if((pTL = php_COM_find_typelib(typelib_name, mode)) != NULL)
442435
{
443436
php_COM_load_typelib(pTL, mode);
@@ -448,12 +441,10 @@ static PHP_INI_MH(OnTypelibFileChange)
448441
efree(typelib_name_buffer);
449442
fclose(typelib_file);
450443

451-
#if SUPPORT_INTERACTIVE
452444
if(interactive)
453445
{
454446
printf("\r%70s\r", "");
455447
}
456-
#endif
457448

458449
return SUCCESS;
459450
}

ext/com/conversion.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| license@php.net so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Author: Harald Radi <h.radi@nme.at> |
16-
| Alan Brown <abrown@pobox.com> |
15+
| Author: Harald Radi <h.radi@nme.at> |
16+
| Alan Brown <abrown@pobox.com> |
1717
| Paul Shortis <pshortis@dataworx.com.au> |
1818
+----------------------------------------------------------------------+
1919
*/
@@ -241,6 +241,7 @@ PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_
241241
struct tm *phptime;
242242

243243
phptime = gmtime(&(pval_arg->value.lval));
244+
memset(&wintime, 0, sizeof(wintime));
244245

245246
wintime.wYear = phptime->tm_year + 1900;
246247
wintime.wMonth = phptime->tm_mon + 1;
@@ -251,6 +252,7 @@ PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_
251252

252253
SystemTimeToVariantTime(&wintime, &V_DATE(var_arg));
253254
}
255+
break;
254256

255257
case VT_BSTR:
256258
convert_to_string_ex(&pval_arg);
@@ -338,6 +340,7 @@ PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_
338340
struct tm *phptime;
339341

340342
phptime = gmtime(&(pval_arg->value.lval));
343+
memset(&wintime, 0, sizeof(wintime));
341344

342345
wintime.wYear = phptime->tm_year + 1900;
343346
wintime.wMonth = phptime->tm_mon + 1;
@@ -348,6 +351,7 @@ PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_
348351

349352
SystemTimeToVariantTime(&wintime, var_arg->pdate);
350353
}
354+
break;
351355

352356
case VT_BSTR|VT_BYREF:
353357
convert_to_string(pval_arg);
@@ -472,7 +476,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
472476
if (1 != (Dims = SafeArrayGetDim(array)))
473477
{
474478
php_error(E_WARNING,"Unsupported: multi-dimensional (%d) SafeArrays", Dims);
475-
ZVAL_FALSE(pval_arg);
479+
ZVAL_NULL(pval_arg);
476480
return FAILURE;
477481
}
478482
SafeArrayLock( array);
@@ -551,7 +555,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
551555
else switch(var_arg->vt & ~VT_BYREF)
552556
{
553557
case VT_EMPTY:
554-
var_uninit(pval_arg);
558+
ZVAL_NULL(pval_arg);
555559
break;
556560

557561
case VT_UI1:
@@ -666,10 +670,13 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
666670
if(V_ISBYREF(var_arg))
667671
{
668672
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage);
673+
SysFreeString(*V_BSTRREF(var_arg));
674+
efree(V_BSTRREF(var_arg));
669675
}
670676
else
671677
{
672678
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage);
679+
SysFreeString(V_BSTR(var_arg));
673680
}
674681

675682
Z_TYPE_P(pval_arg) = IS_STRING;
@@ -689,6 +696,8 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
689696
VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
690697
}
691698

699+
memset(&phptime, 0, sizeof(phptime));
700+
692701
phptime.tm_year = wintime.wYear - 1900;
693702
phptime.tm_mon = wintime.wMonth - 1;
694703
phptime.tm_mday = wintime.wDay;
@@ -737,7 +746,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
737746
else
738747
{
739748
ALLOC_COM(obj);
740-
php_COM_set(obj, V_DISPATCH(var_arg), FALSE);
749+
php_COM_set(obj, V_DISPATCH(var_arg), TRUE);
741750

742751
ZVAL_COM(pval_arg, obj);
743752
}

ext/rpc/com/com_wrapper.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -370,26 +370,21 @@ static PHP_INI_MH(OnTypelibFileChange)
370370
FILE *typelib_file;
371371
char *typelib_name_buffer;
372372
char *strtok_buf = NULL;
373-
#if SUPPORT_INTERACTIVE
374373
int interactive;
375-
ELS_FETCH();
376-
377-
interactive = EG(interactive);
378-
#endif
379374

375+
CLS_FETCH();
376+
interactive = CG(interactive);
380377

381378
if(!new_value || (typelib_file = VCWD_FOPEN(new_value, "r"))==NULL)
382379
{
383380
return FAILURE;
384381
}
385382

386-
#if SUPPORT_INTERACTIVE
387383
if(interactive)
388384
{
389385
printf("Loading type libraries...");
390386
fflush(stdout);
391387
}
392-
#endif
393388

394389
typelib_name_buffer = (char *) emalloc(sizeof(char)*1024);
395390

@@ -431,13 +426,11 @@ static PHP_INI_MH(OnTypelibFileChange)
431426
ptr--;
432427
}
433428

434-
435-
#if SUPPORT_INTERACTIVE
436429
if(interactive)
437430
{
438431
printf("\rLoading %-60s\r", typelib_name);
439432
}
440-
#endif
433+
441434
if((pTL = php_COM_find_typelib(typelib_name, mode)) != NULL)
442435
{
443436
php_COM_load_typelib(pTL, mode);
@@ -448,12 +441,10 @@ static PHP_INI_MH(OnTypelibFileChange)
448441
efree(typelib_name_buffer);
449442
fclose(typelib_file);
450443

451-
#if SUPPORT_INTERACTIVE
452444
if(interactive)
453445
{
454446
printf("\r%70s\r", "");
455447
}
456-
#endif
457448

458449
return SUCCESS;
459450
}

ext/rpc/com/conversion.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| license@php.net so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Author: Harald Radi <h.radi@nme.at> |
16-
| Alan Brown <abrown@pobox.com> |
15+
| Author: Harald Radi <h.radi@nme.at> |
16+
| Alan Brown <abrown@pobox.com> |
1717
| Paul Shortis <pshortis@dataworx.com.au> |
1818
+----------------------------------------------------------------------+
1919
*/
@@ -241,6 +241,7 @@ PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_
241241
struct tm *phptime;
242242

243243
phptime = gmtime(&(pval_arg->value.lval));
244+
memset(&wintime, 0, sizeof(wintime));
244245

245246
wintime.wYear = phptime->tm_year + 1900;
246247
wintime.wMonth = phptime->tm_mon + 1;
@@ -251,6 +252,7 @@ PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_
251252

252253
SystemTimeToVariantTime(&wintime, &V_DATE(var_arg));
253254
}
255+
break;
254256

255257
case VT_BSTR:
256258
convert_to_string_ex(&pval_arg);
@@ -338,6 +340,7 @@ PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_
338340
struct tm *phptime;
339341

340342
phptime = gmtime(&(pval_arg->value.lval));
343+
memset(&wintime, 0, sizeof(wintime));
341344

342345
wintime.wYear = phptime->tm_year + 1900;
343346
wintime.wMonth = phptime->tm_mon + 1;
@@ -348,6 +351,7 @@ PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_
348351

349352
SystemTimeToVariantTime(&wintime, var_arg->pdate);
350353
}
354+
break;
351355

352356
case VT_BSTR|VT_BYREF:
353357
convert_to_string(pval_arg);
@@ -472,7 +476,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
472476
if (1 != (Dims = SafeArrayGetDim(array)))
473477
{
474478
php_error(E_WARNING,"Unsupported: multi-dimensional (%d) SafeArrays", Dims);
475-
ZVAL_FALSE(pval_arg);
479+
ZVAL_NULL(pval_arg);
476480
return FAILURE;
477481
}
478482
SafeArrayLock( array);
@@ -551,7 +555,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
551555
else switch(var_arg->vt & ~VT_BYREF)
552556
{
553557
case VT_EMPTY:
554-
var_uninit(pval_arg);
558+
ZVAL_NULL(pval_arg);
555559
break;
556560

557561
case VT_UI1:
@@ -666,10 +670,13 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
666670
if(V_ISBYREF(var_arg))
667671
{
668672
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage);
673+
SysFreeString(*V_BSTRREF(var_arg));
674+
efree(V_BSTRREF(var_arg));
669675
}
670676
else
671677
{
672678
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage);
679+
SysFreeString(V_BSTR(var_arg));
673680
}
674681

675682
Z_TYPE_P(pval_arg) = IS_STRING;
@@ -689,6 +696,8 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
689696
VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
690697
}
691698

699+
memset(&phptime, 0, sizeof(phptime));
700+
692701
phptime.tm_year = wintime.wYear - 1900;
693702
phptime.tm_mon = wintime.wMonth - 1;
694703
phptime.tm_mday = wintime.wDay;
@@ -737,7 +746,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
737746
else
738747
{
739748
ALLOC_COM(obj);
740-
php_COM_set(obj, V_DISPATCH(var_arg), FALSE);
749+
php_COM_set(obj, V_DISPATCH(var_arg), TRUE);
741750

742751
ZVAL_COM(pval_arg, obj);
743752
}

0 commit comments

Comments
 (0)