Changeset 40127 in vbox for trunk/src/VBox/Runtime/common/vfs
- Timestamp:
- Feb 14, 2012 12:01:04 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 76271
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/vfs/vfsmemory.cpp
r39515 r40127 5 5 6 6 /* 7 * Copyright (C) 2010 Oracle Corporation7 * Copyright (C) 2010-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 462 462 if (!fHit) 463 463 { 464 Assert(!pExtent || (pExtent->off < offUnsigned && pExtent->off + pExtent->cb <= offUnsigned));464 Assert(!pExtent || offUnsigned < pExtent->off); 465 465 466 466 /* Skip leading zeros if there is a whole bunch of them. */ 467 467 uint8_t const *pbSrcNZ = (uint8_t const *)ASMMemIsAll8(pbSrc, cbLeftToWrite, 0); 468 if (!pbSrcNZ) 468 size_t cbZeros = pbSrcNZ ? pbSrcNZ - pbSrc : cbLeftToWrite; 469 if (cbZeros) 469 470 { 470 offUnsigned += cbLeftToWrite; 471 cbLeftToWrite = 0; 472 break; 473 } 474 size_t const cbZeros = pbSrcNZ - pbSrc; 475 if (cbZeros >= RT_MIN(pThis->cbExtent, _64K)) 476 { 471 uint64_t const cbToNext = pExtent ? pExtent->off - offUnsigned : UINT64_MAX; 472 if (cbZeros > cbToNext) 473 cbZeros = (size_t)cbToNext; 477 474 offUnsigned += cbZeros; 478 475 cbLeftToWrite -= cbZeros; 479 pbSrc = pbSrcNZ; 480 pExtent = rtVfsMemFile_LocateExtent(pThis, offUnsigned, &fHit); 481 break; 476 if (!cbLeftToWrite) 477 break; 478 479 Assert(!pExtent || offUnsigned <= pExtent->off); 480 if (pExtent && pExtent->off == offUnsigned) 481 { 482 fHit = true; 483 continue; 484 } 482 485 } 483 486 … … 508 511 509 512 /* 510 * Advance to the next extent .513 * Advance to the next extent (emulate the lookup). 511 514 */ 512 PRTVFSMEMEXTENT pNext = RTListGetNext(&pThis->ExtentHead, pExtent, RTVFSMEMEXTENT, Entry); 513 Assert(!pNext || pNext->off >= offUnsigned); 514 if (pNext && pNext->off == offUnsigned) 515 pExtent = pNext; 516 else 517 fHit = false; 515 pExtent = RTListGetNext(&pThis->ExtentHead, pExtent, RTVFSMEMEXTENT, Entry); 516 fHit = pExtent && (offUnsigned - pExtent->off < pExtent->cb); 518 517 } 519 518
Note:
See TracChangeset
for help on using the changeset viewer.