VirtualBox

Changeset 37210 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 25, 2011 9:55:16 AM (14 years ago)
Author:
vboxsync
Message:

circbuf: make the structure abstract.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/misc/circbuf.cpp

    r37209 r37210  
    3636
    3737
     38/*******************************************************************************
     39*   Structures and Typedefs                                                    *
     40*******************************************************************************/
     41/** @todo r=bird: this is missing docs and magic. uXPos should be offX.
     42 *        cbBufSize should be cbBuf. */
     43typedef struct RTCIRCBUF
     44{
     45    /** The current read position in the buffer. */
     46    size_t          uReadPos;
     47    /** The current write position in the buffer. */
     48    size_t          uWritePos;
     49    /** How much space of the buffer is currently in use. */
     50    volatile size_t cbBufUsed;
     51    /** How big is the buffer. */
     52    size_t          cbBufSize;
     53    /** The buffer itself. */
     54    void           *pvBuf;
     55} RTCIRCBUF;
     56
     57
     58
    3859RTDECL(int) RTCircBufCreate(PRTCIRCBUF *ppBuf, size_t cbSize)
    3960{
  • trunk/src/VBox/Runtime/testcase/tstRTCircBuf.cpp

    r33286 r37210  
    3030#include <iprt/circbuf.h>
    3131
     32#include <iprt/err.h>
    3233#include <iprt/string.h>
    33 #include <iprt/err.h>
    3434#include <iprt/test.h>
    3535
     
    4040static void tst1(void)
    4141{
    42     void *pvBuf = NULL;
    43     size_t cbSize = 0;
     42    void *pvBuf;
     43    size_t cbSize;
    4444
    4545    char pcTestPattern1[] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9 };
     
    6262    RTTESTI_CHECK(RTCircBufFree(pBuf) == 0);
    6363    RTTESTI_CHECK(RTCircBufUsed(pBuf) == 10);
    64     RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern1, 10) == 0); /* Check the internal state */
     64//    RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern1, 10) == 0); /* Check the internal state */
    6565
    6666    /* Half read */
     
    8181    RTTESTI_CHECK(RTCircBufFree(pBuf) == 3);
    8282    RTTESTI_CHECK(RTCircBufUsed(pBuf) == 7);
    83     RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern2, 10) == 0); /* Check the internal state */
     83//    RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern2, 10) == 0); /* Check the internal state */
    8484
    8585    /* Split tests */
     
    113113    RTTESTI_CHECK(RTCircBufFree(pBuf) == 0);
    114114    RTTESTI_CHECK(RTCircBufUsed(pBuf) == 10);
    115     RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern3, 10) == 0); /* Check the internal state */
     115//    RTTESTI_CHECK(memcmp(pBuf->pvBuf, pcTestPattern3, 10) == 0); /* Check the internal state */
    116116
    117117    /* Destroy */
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