summaryrefslogtreecommitdiff
path: root/ace/SString.cpp
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-12-10 08:45:20 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-12-10 08:45:20 +0000
commit7db29418e44bdce4e3df96493b852118cdd82a4a (patch)
tree4e7c3861e67804fbca3da1d49652aa036f0edf31 /ace/SString.cpp
parent3d462be371ad3548e4d2d68abf4f95372e7c529f (diff)
downloadATCD-7db29418e44bdce4e3df96493b852118cdd82a4a.tar.gz
*** empty log message ***
Diffstat (limited to 'ace/SString.cpp')
-rw-r--r--ace/SString.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/ace/SString.cpp b/ace/SString.cpp
index 8b12fd98f90..edca2053215 100644
--- a/ace/SString.cpp
+++ b/ace/SString.cpp
@@ -84,6 +84,38 @@ ACE_CString::ACE_CString (const char *s, ACE_Allocator *alloc)
}
}
+// Constructor that copies <s> into dynamically allocated memory.
+// Probable loss of data. Please use with care.
+
+ACE_CString::ACE_CString (const ACE_USHORT16 *s, ACE_Allocator *alloc)
+ : allocator_ (alloc)
+{
+ ACE_TRACE ("ACE_CString::ACE_CString");
+
+ if (this->allocator_ == 0)
+ this->allocator_ = ACE_Service_Config::alloc ();
+
+ if (s == 0)
+ {
+ this->len_ = 0;
+ this->rep_ = 0;
+ }
+ else
+ {
+ this->len_ = ACE_WString::wstrlen (s);
+ this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1);
+
+ // Copy the ACE_USHORT16 * string byte-by-byte into the char *
+ // string.
+ for (size_t i = 0; i < this->len_; i++)
+#pragma warning(disable: 4244) // Possible loss of data
+ this->rep_[i] = (ACE_USHORT16) s[i];
+#pragma warning(default: 4244) // Possible loss of data
+
+ this->rep_[this->len_] = '\0';
+ }
+}
+
// Constructor that actually copies memory.
ACE_CString::ACE_CString (const char *s,
@@ -367,6 +399,7 @@ ACE_WString::ACE_WString (ACE_Allocator *alloc)
this->allocator_ = ACE_Service_Config::alloc ();
}
+/* static */
size_t
ACE_WString::wstrlen (const ACE_USHORT16 *s)
{