aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/str.cpp7
-rw-r--r--common/str.h4
2 files changed, 11 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp
index 481d3e3ddc..699f1c096b 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -25,11 +25,17 @@
namespace Common {
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
const String String::emptyString;
+#else
+const char *String::emptyString = "";
+#endif
String::String(const char *str, int len)
: _str(0), _len(0) {
+
_refCount = new int(1);
+
if (str && len != 0) {
if (len > 0)
_capacity = _len = len;
@@ -46,6 +52,7 @@ String::String(const char *str, int len)
String::String(const String &str)
: _str(0), _len(0) {
+
++(*str._refCount);
_refCount = str._refCount;
diff --git a/common/str.h b/common/str.h
index 2c68630507..f8052c74ae 100644
--- a/common/str.h
+++ b/common/str.h
@@ -37,7 +37,11 @@ protected:
int _capacity;
public:
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
static const String emptyString;
+#else
+ static const char *emptyString;
+#endif
String() : _str(0), _len(0), _capacity(0) { _refCount = new int(1); }
String(const char *str, int len = -1);