diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-06-20 22:09:45 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-06-20 22:09:45 +0000 |
commit | c208ad14a60782519249885d119b32f86b23e7e8 (patch) | |
tree | 8cef7059f4429c90135be5d9bce583def1e6af9d /ace/FILE_Addr.cpp | |
parent | 6075e632c4ddbd1d02276ce73ad806713621c61b (diff) | |
download | ATCD-c208ad14a60782519249885d119b32f86b23e7e8.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace/FILE_Addr.cpp')
-rw-r--r-- | ace/FILE_Addr.cpp | 62 |
1 files changed, 26 insertions, 36 deletions
diff --git a/ace/FILE_Addr.cpp b/ace/FILE_Addr.cpp index 108b8c99f0e..3c367d8b180 100644 --- a/ace/FILE_Addr.cpp +++ b/ace/FILE_Addr.cpp @@ -12,9 +12,7 @@ ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Addr) ACE_FILE_Addr::ACE_FILE_Addr (void) : ACE_Addr (AF_FILE, sizeof this->filename_) { - (void) ACE_OS::memset ((void *) &this->filename_, - 0, - sizeof this->filename_); + this->filename_[0] = '\0'; } int @@ -23,13 +21,11 @@ ACE_FILE_Addr::set (const ACE_FILE_Addr &sa) this->base_set (sa.get_type (), sa.get_size ()); if (sa.get_type () == AF_ANY) - (void) ACE_OS::memset ((void *) &this->filename_, - 0, - sizeof this->filename_); + this->filename_[0] = '\0'; else - (void) ACE_OS::memcpy ((void *) &this->filename_, - (void *) &sa.filename_, - sa.get_size ()); + (void) ACE_OS::strncpy ((void *) &this->filename_, + (void *) &sa.filename_, + sa.get_size ()); return 0; } @@ -40,30 +36,24 @@ ACE_FILE_Addr::ACE_FILE_Addr (const ACE_FILE_Addr &sa) this->set (sa); } +void +ACE_FILE_Addr::set (LPCTSTR filename) +{ + this->ACE_Addr::base_set (AF_FILE, + ACE_OS::strlen (filename) + 1); + (void) ACE_OS::strncpy (this->filename_, + filename, + sa.get_size ()); +} + ACE_FILE_Addr & ACE_FILE_Addr::operator= (const ACE_FILE_Addr &sa) { if (this != &sa) - { - size_t size = sa.get_size (); - (void) ACE_OS::memcpy ((void *) &this->filename_, - (void *) &sa.filename_, - size); - if (size < MAXNAMLEN + 1) - this->filename_[size] = '\0'; - } + this->set (sa); return *this; } -void -ACE_FILE_Addr::set (LPCTSTR filename) -{ - this->ACE_Addr::base_set (AF_FILE, - ACE_OS::strlen (filename) ); - (void) ACE_OS::strcpy (this->filename_, - filename); -} - // Create a ACE_Addr from a ACE_FILE pathname. ACE_FILE_Addr::ACE_FILE_Addr (LPCTSTR filename) @@ -71,25 +61,25 @@ ACE_FILE_Addr::ACE_FILE_Addr (LPCTSTR filename) this->set (filename); } -// Transform the current address into string format. - -#if defined (UNICODE) int -ACE_FILE_Addr::addr_to_string (wchar_t * s, size_t len) const +ACE_FILE_Addr::addr_to_string (char *s, size_t len) const { - ACE_OS::strncpy (s, this->filename_, len); + ACE_OS::strncpy (s, + ACE_MULTIBYTE_STRING (this->filename_), + len); return 0; } -#endif /* UNICODE */ + +#if defined (UNICODE) +// Transform the current address into string format. int -ACE_FILE_Addr::addr_to_string (char *s, size_t len) const +ACE_FILE_Addr::addr_to_string (wchar_t * s, size_t len) const { - ACE_OS::strncpy (s, - ACE_MULTIBYTE_STRING (this->filename_), - len); + ACE_OS::strncpy (s, this->filename_, len); return 0; } +#endif /* UNICODE */ void ACE_FILE_Addr::dump (void) const |