Skip to content

Commit 9dd5b5d

Browse files
author
Harald Radi
committed
no message
1 parent d031537 commit 9dd5b5d

12 files changed

+340
-176
lines changed

ext/com/COM.c

Lines changed: 154 additions & 78 deletions
Large diffs are not rendered by default.

ext/com/com.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ typedef struct comval_ {
4141
#define RETURN_COM(o) RETVAL_COM(o) \
4242
return;
4343

44-
#define ALLOC_COM(z) (z) = (comval *) emalloc(sizeof(comval))
44+
#define ALLOC_COM(z) (z) = (comval *) emalloc(sizeof(comval)); \
45+
C_REFCOUNT(z) = 0;
46+
4547
#define IS_COM php_COM_get_le_comval()
4648

4749
#define C_HASTLIB(x) ((x)->typelib)

ext/com/conversion.c

Lines changed: 4 additions & 8 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
*/
@@ -44,7 +44,6 @@ PHPAPI OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage);
4444
PHPAPI char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage);
4545

4646
/* implementations */
47-
4847
PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage)
4948
{
5049
OLECHAR *unicode_str;
@@ -442,7 +441,7 @@ PHPAPI void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_
442441
break;
443442

444443
default:
445-
php_error(E_WARNING, "Type not supportet or not yet implemented.");
444+
php_error(E_WARNING, "Type not supported or not yet implemented.");
446445
}
447446
}
448447

@@ -667,13 +666,10 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
667666
if(V_ISBYREF(var_arg))
668667
{
669668
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(*V_BSTRREF(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage);
670-
SysFreeString(*V_BSTRREF(var_arg));
671-
efree(V_BSTRREF(var_arg));
672669
}
673670
else
674671
{
675672
Z_STRVAL_P(pval_arg) = php_OLECHAR_to_char(V_BSTR(var_arg), &Z_STRLEN_P(pval_arg), persistent, codepage);
676-
SysFreeString(V_BSTR(var_arg));
677673
}
678674

679675
Z_TYPE_P(pval_arg) = IS_STRING;
@@ -741,7 +737,7 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent,
741737
else
742738
{
743739
ALLOC_COM(obj);
744-
php_COM_set(obj, V_DISPATCH(var_arg), TRUE);
740+
php_COM_set(obj, V_DISPATCH(var_arg), FALSE);
745741

746742
ZVAL_COM(pval_arg, obj);
747743
}

ext/com/conversion.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ BEGIN_EXTERN_C()
66
extern void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage);
77
extern void php_pval_to_variant_ex(pval *pval_arg, VARIANT *var_arg, pval *pval_type, int codepage);
88
extern int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int persistent, int codepage);
9+
910
extern OLECHAR *php_char_to_OLECHAR(char *C_str, uint strlen, int codepage);
1011
extern char *php_OLECHAR_to_char(OLECHAR *unicode_str, uint *out_length, int persistent, int codepage);
1112

ext/com/php_COM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extern PHPAPI HRESULT php_COM_invoke(comval *obj, DISPID dispIdMember, WORD wFla
1414
extern PHPAPI HRESULT php_COM_get_ids_of_names(comval *obj, OLECHAR FAR* FAR* rgszNames, DISPID FAR* rgDispId);
1515
extern PHPAPI HRESULT php_COM_release(comval *obj);
1616
extern PHPAPI HRESULT php_COM_addref(comval *obj);
17+
extern PHPAPI HRESULT php_COM_destruct(comval *obj);
1718
extern PHPAPI HRESULT php_COM_set(comval *obj, IDispatch FAR* pDisp, int cleanup);
1819
extern PHPAPI HRESULT php_COM_clone(comval *obj, comval *clone, int cleanup);
1920

ext/com/variant.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33

44
#if PHP_WIN32
55

6-
#define ALLOC_VARIANT(v) (v) = (VARIANT *) emalloc(sizeof(VARIANT))
6+
#define ALLOC_VARIANT(v) (v) = (VARIANT *) emalloc(sizeof(VARIANT)); \
7+
VariantInit(v);
8+
9+
#define FREE_VARIANT(v) VariantClear(v); \
10+
efree(v);
11+
12+
713
#define IS_VARIANT php_VARIANT_get_le_variant()
814

915
#endif /* PHP_WIN32 */

0 commit comments

Comments
 (0)