VirtualBox

Changeset 100930 in vbox for trunk


Ignore:
Timestamp:
Aug 21, 2023 11:10:07 PM (18 months ago)
Author:
vboxsync
Message:

IPRT/vfs: Added RTVfsFileReadAll and RTVfsFileReadAllFree.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/mangling.h

    r100929 r100930  
    29162916# define RTVfsFileQueryMaxSize                          RT_MANGLER(RTVfsFileQueryMaxSize)
    29172917# define RTVfsFileRead                                  RT_MANGLER(RTVfsFileRead)
     2918# define RTVfsFileReadAll                               RT_MANGLER(RTVfsFileReadAll)
     2919# define RTVfsFileReadAllFree                           RT_MANGLER(RTVfsFileReadAllFree)
    29182920# define RTVfsFileReadAt                                RT_MANGLER(RTVfsFileReadAt)
    29192921# define RTVfsFileRelease                               RT_MANGLER(RTVfsFileRelease)
  • trunk/include/iprt/vfs.h

    r100929 r100930  
    10661066 * Reads the remainder of the stream into a memory buffer.
    10671067 *
    1068  * For simplifying string-style processing, the is a zero byte after the
     1068 * For simplifying string-style processing, there is a zero byte after the
    10691069 * returned buffer, making sure it can be used as a zero terminated string.
    10701070 *
     
    10741074 *                          RTVfsIoStrmReadAllFree for freeing, not RTMemFree!
    10751075 * @param   pcbBuf          Where to return the buffer size.
     1076 * @sa      RTVfsFileReadAll
    10761077 */
    10771078RTDECL(int)         RTVfsIoStrmReadAll(RTVFSIOSTREAM hVfsIos, void **ppvBuf, size_t *pcbBuf);
     
    10821083 * @param   pvBuf           What RTVfsIoStrmReadAll returned.
    10831084 * @param   cbBuf           What RTVfsIoStrmReadAll returned.
     1085 * @sa      RTVfsFileReadAllFree
    10841086 */
    10851087RTDECL(void)        RTVfsIoStrmReadAllFree(void *pvBuf, size_t cbBuf);
     
    14081410RTDECL(int)         RTVfsFileRead(RTVFSFILE hVfsFile, void *pvBuf, size_t cbToRead, size_t *pcbRead);
    14091411RTDECL(int)         RTVfsFileReadAt(RTVFSFILE hVfsFile, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead);
     1412
     1413/**
     1414 * Reads the remainder of the file into a memory buffer.
     1415 *
     1416 * For simplifying string-style processing, there is a zero byte after the
     1417 * returned buffer, making sure it can be used as a zero terminated string.
     1418 *
     1419 * @returns IPRT status code.
     1420 * @param   hVfsIos         The VFS I/O stream handle.
     1421 * @param   ppvBuf          Where to return the buffer.  Must pass to
     1422 *                          RTVfsFileReadAllFree for freeing, not RTMemFree!
     1423 * @param   pcbBuf          Where to return the buffer size.
     1424 * @sa      RTVfsIoStrmReadAll
     1425 */
     1426RTDECL(int)         RTVfsFileReadAll(RTVFSFILE hVfsFile, void **ppvBuf, size_t *pcbBuf);
     1427
     1428/**
     1429 * Free memory buffer returned by RTVfsFileReadAll.
     1430 *
     1431 * @param   pvBuf           What RTVfsFileReadAll returned.
     1432 * @param   cbBuf           What RTVfsFileReadAll returned.
     1433 * @sa      RTVfsIoStrmReadAllFree
     1434 */
     1435RTDECL(void)        RTVfsFileReadAllFree(void *pvBuf, size_t cbBuf);
    14101436
    14111437/**
  • trunk/src/VBox/Runtime/common/vfs/vfsiosmisc.cpp

    r100929 r100930  
    237237}
    238238
     239
     240RTDECL(int) RTVfsFileReadAll(RTVFSFILE hVfsFile, void **ppvBuf, size_t *pcbBuf)
     241{
     242    RTVFSIOSTREAM hVfsIos = RTVfsFileToIoStream(hVfsFile);
     243    int rc = RTVfsIoStrmReadAll(hVfsIos, ppvBuf, pcbBuf);
     244    RTVfsIoStrmRelease(hVfsIos);
     245    return rc;
     246}
     247
     248
     249RTDECL(void) RTVfsFileReadAllFree(void *pvBuf, size_t cbBuf)
     250{
     251    RTVfsIoStrmReadAllFree(pvBuf, cbBuf);
     252}
     253
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette