Changeset 37210 in vbox for trunk/src/VBox
- Timestamp:
- May 25, 2011 9:55:16 AM (14 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/circbuf.cpp
r37209 r37210 36 36 37 37 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. */ 43 typedef 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 38 59 RTDECL(int) RTCircBufCreate(PRTCIRCBUF *ppBuf, size_t cbSize) 39 60 { -
trunk/src/VBox/Runtime/testcase/tstRTCircBuf.cpp
r33286 r37210 30 30 #include <iprt/circbuf.h> 31 31 32 #include <iprt/err.h> 32 33 #include <iprt/string.h> 33 #include <iprt/err.h>34 34 #include <iprt/test.h> 35 35 … … 40 40 static void tst1(void) 41 41 { 42 void *pvBuf = NULL;43 size_t cbSize = 0;42 void *pvBuf; 43 size_t cbSize; 44 44 45 45 char pcTestPattern1[] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9 }; … … 62 62 RTTESTI_CHECK(RTCircBufFree(pBuf) == 0); 63 63 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 */ 65 65 66 66 /* Half read */ … … 81 81 RTTESTI_CHECK(RTCircBufFree(pBuf) == 3); 82 82 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 */ 84 84 85 85 /* Split tests */ … … 113 113 RTTESTI_CHECK(RTCircBufFree(pBuf) == 0); 114 114 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 */ 116 116 117 117 /* Destroy */
Note:
See TracChangeset
for help on using the changeset viewer.