From 12f40ae7776ff6204212c91e819951d5ff4eec66 Mon Sep 17 00:00:00 2001 From: Chris Apers Date: Sat, 8 Oct 2005 19:07:18 +0000 Subject: PalmOS: cannot use global objects in ARM svn-id: r18962 --- common/str.cpp | 7 +++++++ common/str.h | 4 ++++ 2 files changed, 11 insertions(+) (limited to 'common') 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); -- cgit v1.2.3