Changeset 99828 in vbox for trunk/include/VBox/com
- Timestamp:
- May 17, 2023 1:48:57 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 157464
- Location:
- trunk/include/VBox/com
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/array.h
r99772 r99828 691 691 AssertComRCReturnVoid(rc); 692 692 # ifndef VBOX_WITH_TYPE_TRAITS 693 AssertMsgReturnVoid( 694 vt == VarType() 695 || vt == VarTypeUnsigned(), 693 AssertMsgReturnVoid( vt == Traits::VarType() 694 || vt == Traits::VarTypeUnsigned(), 696 695 ("Expected vartype %d or %d, got %d.\n", 697 VarType(), VarTypeUnsigned(), vt)); 698 # else /* !VBOX_WITH_TYPE_TRAITS */ 699 AssertMsgReturnVoid( 700 vt == VarType(), 696 Traits::VarType(), Traits::VarTypeUnsigned(), vt)); 697 # else /* VBOX_WITH_TYPE_TRAITS */ 698 AssertMsgReturnVoid(vt == Traits::VarType(), 701 699 ("Expected vartype %d, got %d.\n", 702 VarType(), vt));703 # endif 700 Traits::VarType(), vt)); 701 # endif /* VBOX_WITH_TYPE_TRAITS */ 704 702 rc = SafeArrayAccessData(arg, (void HUGEP **)&m.raw); 705 703 AssertComRCReturnVoid(rc); … … 733 731 SafeArray::Copy(*it, m.arr[i]); 734 732 #else 735 Copy(*it, m.raw[i]);733 SafeArray::Copy(*it, m.raw[i]); 736 734 #endif 737 735 } … … 762 760 it != aMap.end(); ++ it, ++ i) 763 761 #ifdef VBOX_WITH_XPCOM 764 Copy(it->second, m.arr[i]);765 #else 766 Copy(it->second, m.raw[i]);762 SafeArray::Copy(it->second, m.arr[i]); 763 #else 764 SafeArray::Copy(it->second, m.raw[i]); 767 765 #endif 768 766 } … … 810 808 #else 811 809 if (m.arr) 812 return Size(m.arr->rgsabound[0].cElements);810 return Traits::Size(m.arr->rgsabound[0].cElements); 813 811 return 0; 814 812 #endif … … 841 839 SafeArray::Copy(m.arr[i - 1], m.arr[i]); 842 840 #else 843 Copy(m.raw[i - 1], m.raw[i]);841 SafeArray::Copy(m.raw[i - 1], m.raw[i]); 844 842 #endif 845 843 } … … 849 847 ++ m.size; 850 848 #else 851 Copy(aElement, m.raw[0]);849 SafeArray::Copy(aElement, m.raw[0]); 852 850 #endif 853 851 return true; … … 879 877 ++ m.size; 880 878 #else 881 Copy(aElement, m.raw[size() - 1]);879 SafeArray::Copy(aElement, m.raw[size() - 1]); 882 880 #endif 883 881 return true; … … 1246 1244 #else 1247 1245 1248 SAFEARRAYBOUND bound = { VarCount(aNewSize), 0 };1246 SAFEARRAYBOUND bound = { Traits::VarCount(aNewSize), 0 }; 1249 1247 HRESULT rc; 1250 1248 1251 1249 if (m.arr == NULL) 1252 1250 { 1253 m.arr = CreateSafeArray(VarType(), &bound);1251 m.arr = Traits::CreateSafeArray(Traits::VarType(), &bound); 1254 1252 AssertReturn(m.arr != NULL, false); 1255 1253 } … … 1485 1483 { 1486 1484 if (mVal == NULL) 1487 Copy(&aThat, mVal);1485 SafeGUIDArray::Copy(&aThat, mVal); 1488 1486 else 1489 1487 *mVal = aThat; … … 1723 1721 ("Expected IID {%RTuuid}, got {%RTuuid}.\n", &COM_IIDOF(I), &guid)); 1724 1722 1725 rc = SafeArrayAccessData(arg, (void HUGEP **)& m.raw);1723 rc = SafeArrayAccessData(arg, (void HUGEP **)&this->m.raw); 1726 1724 AssertComRCReturnVoid(rc); 1727 1725 1728 m.arr = arg;1729 m.isWeak = true;1726 this->m.arr = arg; 1727 this->m.isWeak = true; 1730 1728 1731 1729 #endif /* !VBOX_WITH_XPCOM */ … … 1753 1751 1754 1752 size_t i = 0; 1755 for (typename List::const_iterator it = aCntr.begin(); 1756 it != aCntr.end(); ++ it, ++ i) 1757 #ifdef VBOX_WITH_XPCOM 1758 this->Copy(*it, Base::m.arr[i]); 1759 #else 1760 Copy(*it, Base::m.raw[i]); 1753 for (typename List::const_iterator it = aCntr.begin(); it != aCntr.end(); ++it, ++i) 1754 #ifdef VBOX_WITH_XPCOM 1755 SafeIfaceArray::Copy(*it, Base::m.arr[i]); 1756 #else 1757 SafeIfaceArray::Copy(*it, Base::m.raw[i]); 1761 1758 #endif 1762 1759 } … … 1782 1779 1783 1780 size_t i = 0; 1784 for (typename List::const_iterator it = aCntr.begin(); 1785 it != aCntr.end(); ++ it, ++ i) 1781 for (typename List::const_iterator it = aCntr.begin(); it != aCntr.end(); ++it, ++i) 1786 1782 #ifdef VBOX_WITH_XPCOM 1787 1783 SafeIfaceArray::Copy(*it, Base::m.arr[i]); 1788 1784 #else 1789 Copy(*it, Base::m.raw[i]);1785 SafeIfaceArray::Copy(*it, Base::m.raw[i]); 1790 1786 #endif 1791 1787 } … … 1814 1810 1815 1811 size_t i = 0; 1816 for (typename Map::const_iterator it = aMap.begin(); 1817 it != aMap.end(); ++ it, ++ i) 1812 for (typename Map::const_iterator it = aMap.begin(); it != aMap.end(); ++it, ++i) 1818 1813 #ifdef VBOX_WITH_XPCOM 1819 1814 SafeIfaceArray::Copy(it->second, Base::m.arr[i]); 1820 1815 #else 1821 Copy(it->second, Base::m.raw[i]);1816 SafeIfaceArray::Copy(it->second, Base::m.raw[i]); 1822 1817 #endif 1823 1818 } … … 1847 1842 size_t i = 0; 1848 1843 for (typename Map::const_iterator it = aMap.begin(); 1849 it != aMap.end(); ++ it, ++i)1844 it != aMap.end(); ++it, ++i) 1850 1845 #ifdef VBOX_WITH_XPCOM 1851 1846 SafeIfaceArray::Copy(it->second, Base::m.arr[i]); 1852 1847 #else 1853 Copy(it->second, Base::m.raw[i]);1848 SafeIfaceArray::Copy(it->second, Base::m.raw[i]); 1854 1849 #endif 1855 1850 } … … 1860 1855 SafeIfaceArray::Copy(obj, Base::m.arr[iIdx]); 1861 1856 #else 1862 Copy(obj, Base::m.raw[iIdx]);1857 SafeIfaceArray::Copy(obj, Base::m.raw[iIdx]); 1863 1858 #endif 1864 1859 } -
trunk/include/VBox/com/microatl.h
r98103 r99828 239 239 if (fInitialLock) 240 240 { 241 HRESULT hrc = Lock();241 HRESULT hrc = this->Lock(); 242 242 if (FAILED(hrc)) 243 243 throw hrc; … … 724 724 { 725 725 // Catch refcount screwups by setting refcount to -(LONG_MAX/2). 726 m_iRef = -(LONG_MAX/2);727 FinalRelease();726 this->m_iRef = -(LONG_MAX/2); 727 this->FinalRelease(); 728 728 } 729 729 STDMETHOD_(ULONG, AddRef)() throw() … … 731 731 // If you get errors about undefined InternalAddRef then Base does not 732 732 // derive from CComObjectRootEx. 733 ULONG l = InternalAddRef();733 ULONG l = this->InternalAddRef(); 734 734 if (l == 2) 735 735 { … … 743 743 // If you get errors about undefined InternalRelease then Base does not 744 744 // derive from CComObjectRootEx. 745 ULONG l = InternalRelease();745 ULONG l = this->InternalRelease(); 746 746 if (l == 0) 747 747 delete this; … … 757 757 // If you get errors about undefined _InternalQueryInterface then 758 758 // double check BEGIN_COM_MAP in the class definition. 759 return _InternalQueryInterface(iid, ppvObj);759 return this->_InternalQueryInterface(iid, ppvObj); 760 760 } 761 761 static HRESULT WINAPI CreateInstance(CComObjectCached<Base> **pp) throw() … … 792 792 { 793 793 // Catch refcount screwups by setting refcount to -(LONG_MAX/2). 794 m_iRef = -(LONG_MAX/2);795 FinalRelease();794 this->m_iRef = -(LONG_MAX/2); 795 this->FinalRelease(); 796 796 } 797 797 STDMETHOD_(ULONG, AddRef)() throw() … … 799 799 // If you get errors about undefined InternalAddRef then Base does not 800 800 // derive from CComObjectRootEx. 801 return InternalAddRef();801 return this->InternalAddRef(); 802 802 } 803 803 STDMETHOD_(ULONG, Release)() throw() … … 805 805 // If you get errors about undefined InternalRelease then Base does not 806 806 // derive from CComObjectRootEx. 807 ULONG l = InternalRelease();807 ULONG l = this->InternalRelease(); 808 808 if (l == 0) 809 809 delete this; … … 814 814 // If you get errors about undefined _InternalQueryInterface then 815 815 // double check BEGIN_COM_MAP in the class definition. 816 return _InternalQueryInterface(iid, ppvObj);816 return this->_InternalQueryInterface(iid, ppvObj); 817 817 } 818 818 }; … … 1051 1051 AssertMsg(_pAtlModule, ("ATL: referring to ATL module without having one declared in this linking namespace\n")); 1052 1052 // Catch refcount screwups by setting refcount to -(LONG_MAX/2). 1053 m_iRef = -(LONG_MAX/2);1054 FinalRelease();1053 this->m_iRef = -(LONG_MAX/2); 1054 this->FinalRelease(); 1055 1055 _pAtlModule->Unlock(); 1056 1056 } … … 1059 1059 // If you get errors about undefined InternalAddRef then Base does not 1060 1060 // derive from CComObjectRootEx. 1061 return InternalAddRef();1061 return this->InternalAddRef(); 1062 1062 } 1063 1063 STDMETHOD_(ULONG, Release)() … … 1065 1065 // If you get errors about undefined InternalRelease then Base does not 1066 1066 // derive from CComObjectRootEx. 1067 ULONG l = InternalRelease();1067 ULONG l = this->InternalRelease(); 1068 1068 if (l == 0) 1069 1069 delete this; … … 1074 1074 // If you get errors about undefined _InternalQueryInterface then 1075 1075 // double check BEGIN_COM_MAP in the class definition. 1076 return _InternalQueryInterface(iid, ppvObj);1076 return this->_InternalQueryInterface(iid, ppvObj); 1077 1077 } 1078 1078 … … 1084 1084 HRESULT hrc = E_OUTOFMEMORY; 1085 1085 CComObject<Base> *p = NULL; 1086 #ifdef RT_EXCEPTIONS_ENABLED 1086 1087 try 1087 1088 { 1089 #endif 1088 1090 p = new CComObject<Base>(); 1091 #ifdef RT_EXCEPTIONS_ENABLED 1089 1092 } 1090 1093 catch (std::bad_alloc &) … … 1092 1095 p = NULL; 1093 1096 } 1097 #endif 1094 1098 if (p) 1095 1099 { 1096 1100 p->InternalFinalConstructAddRef(); 1101 #ifdef RT_EXCEPTIONS_ENABLED 1097 1102 try 1098 1103 { 1104 #endif 1099 1105 hrc = p->_AtlInitialConstruct(); 1100 1106 if (SUCCEEDED(hrc)) 1101 1107 hrc = p->FinalConstruct(); 1108 #ifdef RT_EXCEPTIONS_ENABLED 1102 1109 } 1103 1110 catch (std::bad_alloc &) … … 1105 1112 hrc = E_OUTOFMEMORY; 1106 1113 } 1114 #endif 1107 1115 p->InternalFinalConstructRelease(); 1108 1116 if (FAILED(hrc)) … … 1156 1164 CComContainedObject(void *pv) 1157 1165 { 1158 m_pOuterUnknown = (IUnknown *)pv;1166 this->m_pOuterUnknown = (IUnknown *)pv; 1159 1167 } 1160 1168 1161 1169 STDMETHOD_(ULONG, AddRef)() throw() 1162 1170 { 1163 return OuterAddRef();1171 return this->OuterAddRef(); 1164 1172 } 1165 1173 STDMETHOD_(ULONG, Release)() throw() 1166 1174 { 1167 return OuterRelease();1175 return this->OuterRelease(); 1168 1176 } 1169 1177 STDMETHOD(QueryInterface)(REFIID iid, void **ppvObj) throw() 1170 1178 { 1171 return OuterQueryInterface(iid, ppvObj);1179 return this->OuterQueryInterface(iid, ppvObj); 1172 1180 } 1173 1181 }; … … 1188 1196 AssertMsg(_pAtlModule, ("ATL: referring to ATL module without having one declared in this linking namespace\n")); 1189 1197 // Catch refcount screwups by setting refcount to -(LONG_MAX/2). 1190 m_iRef = -(LONG_MAX/2);1191 FinalRelease();1198 this->m_iRef = -(LONG_MAX/2); 1199 this->FinalRelease(); 1192 1200 _pAtlModule->Unlock(); 1193 1201 } … … 1196 1204 HRESULT hrc = m_Aggregated._AtlInitialConstruct(); 1197 1205 if (SUCCEEDED(hrc)) 1198 {1199 1206 hrc = CComObjectRootEx<typename Aggregated::_ThreadModel::ThreadModelNoCS>::_AtlInitialConstruct(); 1200 }1201 1207 return hrc; 1202 1208 } … … 1214 1220 STDMETHOD_(ULONG, AddRef)() 1215 1221 { 1216 return InternalAddRef();1222 return this->InternalAddRef(); 1217 1223 } 1218 1224 STDMETHOD_(ULONG, Release)() 1219 1225 { 1220 ULONG l = InternalRelease();1226 ULONG l = this->InternalRelease(); 1221 1227 if (l == 0) 1222 1228 delete this; … … 1329 1335 } 1330 1336 // IClassFactory 1331 STDMETHOD(CreateInstance)(LPUNKNOWN pUnkOuter, REFIID riid, void **p vObj)1337 STDMETHOD(CreateInstance)(LPUNKNOWN pUnkOuter, REFIID riid, void **ppvObj) 1332 1338 { 1333 1339 HRESULT hrc = E_POINTER;
Note:
See TracChangeset
for help on using the changeset viewer.