aboutsummaryrefslogtreecommitdiff
path: root/src/stable
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2023-08-04 13:23:44 -0700
committerMike Buland <eichlan@xagasoft.com>2023-08-04 13:23:44 -0700
commit99095773aa31bf8eb283d6f6319a29c71e51ca9c (patch)
tree9727523e7d3a035cb4e8e6c1d9eacbe49c766397 /src/stable
parent311d146e2d921bed4ae9d3b19203e935358b30ba (diff)
downloadlibbu++-99095773aa31bf8eb283d6f6319a29c71e51ca9c.tar.gz
libbu++-99095773aa31bf8eb283d6f6319a29c71e51ca9c.tar.bz2
libbu++-99095773aa31bf8eb283d6f6319a29c71e51ca9c.tar.xz
libbu++-99095773aa31bf8eb283d6f6319a29c71e51ca9c.zip
Woo! Unit Tests! Found some bugs!
Diffstat (limited to '')
-rw-r--r--src/stable/string.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/stable/string.cpp b/src/stable/string.cpp
index d8fd218..6bb2c8e 100644
--- a/src/stable/string.cpp
+++ b/src/stable/string.cpp
@@ -15,7 +15,7 @@
15#include "bu/blob.h" 15#include "bu/blob.h"
16#include <stdlib.h> 16#include <stdlib.h>
17 17
18#define nMinSize (256) 18#define nMinSize (255)
19 19
20Bu::StringCore::StringCore() : 20Bu::StringCore::StringCore() :
21 nLength( 0 ), 21 nLength( 0 ),
@@ -83,7 +83,7 @@ Bu::StringCore::Chunk *Bu::StringCore::newChunk( long nLen ) const
83 Chunk *pNew = new Chunk; 83 Chunk *pNew = new Chunk;
84 pNew->pNext = NULL; 84 pNew->pNext = NULL;
85 pNew->nLength = nLen; 85 pNew->nLength = nLen;
86 pNew->pData = new char[(nLen<nMinSize)?(nMinSize):(nLen)+1]; 86 pNew->pData = new char[(nLen<nMinSize)?(nMinSize+1):(nLen)+1];
87 pNew->pData[nLen] = (char)0; 87 pNew->pData[nLen] = (char)0;
88 return pNew; 88 return pNew;
89} 89}
@@ -95,7 +95,7 @@ Bu::StringCore::Chunk *Bu::StringCore::copyChunk(
95 pNew->pNext = pSrc->pNext; 95 pNew->pNext = pSrc->pNext;
96 pNew->nLength = pSrc->nLength; 96 pNew->nLength = pSrc->nLength;
97 pNew->pData = new char[ 97 pNew->pData = new char[
98 (pNew->nLength<nMinSize)?(nMinSize):(pNew->nLength)+1 98 (pNew->nLength<nMinSize)?(nMinSize+1):(pNew->nLength)+1
99 ]; 99 ];
100 memcpy( pNew->pData, pSrc->pData, pSrc->nLength ); 100 memcpy( pNew->pData, pSrc->pData, pSrc->nLength );
101 pNew->pData[pNew->nLength] = (char)0; 101 pNew->pData[pNew->nLength] = (char)0;