[ctypes-commit] ctypes/win32/com automation.py,1.19,1.20
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-02-14 14:30:28
|
Update of /cvsroot/ctypes/ctypes/win32/com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15311 Modified Files: automation.py Log Message: BSTR instances can contain NUL bytes: transfer these in and out of VARIANTs. Index: automation.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/win32/com/automation.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** automation.py 19 Aug 2004 10:21:32 -0000 1.19 --- automation.py 14 Feb 2005 14:30:18 -0000 1.20 *************** *** 311,314 **** --- 311,315 ---- # faked fields, only for our convenience: ("wstrVal", c_wchar_p), + ("bstrVal", BSTR), ("voidp", c_void_p), ] *************** *** 346,353 **** elif typ is str: self.vt = VT_BSTR ! self._.voidp = oleaut32.SysAllocString(unicode(value)) elif typ is unicode: self.vt = VT_BSTR ! self._.voidp = oleaut32.SysAllocString(value) elif value is None: return --- 347,355 ---- elif typ is str: self.vt = VT_BSTR ! value = unicode(value) ! self._.voidp = oleaut32.SysAllocStringLen(value, len(value)) elif typ is unicode: self.vt = VT_BSTR ! self._.voidp = oleaut32.SysAllocStringLen(value, len(value)) elif value is None: return *************** *** 399,403 **** elif self.vt == VT_BSTR: # NULL BSTR count as empty strings, not None! ! return self._.wstrVal or u'' # The following code can be enabled again when all the POINTER(ISomeInterface) # classes have a constructor that calls AddRef() if not-null. --- 401,406 ---- elif self.vt == VT_BSTR: # NULL BSTR count as empty strings, not None! ! ## return self._.wstrVal or u'' ! return self._.bstrVal or u'' # The following code can be enabled again when all the POINTER(ISomeInterface) # classes have a constructor that calls AddRef() if not-null. |