diff options
Diffstat (limited to '')
-rw-r--r-- | src/unstable/blobbuilder.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/unstable/blobbuilder.cpp b/src/unstable/blobbuilder.cpp index d4b458b..497a1a1 100644 --- a/src/unstable/blobbuilder.cpp +++ b/src/unstable/blobbuilder.cpp | |||
@@ -8,7 +8,7 @@ | |||
8 | #include "bu/blobbuilder.h" | 8 | #include "bu/blobbuilder.h" |
9 | #include "bu/blob.h" | 9 | #include "bu/blob.h" |
10 | 10 | ||
11 | #define PAGE_SIZE 1024 | 11 | #define PAGE_SIZE 8 |
12 | 12 | ||
13 | ///// | 13 | ///// |
14 | // BlobBuilderCore::Chunk | 14 | // BlobBuilderCore::Chunk |
@@ -109,20 +109,20 @@ void Bu::BlobBuilderCore::clear() | |||
109 | delete pCur; | 109 | delete pCur; |
110 | pCur = pNext; | 110 | pCur = pNext; |
111 | } | 111 | } |
112 | delete pFirst; | ||
113 | pFirst = pLast = 0; | 112 | pFirst = pLast = 0; |
114 | iLength = 0; | 113 | iLength = 0; |
115 | } | 114 | } |
116 | 115 | ||
117 | void Bu::BlobBuilderCore::append( const char *pSrc, int32_t iLength ) | 116 | void Bu::BlobBuilderCore::append( const char *pSrc, int32_t iLength ) |
118 | { | 117 | { |
118 | this->iLength += iLength; | ||
119 | if( pFirst == 0 ) | 119 | if( pFirst == 0 ) |
120 | { | 120 | { |
121 | // Nothing in the list, just add a chunk. | 121 | // Nothing in the list, just add a chunk. |
122 | pFirst = pLast = new Chunk( pSrc, iLength ); | 122 | pFirst = pLast = new Chunk( pSrc, iLength ); |
123 | return; | 123 | return; |
124 | } | 124 | } |
125 | else if( pLast->iLength < 1024 ) | 125 | else if( pLast->iLength < PAGE_SIZE ) |
126 | { | 126 | { |
127 | // Append to the last chunk first, this will modify pSrc & iLength. | 127 | // Append to the last chunk first, this will modify pSrc & iLength. |
128 | pLast->append( pSrc, iLength ); | 128 | pLast->append( pSrc, iLength ); |
@@ -147,6 +147,7 @@ void Bu::BlobBuilderCore::prepend( const char *pSrc, int32_t iLength ) | |||
147 | pNew->pNext = pFirst; | 147 | pNew->pNext = pFirst; |
148 | pFirst = pNew; | 148 | pFirst = pNew; |
149 | } | 149 | } |
150 | this->iLength += iLength; | ||
150 | } | 151 | } |
151 | 152 | ||
152 | void Bu::BlobBuilderCore::insert( int32_t iBefore, const char *pSrc, | 153 | void Bu::BlobBuilderCore::insert( int32_t iBefore, const char *pSrc, |
@@ -185,6 +186,7 @@ void Bu::BlobBuilderCore::insert( int32_t iBefore, const char *pSrc, | |||
185 | } | 186 | } |
186 | pCur = pCur->pNext; | 187 | pCur = pCur->pNext; |
187 | } | 188 | } |
189 | this->iLength += iLength; | ||
188 | } | 190 | } |
189 | 191 | ||
190 | void Bu::BlobBuilderCore::set( const char *pSrc, int32_t iLength ) | 192 | void Bu::BlobBuilderCore::set( const char *pSrc, int32_t iLength ) |