VirtualBox

Changeset 34964 in vbox for trunk


Ignore:
Timestamp:
Dec 10, 2010 5:18:30 PM (14 years ago)
Author:
vboxsync
Message:

Added RTVfsIoStrmValidateUtf8Encoding (stubbed).

Location:
trunk
Files:
2 edited

Legend:

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

    r34786 r34964  
    479479 * @sa      RTVfsFileToIoStream
    480480 */
    481 RTDECL(RTVFSFILE) RTVfsIoStrmToFile(RTVFSIOSTREAM hVfsIos);
     481RTDECL(RTVFSFILE)   RTVfsIoStrmToFile(RTVFSIOSTREAM hVfsIos);
    482482
    483483/**
     
    490490 * @sa      RTFileQueryInfo
    491491 */
    492 RTDECL(int) RTVfsIoStrmQueryInfo(RTVFSIOSTREAM hVfsIos, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
     492RTDECL(int)         RTVfsIoStrmQueryInfo(RTVFSIOSTREAM hVfsIos, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
    493493
    494494/**
     
    520520 *          RTSocketRead
    521521 */
    522 RTDECL(int) RTVfsIoStrmRead(RTVFSIOSTREAM hVfsIos, void *pvBuf, size_t cbToRead, bool fBlocking, size_t *pcbRead);
     522RTDECL(int)         RTVfsIoStrmRead(RTVFSIOSTREAM hVfsIos, void *pvBuf, size_t cbToRead, bool fBlocking, size_t *pcbRead);
    523523
    524524/**
     
    538538 *          RTSocketWrite
    539539 */
    540 RTDECL(int) RTVfsIoStrmWrite(RTVFSIOSTREAM hVfsIos, const void *pvBuf, size_t cbToWrite, bool fBlocking, size_t *pcbWritten);
     540RTDECL(int)         RTVfsIoStrmWrite(RTVFSIOSTREAM hVfsIos, const void *pvBuf, size_t cbToWrite, bool fBlocking, size_t *pcbWritten);
    541541
    542542/**
     
    610610 * @sa      RTVfsFilePoll, RTPollSetAdd, RTPoll, RTPollNoResume.
    611611 */
    612 RTDECL(int)      RTVfsIoStrmPoll(RTVFSIOSTREAM hVfsIos, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr,
    613                                  uint32_t *pfRetEvents);
     612RTDECL(int)         RTVfsIoStrmPoll(RTVFSIOSTREAM hVfsIos, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr,
     613                                    uint32_t *pfRetEvents);
    614614/**
    615615 * Tells the current I/O stream position.
     
    647647 */
    648648RTDECL(bool)        RTVfsIoStrmIsAtEnd(RTVFSIOSTREAM hVfsIos);
     649
     650/**
     651 * Process the rest of the stream, checking if it's all valid UTF-8 encoding.
     652 *
     653 * @returns VBox status cod.e
     654 *
     655 * @param   hVfsIos         The VFS I/O stream handle.
     656 */
     657RTDECL(int)        RTVfsIoStrmValidateUtf8Encoding(RTVFSIOSTREAM hVfsIos);
     658
    649659/** @} */
    650660
  • trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp

    r34786 r34964  
    22542254
    22552255
     2256RTDECL(int) RTVfsIoStrmValidateUtf8Encoding(RTVFSIOSTREAM hVfsIos)
     2257{
     2258    char    achBuf[1024 + 1];
     2259    size_t  cbUsed = 0;
     2260    int     rc;
     2261    for (;;)
     2262    {
     2263        /*
     2264         * Fill the buffer
     2265         */
     2266        size_t cbRead = 0;
     2267        rc = RTVfsIoStrmRead(hVfsIos, &achBuf[cbUsed], sizeof(achBuf) - cbUsed - 1, true /*fBlocking*/, &cbRead);
     2268        if (RT_FAILURE(rc))
     2269            break;
     2270        cbUsed += cbRead;
     2271        if (!cbUsed)
     2272        {
     2273            Assert(rc == VINF_EOF);
     2274            break;
     2275        }
     2276
     2277        /*
     2278         * Process the data in the buffer, maybe leaving the final chars till
     2279         * the next round.
     2280         */
     2281/** @todo  implement this */
     2282    }
     2283
     2284    return rc == VINF_EOF ? VINF_SUCCESS : rc;
     2285}
     2286
    22562287
    22572288
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