summaryrefslogtreecommitdiffstats
path: root/qtools/scstring.cpp
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2007-03-15 10:14:23 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2007-03-15 10:14:23 (GMT)
commit97a3911e2682bfebeebbb8999c9e3844c414c3e0 (patch)
tree5300b179faf00eea740dda6ee3be5343c70b1c79 /qtools/scstring.cpp
parentf7f03d9491454ddc9b855b8637d482df6bd622c2 (diff)
downloadDoxygen-97a3911e2682bfebeebbb8999c9e3844c414c3e0.zip
Doxygen-97a3911e2682bfebeebbb8999c9e3844c414c3e0.tar.gz
Doxygen-97a3911e2682bfebeebbb8999c9e3844c414c3e0.tar.bz2
Release-1.5.1-20070315
Diffstat (limited to 'qtools/scstring.cpp')
-rw-r--r--qtools/scstring.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/qtools/scstring.cpp b/qtools/scstring.cpp
index 18a5492..5632f57 100644
--- a/qtools/scstring.cpp
+++ b/qtools/scstring.cpp
@@ -13,10 +13,17 @@
*
*/
+// with this switch you can choose between the original qcstring implementation,
+// which implicitly shares data so copying is faster, but requires at least 12 bytes, and
+// the new implementation in this file, which has a smaller footprint (only 4 bytes for
+// an empty string), but always copies strings.
+#define SMALLSTRING
+
#include "qcstring.h"
#ifndef SMALLSTRING
#include "qcstring.cpp"
#else
+#define SCString QCString
#include <qstring.h>
#include <stdlib.h>
@@ -60,7 +67,7 @@ SCString::SCString( const char *str, uint maxlen )
if (str && ( l = QMIN(qstrlen(str),maxlen) ))
{
m_data=(char *)malloc(l+1);
- strncpy(m_data,str,maxlen);
+ strncpy(m_data,str,l+1);
m_data[l]='\0';
}
else