Update of /cvsroot/pywin32/pywin32/com/TestSources/PyCOMTest
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12983/TestSources/PyCOMTest
Modified Files:
PyCOMImpl.cpp PyCOMImpl.h PyCOMTest.idl
Log Message:
Fix issue [ 1651025 ] Use the specified type for constant values
This makes constants in a typelib > sys.maxint to correctly be a long
Index: PyCOMTest.idl
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/TestSources/PyCOMTest/PyCOMTest.idl,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** PyCOMTest.idl 22 Mar 2006 09:20:13 -0000 1.13
--- PyCOMTest.idl 7 Feb 2007 23:12:30 -0000 1.14
***************
*** 53,56 ****
--- 53,75 ----
} QsAttribute;
+ // v1_enum specifies a 32 bit enum value
+ typedef [public, v1_enum] enum tagQsAttributeWide {
+ WideAttr1 = 0,
+ WideAttr2 = -1,
+ WideAttr3 = 1,
+ WideAttr4 = -70000,
+ WideAttr5 = 70000
+ } QsAttributeWide;
+
+ // constant test values
+ module Constants {
+ const unsigned long ULongTest1 = 0xFFFFFFFFUL;
+ const unsigned long ULongTest2 = 0x7FFFFFFFUL;
+ const long LongTest1 = -0x7FFFFFFFL;
+ const long LongTest2 = 0x7FFFFFFFL;
+ const unsigned char UCharTest = 255;
+ const char CharTest = -1;
+ };
+
enum TestAttributes3{ // Note missing the enum name.
TestAttr3,
***************
*** 169,172 ****
--- 188,192 ----
HRESULT Test4([in] TestAttributes2 inval, [out, retval] TestAttributes2* retval);
HRESULT Test5([in, out] TestAttributes1 *inout);
+ HRESULT Test6([in] QsAttributeWide inval, [out, retval] QsAttributeWide* retval);
// Test IDispatch in and byref.
***************
*** 337,341 ****
[default] interface IArrayTest;
};
!
};
--- 357,361 ----
[default] interface IArrayTest;
};
!
};
Index: PyCOMImpl.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/TestSources/PyCOMTest/PyCOMImpl.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** PyCOMImpl.h 22 Mar 2006 09:20:13 -0000 1.12
--- PyCOMImpl.h 7 Feb 2007 23:12:30 -0000 1.13
***************
*** 59,62 ****
--- 59,63 ----
STDMETHOD(Test4)(TestAttributes2, TestAttributes2 *);
STDMETHOD(Test5)(TestAttributes1 *);
+ STDMETHOD(Test6)(QsAttributeWide, QsAttributeWide *);
STDMETHOD(GetSetInterface)(IPyCOMTest *ininterface, IPyCOMTest **outinterface);
STDMETHOD(GetSetInterfaceArray)(SAFEARRAY *pin, SAFEARRAY **pout);
Index: PyCOMImpl.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/TestSources/PyCOMTest/PyCOMImpl.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** PyCOMImpl.cpp 22 Mar 2006 09:20:13 -0000 1.13
--- PyCOMImpl.cpp 7 Feb 2007 23:12:30 -0000 1.14
***************
*** 75,79 ****
HRESULT hRes = S_OK;
m_cs.Lock();
! for (long i=0;i<nMaxSessions;i++)
{
if (m_rsArray[i].m_hEvent == NULL)
--- 75,80 ----
HRESULT hRes = S_OK;
m_cs.Lock();
! long i=0;
! for (;i<nMaxSessions;i++)
{
if (m_rsArray[i].m_hEvent == NULL)
***************
*** 155,158 ****
--- 156,164 ----
return S_OK;
}
+ STDMETHODIMP CPyCOMTest::Test6(QsAttributeWide in, QsAttributeWide *out)
+ {
+ *out = in;
+ return S_OK;
+ }
STDMETHODIMP CPyCOMTest::GetSetInterface(IPyCOMTest *ininterface, IPyCOMTest **outinterface)
***************
*** 473,476 ****
--- 479,507 ----
CHECK_TRUE( attr == ret_attr );
+ // TEST6
+ QsAttributeWide ret_wideAttr;
+ QsAttributeWide wideAttr;
+
+ wideAttr = WideAttr1;
+ CHECK_HR(tester->Test6( wideAttr, &ret_wideAttr));
+ CHECK_TRUE( wideAttr == ret_wideAttr );
+
+ wideAttr = WideAttr2;
+ CHECK_HR(tester->Test6( wideAttr, &ret_wideAttr));
+ CHECK_TRUE( wideAttr == ret_wideAttr );
+
+ wideAttr = WideAttr3;
+ CHECK_HR(tester->Test6( wideAttr, &ret_wideAttr));
+ CHECK_TRUE( wideAttr == ret_wideAttr );
+
+ wideAttr = WideAttr4;
+ CHECK_HR(tester->Test6( wideAttr, &ret_wideAttr));
+ CHECK_TRUE( wideAttr == ret_wideAttr );
+
+ wideAttr = WideAttr5;
+ CHECK_HR(tester->Test6( wideAttr, &ret_wideAttr));
+ CHECK_TRUE( wideAttr == ret_wideAttr );
+
+
// TEST5
TestAttributes1 tattr = TestAttr1;
|