Changeset 48847 in vbox
- Timestamp:
- Oct 3, 2013 7:50:55 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/testcase/vbox-img.cpp
r46721 r48847 434 434 { 435 435 /* Repeat reading until buffer is full or EOF. */ 436 size_t cbSumRead = 0, cbRead; 437 uint8_t *pTmp = (uint8_t *)&pFS->abBuffer[0]; 436 size_t cbRead; 437 size_t cbSumRead = 0; 438 uint8_t *pbTmp = (uint8_t *)&pFS->abBuffer[0]; 438 439 size_t cbTmp = sizeof(pFS->abBuffer); 439 440 do 440 441 { 441 rc = RTFileRead(pFS->file, p Tmp, cbTmp, &cbRead);442 rc = RTFileRead(pFS->file, pbTmp, cbTmp, &cbRead); 442 443 if (RT_FAILURE(rc)) 443 444 return rc; 444 p Tmp += cbRead;445 pbTmp += cbRead; 445 446 cbTmp -= cbRead; 446 447 cbSumRead += cbRead; … … 448 449 449 450 pFS->offBuffer = 0; 450 pFS->cbBuffer = cbSumRead;451 pFS->cbBuffer = (uint32_t)cbSumRead; 451 452 if (!cbSumRead && !pcbRead) /* Caller can't handle partial reads. */ 452 453 return VERR_EOF; … … 468 469 469 470 /* Repeat reading until buffer is full or EOF. */ 470 size_t cbSumRead = 0, cbRead; 471 uint8_t *pTmp = (uint8_t *)&pFS->abBuffer[0]; 471 size_t cbRead; 472 size_t cbSumRead = 0; 473 uint8_t *pbTmp = (uint8_t *)&pFS->abBuffer[0]; 472 474 size_t cbTmp = sizeof(pFS->abBuffer); 473 475 do 474 476 { 475 rc = RTFileRead(pFS->file, p Tmp, cbTmp, &cbRead);477 rc = RTFileRead(pFS->file, pbTmp, cbTmp, &cbRead); 476 478 if (RT_FAILURE(rc)) 477 479 return rc; 478 p Tmp += cbRead;480 pbTmp += cbRead; 479 481 cbTmp -= cbRead; 480 482 cbSumRead += cbRead; … … 482 484 483 485 pFS->offBuffer += pFS->cbBuffer; 484 pFS->cbBuffer = cbSumRead;485 } 486 487 uint32_t cbThisRead = RT_MIN(cbBuffer,488 pFS->cbBuffer - uOffset % sizeof(pFS->abBuffer));486 pFS->cbBuffer = (uint32_t)cbSumRead; 487 } 488 489 uint32_t cbThisRead = (uint32_t)RT_MIN(cbBuffer, 490 pFS->cbBuffer - uOffset % sizeof(pFS->abBuffer)); 489 491 memcpy(pvBuffer, &pFS->abBuffer[uOffset % sizeof(pFS->abBuffer)], 490 492 cbThisRead); … … 658 660 } 659 661 660 uint32_t cbThisWrite = RT_MIN(cbBuffer,661 sizeof(pFS->abBuffer) - uOffset % sizeof(pFS->abBuffer));662 uint32_t cbThisWrite = (uint32_t)RT_MIN(cbBuffer, 663 sizeof(pFS->abBuffer) - uOffset % sizeof(pFS->abBuffer)); 662 664 memcpy(&pFS->abBuffer[uOffset % sizeof(pFS->abBuffer)], pvBuffer, 663 665 cbThisWrite);
Note:
See TracChangeset
for help on using the changeset viewer.