summaryrefslogtreecommitdiff
path: root/ace/SString.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-22 05:10:33 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-22 05:10:33 +0000
commit2f5432a85a66c5f618cdaf8032f13be787311a31 (patch)
tree5ece8e95375cf7088ce6633c23421ceaaab9b039 /ace/SString.cpp
parent88aa3350698954b097db8533a892fb45f6e59149 (diff)
downloadATCD-2f5432a85a66c5f618cdaf8032f13be787311a31.tar.gz
*** empty log message ***
Diffstat (limited to 'ace/SString.cpp')
-rw-r--r--ace/SString.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/ace/SString.cpp b/ace/SString.cpp
index a32237cdbab..8b12fd98f90 100644
--- a/ace/SString.cpp
+++ b/ace/SString.cpp
@@ -79,15 +79,16 @@ ACE_CString::ACE_CString (const char *s, ACE_Allocator *alloc)
{
this->len_ = ACE_OS::strlen (s);
this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1);
- ACE_OS::strcpy (this->rep_, s);
+ ACE_OS::memcpy (this->rep_, s, this->len_);
+ this->rep_[this->len_] = '\0';
}
}
// Constructor that actually copies memory.
ACE_CString::ACE_CString (const char *s,
- size_t len,
- ACE_Allocator *alloc)
+ size_t len,
+ ACE_Allocator *alloc)
: allocator_ (alloc)
{
ACE_TRACE ("ACE_CString::ACE_CString");
@@ -104,7 +105,7 @@ ACE_CString::ACE_CString (const char *s,
{
this->len_ = len;
this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1);
- ACE_OS::strncpy (this->rep_, s, len);
+ ACE_OS::memcpy (this->rep_, s, len);
this->rep_[len] = '\0'; // Make sure to NUL terminate this!
}
}
@@ -207,7 +208,7 @@ ACE_SString::ACE_SString (const ACE_SString &s)
this->rep_ = (char *) this->allocator_->malloc (s.len_ + 1);
ACE_OS::memcpy ((void *) this->rep_, (const void *) s.rep_, this->len_);
- this->rep_[this->len_] = 0;
+ this->rep_[this->len_] = '\0';
}
// Default constructor.
@@ -319,7 +320,7 @@ ACE_SString::ACE_SString (const char *s,
{
this->len_ = len;
this->rep_ = (char *) this->allocator_->malloc (this->len_ + 1);
- ACE_OS::strncpy (this->rep_, s, len);
+ ACE_OS::memcpy (this->rep_, s, len);
this->rep_[len] = '\0'; // Make sure to NUL terminate this!
}
}