Changeset 21878 in vbox for trunk/src/VBox/Main/SharedFolderImpl.cpp
- Timestamp:
- Jul 30, 2009 12:42:08 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/SharedFolderImpl.cpp
r21079 r21878 70 70 { 71 71 /* Enclose the state transition NotReady->InInit->Ready */ 72 AutoInitSpan autoInitSpan 73 AssertReturn 74 75 unconst 72 AutoInitSpan autoInitSpan(this); 73 AssertReturn(autoInitSpan.isOk(), E_FAIL); 74 75 unconst(mMachine) = aMachine; 76 76 77 77 HRESULT rc = protectedInit (aMachine, aName, aHostPath, aWritable); 78 78 79 79 /* Confirm a successful initialization when it's the case */ 80 if (SUCCEEDED 80 if (SUCCEEDED(rc)) 81 81 autoInitSpan.setSucceeded(); 82 82 … … 99 99 100 100 /* Enclose the state transition NotReady->InInit->Ready */ 101 AutoInitSpan autoInitSpan 102 AssertReturn 103 104 unconst 101 AutoInitSpan autoInitSpan(this); 102 AssertReturn(autoInitSpan.isOk(), E_FAIL); 103 104 unconst(mMachine) = aMachine; 105 105 106 106 HRESULT rc = protectedInit (aMachine, aThat->m.name, … … 108 108 109 109 /* Confirm a successful initialization when it's the case */ 110 if (SUCCEEDED 110 if (SUCCEEDED(rc)) 111 111 autoInitSpan.setSucceeded(); 112 112 … … 128 128 { 129 129 /* Enclose the state transition NotReady->InInit->Ready */ 130 AutoInitSpan autoInitSpan 131 AssertReturn 132 133 unconst 130 AutoInitSpan autoInitSpan(this); 131 AssertReturn(autoInitSpan.isOk(), E_FAIL); 132 133 unconst(mConsole) = aConsole; 134 134 135 135 HRESULT rc = protectedInit (aConsole, aName, aHostPath, aWritable); 136 136 137 137 /* Confirm a successful initialization when it's the case */ 138 if (SUCCEEDED 138 if (SUCCEEDED(rc)) 139 139 autoInitSpan.setSucceeded(); 140 140 … … 156 156 { 157 157 /* Enclose the state transition NotReady->InInit->Ready */ 158 AutoInitSpan autoInitSpan 159 AssertReturn 160 161 unconst 158 AutoInitSpan autoInitSpan(this); 159 AssertReturn(autoInitSpan.isOk(), E_FAIL); 160 161 unconst(mVirtualBox) = aVirtualBox; 162 162 163 163 HRESULT rc = protectedInit (aVirtualBox, aName, aHostPath, aWritable); 164 164 165 165 /* Confirm a successful initialization when it's the case */ 166 if (SUCCEEDED 166 if (SUCCEEDED(rc)) 167 167 autoInitSpan.setSucceeded(); 168 168 … … 179 179 CBSTR aName, CBSTR aHostPath, BOOL aWritable) 180 180 { 181 LogFlowThisFunc 181 LogFlowThisFunc(("aName={%ls}, aHostPath={%ls}, aWritable={%d}\n", 182 182 aName, aHostPath, aWritable)); 183 183 … … 209 209 int vrc = RTPathAbsEx (NULL, hostPath, 210 210 hostPathFull, sizeof (hostPathFull)); 211 if (RT_FAILURE 211 if (RT_FAILURE(vrc)) 212 212 return setError (E_INVALIDARG, 213 213 tr ("Invalid shared folder path: '%s' (%Rrc)"), hostPath.raw(), vrc); … … 217 217 tr ("Shared folder path '%s' is not absolute"), hostPath.raw()); 218 218 219 unconst 219 unconst(mParent) = aParent; 220 220 221 221 /* register with parent */ 222 222 mParent->addDependentChild (this); 223 223 224 unconst 225 unconst 224 unconst(m.name) = aName; 225 unconst(m.hostPath) = hostPath; 226 226 m.writable = aWritable; 227 227 … … 235 235 void SharedFolder::uninit() 236 236 { 237 LogFlowThisFunc 237 LogFlowThisFunc(("\n")); 238 238 239 239 /* Enclose the state transition Ready->InUninit->NotReady */ 240 AutoUninitSpan autoUninitSpan 240 AutoUninitSpan autoUninitSpan(this); 241 241 if (autoUninitSpan.uninitDone()) 242 242 return; … … 245 245 mParent->removeDependentChild (this); 246 246 247 unconst 248 249 unconst 250 unconst 251 unconst 247 unconst(mParent) = NULL; 248 249 unconst(mMachine).setNull(); 250 unconst(mConsole).setNull(); 251 unconst(mVirtualBox).setNull(); 252 252 } 253 253 … … 259 259 CheckComArgOutPointerValid(aName); 260 260 261 AutoCaller autoCaller 262 CheckComRCReturnRC 261 AutoCaller autoCaller(this); 262 CheckComRCReturnRC(autoCaller.rc()); 263 263 264 264 /* mName is constant during life time, no need to lock */ 265 m.name.cloneTo 265 m.name.cloneTo(aName); 266 266 267 267 return S_OK; … … 272 272 CheckComArgOutPointerValid(aHostPath); 273 273 274 AutoCaller autoCaller 275 CheckComRCReturnRC 274 AutoCaller autoCaller(this); 275 CheckComRCReturnRC(autoCaller.rc()); 276 276 277 277 /* mHostPath is constant during life time, no need to lock */ 278 m.hostPath.cloneTo 278 m.hostPath.cloneTo(aHostPath); 279 279 280 280 return S_OK; … … 283 283 STDMETHODIMP SharedFolder::COMGETTER(Accessible) (BOOL *aAccessible) 284 284 { 285 CheckComArgOutPointerValid 286 287 AutoCaller autoCaller 288 CheckComRCReturnRC 285 CheckComArgOutPointerValid(aAccessible); 286 287 AutoCaller autoCaller(this); 288 CheckComRCReturnRC(autoCaller.rc()); 289 289 290 290 /* mName and mHostPath are constant during life time, no need to lock */ … … 296 296 sizeof (hostPathFull)) 297 297 : VERR_PATH_NOT_FOUND; 298 if (RT_SUCCESS 298 if (RT_SUCCESS(vrc)) 299 299 { 300 300 *aAccessible = TRUE; … … 302 302 } 303 303 304 AutoWriteLock alock 304 AutoWriteLock alock(this); 305 305 306 306 m.lastAccessError = BstrFmt ( 307 307 tr ("'%s' is not accessible (%Rrc)"), hostPath.raw(), vrc); 308 308 309 LogWarningThisFunc 309 LogWarningThisFunc(("m.lastAccessError=\"%ls\"\n", m.lastAccessError.raw())); 310 310 311 311 *aAccessible = FALSE; … … 324 324 STDMETHODIMP SharedFolder::COMGETTER(LastAccessError) (BSTR *aLastAccessError) 325 325 { 326 CheckComArgOutPointerValid 327 328 AutoCaller autoCaller 329 CheckComRCReturnRC 330 331 AutoReadLock alock 326 CheckComArgOutPointerValid(aLastAccessError); 327 328 AutoCaller autoCaller(this); 329 CheckComRCReturnRC(autoCaller.rc()); 330 331 AutoReadLock alock(this); 332 332 333 333 if (m.lastAccessError.isEmpty()) 334 334 Bstr("").cloneTo(aLastAccessError); 335 335 else 336 m.lastAccessError.cloneTo 336 m.lastAccessError.cloneTo(aLastAccessError); 337 337 338 338 return S_OK;
Note:
See TracChangeset
for help on using the changeset viewer.