Changeset 98297 in vbox for trunk/src/VBox/Main/glue/ErrorInfo.cpp
- Timestamp:
- Jan 25, 2023 1:59:25 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155502
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/ErrorInfo.cpp
r98103 r98297 56 56 HRESULT ErrorInfo::getVirtualBoxErrorInfo(ComPtr<IVirtualBoxErrorInfo> &pVirtualBoxErrorInfo) 57 57 { 58 HRESULT rc = S_OK;58 HRESULT hrc = S_OK; 59 59 if (mErrorInfo) 60 rc = mErrorInfo.queryInterfaceTo(pVirtualBoxErrorInfo.asOutParam());60 hrc = mErrorInfo.queryInterfaceTo(pVirtualBoxErrorInfo.asOutParam()); 61 61 else 62 62 pVirtualBoxErrorInfo.setNull(); 63 return rc;63 return hrc; 64 64 } 65 65 … … 111 111 void ErrorInfo::init(bool aKeepObj /* = false */) 112 112 { 113 HRESULT rc = E_FAIL;113 HRESULT hrc = E_FAIL; 114 114 115 115 #if !defined(VBOX_WITH_XPCOM) 116 116 117 117 ComPtr<IErrorInfo> err; 118 rc = ::GetErrorInfo(0, err.asOutParam());119 if ( rc == S_OK && err)118 hrc = ::GetErrorInfo(0, err.asOutParam()); 119 if (hrc == S_OK && err) 120 120 { 121 121 if (aKeepObj) … … 123 123 124 124 ComPtr<IVirtualBoxErrorInfo> info; 125 rc = err.queryInterfaceTo(info.asOutParam());126 if (SUCCEEDED( rc) && info)125 hrc = err.queryInterfaceTo(info.asOutParam()); 126 if (SUCCEEDED(hrc) && info) 127 127 init(info); 128 128 … … 131 131 bool gotSomething = false; 132 132 133 rc = err->GetGUID(mInterfaceID.asOutParam());134 gotSomething |= SUCCEEDED( rc);135 if (SUCCEEDED( rc))133 hrc = err->GetGUID(mInterfaceID.asOutParam()); 134 gotSomething |= SUCCEEDED(hrc); 135 if (SUCCEEDED(hrc)) 136 136 GetInterfaceNameByIID(mInterfaceID.ref(), mInterfaceName.asOutParam()); 137 137 138 rc = err->GetSource(mComponent.asOutParam());139 gotSomething |= SUCCEEDED( rc);140 141 rc = err->GetDescription(mText.asOutParam());142 gotSomething |= SUCCEEDED( rc);138 hrc = err->GetSource(mComponent.asOutParam()); 139 gotSomething |= SUCCEEDED(hrc); 140 141 hrc = err->GetDescription(mText.asOutParam()); 142 gotSomething |= SUCCEEDED(hrc); 143 143 144 144 if (gotSomething) … … 152 152 153 153 nsCOMPtr<nsIExceptionService> es; 154 es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, & rc);155 if (NS_SUCCEEDED( rc))154 es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &hrc); 155 if (NS_SUCCEEDED(hrc)) 156 156 { 157 157 nsCOMPtr<nsIExceptionManager> em; 158 rc = es->GetCurrentExceptionManager(getter_AddRefs(em));159 if (NS_SUCCEEDED( rc))158 hrc = es->GetCurrentExceptionManager(getter_AddRefs(em)); 159 if (NS_SUCCEEDED(hrc)) 160 160 { 161 161 ComPtr<nsIException> ex; 162 rc = em->GetCurrentException(ex.asOutParam());163 if (NS_SUCCEEDED( rc) && ex)162 hrc = em->GetCurrentException(ex.asOutParam()); 163 if (NS_SUCCEEDED(hrc) && ex) 164 164 { 165 165 if (aKeepObj) … … 167 167 168 168 ComPtr<IVirtualBoxErrorInfo> info; 169 rc = ex.queryInterfaceTo(info.asOutParam());170 if (NS_SUCCEEDED( rc) && info)169 hrc = ex.queryInterfaceTo(info.asOutParam()); 170 if (NS_SUCCEEDED(hrc) && info) 171 171 init(info); 172 172 … … 175 175 bool gotSomething = false; 176 176 177 rc = ex->GetResult(&mResultCode);178 gotSomething |= NS_SUCCEEDED( rc);177 hrc = ex->GetResult(&mResultCode); 178 gotSomething |= NS_SUCCEEDED(hrc); 179 179 180 180 char *pszMsg; 181 rc = ex->GetMessage(&pszMsg);182 gotSomething |= NS_SUCCEEDED( rc);183 if (NS_SUCCEEDED( rc))181 hrc = ex->GetMessage(&pszMsg); 182 gotSomething |= NS_SUCCEEDED(hrc); 183 if (NS_SUCCEEDED(hrc)) 184 184 { 185 185 mText = Bstr(pszMsg); … … 196 196 em->SetCurrentException(NULL); 197 197 198 rc = NS_OK;198 hrc = NS_OK; 199 199 } 200 200 } 201 201 } 202 202 /* Ignore failure when called after nsComponentManagerImpl::Shutdown(). */ 203 else if ( rc == NS_ERROR_UNEXPECTED)204 rc = NS_OK;205 206 AssertComRC( rc);203 else if (hrc == NS_ERROR_UNEXPECTED) 204 hrc = NS_OK; 205 206 AssertComRC(hrc); 207 207 208 208 #endif // defined(VBOX_WITH_XPCOM) … … 219 219 ComPtr<IUnknown> iface = aI; 220 220 ComPtr<ISupportErrorInfo> serr; 221 HRESULT rc = iface.queryInterfaceTo(serr.asOutParam());222 if (SUCCEEDED( rc))223 { 224 rc = serr->InterfaceSupportsErrorInfo(aIID);225 if (SUCCEEDED( rc))221 HRESULT hrc = iface.queryInterfaceTo(serr.asOutParam()); 222 if (SUCCEEDED(hrc)) 223 { 224 hrc = serr->InterfaceSupportsErrorInfo(aIID); 225 if (SUCCEEDED(hrc)) 226 226 init(aKeepObj); 227 227 } … … 244 244 AssertReturnVoid(info); 245 245 246 HRESULT rc = E_FAIL;246 HRESULT hrc = E_FAIL; 247 247 bool gotSomething = false; 248 248 bool gotAll = true; 249 249 LONG lrc, lrd; 250 250 251 rc = info->COMGETTER(ResultCode)(&lrc); mResultCode = lrc;252 gotSomething |= SUCCEEDED( rc);253 gotAll &= SUCCEEDED( rc);254 255 rc = info->COMGETTER(ResultDetail)(&lrd); mResultDetail = lrd;256 gotSomething |= SUCCEEDED( rc);257 gotAll &= SUCCEEDED( rc);251 hrc = info->COMGETTER(ResultCode)(&lrc); mResultCode = lrc; 252 gotSomething |= SUCCEEDED(hrc); 253 gotAll &= SUCCEEDED(hrc); 254 255 hrc = info->COMGETTER(ResultDetail)(&lrd); mResultDetail = lrd; 256 gotSomething |= SUCCEEDED(hrc); 257 gotAll &= SUCCEEDED(hrc); 258 258 259 259 Bstr iid; 260 rc = info->COMGETTER(InterfaceID)(iid.asOutParam());261 gotSomething |= SUCCEEDED( rc);262 gotAll &= SUCCEEDED( rc);263 if (SUCCEEDED( rc))260 hrc = info->COMGETTER(InterfaceID)(iid.asOutParam()); 261 gotSomething |= SUCCEEDED(hrc); 262 gotAll &= SUCCEEDED(hrc); 263 if (SUCCEEDED(hrc)) 264 264 { 265 265 mInterfaceID = iid; … … 267 267 } 268 268 269 rc = info->COMGETTER(Component)(mComponent.asOutParam());270 gotSomething |= SUCCEEDED( rc);271 gotAll &= SUCCEEDED( rc);272 273 rc = info->COMGETTER(Text)(mText.asOutParam());274 gotSomething |= SUCCEEDED( rc);275 gotAll &= SUCCEEDED( rc);269 hrc = info->COMGETTER(Component)(mComponent.asOutParam()); 270 gotSomething |= SUCCEEDED(hrc); 271 gotAll &= SUCCEEDED(hrc); 272 273 hrc = info->COMGETTER(Text)(mText.asOutParam()); 274 gotSomething |= SUCCEEDED(hrc); 275 gotAll &= SUCCEEDED(hrc); 276 276 277 277 m_pNext = NULL; 278 278 279 279 ComPtr<IVirtualBoxErrorInfo> next; 280 rc = info->COMGETTER(Next)(next.asOutParam());281 if (SUCCEEDED( rc) && !next.isNull())280 hrc = info->COMGETTER(Next)(next.asOutParam()); 281 if (SUCCEEDED(hrc) && !next.isNull()) 282 282 { 283 283 m_pNext = new ErrorInfo(next); 284 284 Assert(m_pNext != NULL); 285 285 if (!m_pNext) 286 rc = E_OUTOFMEMORY;287 } 288 289 gotSomething |= SUCCEEDED( rc);290 gotAll &= SUCCEEDED( rc);286 hrc = E_OUTOFMEMORY; 287 } 288 289 gotSomething |= SUCCEEDED(hrc); 290 gotAll &= SUCCEEDED(hrc); 291 291 292 292 mIsBasicAvailable = gotSomething; … … 312 312 313 313 ComPtr<IVirtualBoxErrorInfo> info; 314 HRESULT rc = progress->COMGETTER(ErrorInfo)(info.asOutParam());315 if (SUCCEEDED( rc) && info)314 HRESULT hrc = progress->COMGETTER(ErrorInfo)(info.asOutParam()); 315 if (SUCCEEDED(hrc) && info) 316 316 init(info); 317 317 } … … 328 328 return S_OK; 329 329 330 HRESULT rc = S_OK;330 HRESULT hrc = S_OK; 331 331 332 332 #if !defined(VBOX_WITH_XPCOM) … … 335 335 if (!mErrorInfo.isNull()) 336 336 { 337 rc = mErrorInfo.queryInterfaceTo(err.asOutParam());338 AssertComRC( rc);339 } 340 rc = ::SetErrorInfo(0, err);337 hrc = mErrorInfo.queryInterfaceTo(err.asOutParam()); 338 AssertComRC(hrc); 339 } 340 hrc = ::SetErrorInfo(0, err); 341 341 342 342 #else // defined(VBOX_WITH_XPCOM) 343 343 344 344 nsCOMPtr <nsIExceptionService> es; 345 es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, & rc);346 if (NS_SUCCEEDED( rc))345 es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &hrc); 346 if (NS_SUCCEEDED(hrc)) 347 347 { 348 348 nsCOMPtr <nsIExceptionManager> em; 349 rc = es->GetCurrentExceptionManager(getter_AddRefs(em));350 if (NS_SUCCEEDED( rc))349 hrc = es->GetCurrentExceptionManager(getter_AddRefs(em)); 350 if (NS_SUCCEEDED(hrc)) 351 351 { 352 352 ComPtr<nsIException> ex; 353 353 if (!mErrorInfo.isNull()) 354 354 { 355 rc = mErrorInfo.queryInterfaceTo(ex.asOutParam());356 AssertComRC( rc);355 hrc = mErrorInfo.queryInterfaceTo(ex.asOutParam()); 356 AssertComRC(hrc); 357 357 } 358 rc = em->SetCurrentException(ex);358 hrc = em->SetCurrentException(ex); 359 359 } 360 360 } … … 362 362 #endif // defined(VBOX_WITH_XPCOM) 363 363 364 if (SUCCEEDED( rc))364 if (SUCCEEDED(hrc)) 365 365 { 366 366 mErrorInfo.setNull(); … … 368 368 } 369 369 370 return rc;370 return hrc; 371 371 } 372 372
Note:
See TracChangeset
for help on using the changeset viewer.