Changeset 38686 in vbox for trunk/src/VBox/Runtime/common/misc
- Timestamp:
- Sep 8, 2011 9:30:17 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/sg.cpp
r38539 r38686 36 36 static void *sgBufGet(PRTSGBUF pSgBuf, size_t *pcbData) 37 37 { 38 size_t cbData = RT_MIN(*pcbData, pSgBuf->cbSegLeft); 39 void *pvBuf = pSgBuf->pvSegCur; 38 size_t cbData; 39 void *pvBuf; 40 41 /* Check that the S/G buffer has memory left. */ 42 if (RT_UNLIKELY( pSgBuf->idxSeg == pSgBuf->cSegs 43 && !pSgBuf->cbSegLeft)) 44 { 45 *pcbData = 0; 46 return NULL; 47 } 40 48 41 49 AssertReleaseMsg( pSgBuf->cbSegLeft <= 5 * _1M … … 46 54 pSgBuf->idxSeg, pSgBuf->paSegs[pSgBuf->idxSeg].pvSeg, pSgBuf->idxSeg, pSgBuf->paSegs[pSgBuf->idxSeg].cbSeg)); 47 55 56 cbData = RT_MIN(*pcbData, pSgBuf->cbSegLeft); 57 pvBuf = pSgBuf->pvSegCur; 48 58 pSgBuf->cbSegLeft -= cbData; 49 59 … … 53 63 pSgBuf->idxSeg++; 54 64 55 if (RT_UNLIKELY(pSgBuf->idxSeg == pSgBuf->cSegs)) 56 { 57 pSgBuf->cbSegLeft = 0; 58 pSgBuf->pvSegCur = NULL; 59 } 60 else 65 if (pSgBuf->idxSeg < pSgBuf->cSegs) 61 66 { 62 67 pSgBuf->pvSegCur = pSgBuf->paSegs[pSgBuf->idxSeg].pvSeg;
Note:
See TracChangeset
for help on using the changeset viewer.