Changeset 75042 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Oct 24, 2018 2:02:37 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/fileio-r0drv-darwin.cpp
r75039 r75042 266 266 } 267 267 268 269 RTDECL(int) RTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod, uint64_t *poffActual) 270 { 271 RTFILEINT *pThis = hFile; 272 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 273 AssertReturn(pThis->u32Magic == RTFILE_MAGIC, VERR_INVALID_HANDLE); 274 275 uint64_t offNew; 276 switch (uMethod) 277 { 278 case RTFILE_SEEK_BEGIN: 279 AssertReturn(offSeek >= 0, VERR_NEGATIVE_SEEK); 280 offNew = offSeek; 281 break; 282 283 case RTFILE_SEEK_CURRENT: 284 offNew = pThis->offFile + offSeek; 285 break; 286 287 case RTFILE_SEEK_END: 288 { 289 uint64_t cbFile = 0; 290 int rc = RTFileGetSize(hFile, &cbFile); 291 if (RT_SUCCESS(rc)) 292 offNew = cbFile + offSeek; 293 else 294 return rc; 295 break; 296 } 297 298 default: 299 return VERR_INVALID_PARAMETER; 300 } 301 302 if ((RTFOFF)offNew > 0) 303 { 304 pThis->offFile = offNew; 305 if (poffActual) 306 *poffActual = offNew; 307 return VINF_SUCCESS; 308 } 309 return VERR_NEGATIVE_SEEK; 310 } 311
Note:
See TracChangeset
for help on using the changeset viewer.