VirtualBox

Changeset 4372 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Aug 24, 2007 9:21:51 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
23921
Message:

Finally corrected the RTFileRead, RTFileReadAt, RTFileWrite and RTFileWriteAt APIs to size_t. This was long overdue.

Location:
trunk/src/VBox/Runtime
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/fileio.cpp

    r4071 r4372  
    154154 *                      If NULL an error will be returned for a partial read.
    155155 */
    156 RTR3DECL(int)  RTFileReadAt(RTFILE File, RTFOFF off, void *pvBuf, unsigned cbToRead, unsigned *pcbRead)
     156RTR3DECL(int)  RTFileReadAt(RTFILE File, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead)
    157157{
    158158    int rc = RTFileSeek(File, off, RTFILE_SEEK_BEGIN, NULL);
     
    175175 *                      If NULL an error will be returned for a partial write.
    176176 */
    177 RTR3DECL(int)  RTFileWriteAt(RTFILE File, RTFOFF off, const void *pvBuf, unsigned cbToWrite, unsigned *pcbWritten)
     177RTR3DECL(int)  RTFileWriteAt(RTFILE File, RTFOFF off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
    178178{
    179179    int rc = RTFileSeek(File, off, RTFILE_SEEK_BEGIN, NULL);
  • trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp

    r4071 r4372  
    254254
    255255
    256 RTR3DECL(int)  RTFileRead(RTFILE File, void *pvBuf, unsigned cbToRead, unsigned *pcbRead)
     256RTR3DECL(int)  RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead)
    257257{
    258258    if (cbToRead <= 0)
     
    278278                    if (cbReadPart == 0)
    279279                        return VERR_EOF;
    280                     else
    281                         return RTErrConvertFromErrno(errno);
     280                    return RTErrConvertFromErrno(errno);
    282281                }
    283282                cbRead += cbReadPart;
     
    291290
    292291
    293 RTR3DECL(int)  RTFileWrite(RTFILE File, const void *pvBuf, unsigned cbToWrite, unsigned *pcbWritten)
     292RTR3DECL(int)  RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
    294293{
    295294    if (cbToWrite <= 0)
  • trunk/src/VBox/Runtime/r3/win32/fileio-win32.cpp

    r4071 r4372  
    284284
    285285
    286 RTR3DECL(int)  RTFileRead(RTFILE File, void *pvBuf, unsigned cbToRead, unsigned *pcbRead)
     286RTR3DECL(int)  RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead)
    287287{
    288288    if (cbToRead <= 0)
     
    314314
    315315
    316 RTR3DECL(int)  RTFileWrite(RTFILE File, const void *pvBuf, unsigned cbToWrite, unsigned *pcbWritten)
     316RTR3DECL(int)  RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
    317317{
    318318    if (cbToWrite <= 0)
  • trunk/src/VBox/Runtime/testcase/tstFile.cpp

    r4071 r4372  
    7575        }
    7676        static const char szTestBuf[] = "Sausages and bacon for breakfast again!";
    77         unsigned cbWritten = 0;
     77        size_t cbWritten = 0;
    7878        while (cbWritten < sizeof(szTestBuf))
    7979        {
    80             unsigned cbWrittenPart;
     80            size_t cbWrittenPart;
    8181            rc = RTFileWrite(File, &szTestBuf[cbWritten], sizeof(szTestBuf) - cbWritten, &cbWrittenPart);
    8282            if (RT_FAILURE(rc))
     
    101101            {
    102102                char        szReadBuf[sizeof(szTestBuf)];
    103                 unsigned    cbRead = 0;
     103                size_t      cbRead = 0;
    104104                while (cbRead < sizeof(szTestBuf))
    105105                {
    106                     unsigned cbReadPart;
     106                    size_t cbReadPart;
    107107                    rc = RTFileRead(File, &szReadBuf[cbRead], sizeof(szTestBuf) - cbRead, &cbReadPart);
    108108                    if (RT_FAILURE(rc))
     
    147147            else
    148148            {
    149                 unsigned cbWritten = 0;
     149                size_t cbWritten = 0;
    150150                while (cbWritten < sizeof(szTestBuf))
    151151                {
    152                     unsigned cbWrittenPart;
     152                    size_t cbWrittenPart;
    153153                    rc = RTFileWrite(File, &szTestBuf[cbWritten], sizeof(szTestBuf) - cbWritten, &cbWrittenPart);
    154154                    if (RT_FAILURE(rc))
     
    172172                    {
    173173                        char        szReadBuf[sizeof(szTestBuf)];
    174                         unsigned    cbRead = 0;
     174                        size_t      cbRead = 0;
    175175                        while (cbRead < sizeof(szTestBuf))
    176176                        {
    177                             unsigned cbReadPart;
     177                            size_t cbReadPart;
    178178                            rc = RTFileRead(File, &szReadBuf[cbRead], sizeof(szTestBuf) - cbRead, &cbReadPart);
    179179                            if (RT_FAILURE(rc))
Note: See TracChangeset for help on using the changeset viewer.

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