Changeset 99960 in vbox for trunk/include/iprt
- Timestamp:
- May 24, 2023 9:55:50 PM (23 months ago)
- svn:sync-xref-src-repo-rev:
- 157620
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/sg.h
r99739 r99960 176 176 DECLINLINE(bool) RTSgBufIsAtEnd(PCRTSGBUF pSgBuf) 177 177 { 178 return pSgBuf->idxSeg > pSgBuf->cSegs179 || ( pSgBuf-> idxSeg == pSgBuf->cSegs180 && pSgBuf-> cbSegLeft == 0);178 return pSgBuf->idxSeg >= pSgBuf->cSegs 179 || ( pSgBuf->cbSegLeft == 0 /* sg.cpp doesn't create this situation, but just in case someone does. */ 180 && pSgBuf->idxSeg + 1 == pSgBuf->cSegs); 181 181 } 182 182 … … 200 200 * @param cSegs Number of segments in the array. 201 201 * 202 * @note paSegs and cSegs can be NULL and 0 respectively to indicate an empty203 * S/G buffer. Operations on the S/G buffer will not do anything in this204 * case.202 * @note paSegs and cSegs can be NULL and 0 respectively to indicate an empty 203 * S/G buffer. Operations on the S/G buffer will not do anything in 204 * this case. 205 205 */ 206 206 RTDECL(void) RTSgBufInit(PRTSGBUF pSgBuf, PCRTSGSEG paSegs, size_t cSegs); … … 215 215 /** 216 216 * Clones a given S/G buffer. 217 * 217 * 218 * This is only a shallow copy. Both S/G buffers will point to the same segment 219 * array. 220 * 221 * The buffer position will be preserved. 222 * 218 223 * @param pSgBufNew The new S/G buffer to clone to. 219 224 * @param pSgBufOld The source S/G buffer to clone from. 220 *221 * @note This is only a shallow copy. Both S/G buffers will point to the222 * same segment array.223 225 */ 224 226 RTDECL(void) RTSgBufClone(PRTSGBUF pSgBufNew, PCRTSGBUF pSgBufOld); … … 257 259 * is smaller than the amount of bytes requested. 258 260 * 259 * @note This operation advances the internal buffer pointer of both S/G buffers.261 * @note This operation advances the internal buffer pointer of both S/G buffers. 260 262 */ 261 263 RTDECL(void *) RTSgBufGetNextSegment(PRTSGBUF pSgBuf, size_t *pcbSeg); … … 269 271 * @param cbCopy Number of bytes to copy. 270 272 * 271 * @note This operation advances the internal buffer pointer of both S/G buffers.273 * @note This operation advances the internal buffer pointer of both S/G buffers. 272 274 */ 273 275 RTDECL(size_t) RTSgBufCopy(PRTSGBUF pSgBufDst, PRTSGBUF pSgBufSrc, size_t cbCopy); … … 281 283 * @param cbCmp How many bytes to compare. 282 284 * 283 * @note This operation doesn't change the internal position of the S/G buffers.285 * @note This operation doesn't change the internal position of the S/G buffers. 284 286 */ 285 287 RTDECL(int) RTSgBufCmp(PCRTSGBUF pSgBuf1, PCRTSGBUF pSgBuf2, size_t cbCmp); … … 306 308 * Can be less than than cbSet if the end of the S/G buffer was reached. 307 309 * @param pSgBuf The S/G buffer. 308 * @param ubFillThe byte to fill the buffer with.309 * @param cb SetHow many bytes to set.310 * 311 * @note This operation advances the internal buffer pointer of the S/G buffer.312 */ 313 RTDECL(size_t) RTSgBufSet(PRTSGBUF pSgBuf, uint8_t ubFill, size_t cbSet);310 * @param bFill The byte to fill the buffer with. 311 * @param cbToSet How many bytes to set. 312 * 313 * @note This operation advances the internal buffer pointer of the S/G buffer. 314 */ 315 RTDECL(size_t) RTSgBufSet(PRTSGBUF pSgBuf, uint8_t bFill, size_t cbToSet); 314 316 315 317 /** … … 321 323 * @param cbCopy How many bytes to copy. 322 324 * 323 * @note This operation advances the internal buffer pointer of the S/G buffer.325 * @note This operation advances the internal buffer pointer of the S/G buffer. 324 326 */ 325 327 RTDECL(size_t) RTSgBufCopyToBuf(PRTSGBUF pSgBuf, void *pvBuf, size_t cbCopy); … … 333 335 * @param cbCopy How many bytes to copy. 334 336 * 335 * @note This operation advances the internal buffer pointer of the S/G buffer.337 * @note This operation advances the internal buffer pointer of the S/G buffer. 336 338 */ 337 339 RTDECL(size_t) RTSgBufCopyFromBuf(PRTSGBUF pSgBuf, const void *pvBuf, size_t cbCopy); … … 346 348 * @param pvUser Opaque user data to pass in the given callback. 347 349 * 348 * @note This operation advances the internal buffer pointer of the S/G buffer.350 * @note This operation advances the internal buffer pointer of the S/G buffer. 349 351 */ 350 352 RTDECL(size_t) RTSgBufCopyToFn(PRTSGBUF pSgBuf, size_t cbCopy, PFNRTSGBUFCOPYTO pfnCopyTo, void *pvUser); … … 359 361 * @param pvUser Opaque user data to pass in the given callback. 360 362 * 361 * @note This operation advances the internal buffer pointer of the S/G buffer.363 * @note This operation advances the internal buffer pointer of the S/G buffer. 362 364 */ 363 365 RTDECL(size_t) RTSgBufCopyFromFn(PRTSGBUF pSgBuf, size_t cbCopy, PFNRTSGBUFCOPYFROM pfnCopyFrom, void *pvUser); … … 392 394 * Returns whether the given S/G buffer is zeroed out from the current position 393 395 * upto the number of bytes to check. 394 * 395 * @ret urnstrue if the buffer has only zeros396 * 396 * 397 * @retval true if the buffer has only zeros 398 * @retval false otherwise. 397 399 * @param pSgBuf The S/G buffer. 398 * @param cbCheck Number of bytes to check. 400 * @param cbCheck Number of bytes to check. 401 * 402 * @note This operation advances the internal buffer pointer of the S/G buffer. 399 403 */ 400 404 RTDECL(bool) RTSgBufIsZero(PRTSGBUF pSgBuf, size_t cbCheck);
Note:
See TracChangeset
for help on using the changeset viewer.