diff options
Diffstat (limited to 'ace/Message_Block.cpp')
-rw-r--r-- | ace/Message_Block.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index 96e94d460ae..5c0947f806a 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -28,6 +28,24 @@ ACE_Message_Block::copy (const char *buf, size_t n) } } +int +ACE_Message_Block::copy (const char *buf) +{ + ACE_TRACE ("ACE_Message_Block::copy"); + // Note that for this to work correct, end() *must* be >= wr_ptr(). + size_t len = size_t (this->end () - this->wr_ptr ()); + size_t buflen = ACE_OS::strlen (buf) + 1; + + if (len < buflen) + return -1; + else + { + (void) ACE_OS::memcpy (this->wr_ptr (), buf, buflen); + this->wr_ptr (buflen); + return 0; + } +} + void ACE_Message_Block::dump (void) const { |