diff options
author | Steve Huston <shuston@riverace.com> | 2012-05-16 17:45:58 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2012-05-16 17:45:58 +0000 |
commit | 73ef3cd622e026b83c2ee196c61f951145e64614 (patch) | |
tree | b8f7de36e3623aa5bec28e2ba5f5d00223810014 | |
parent | b8665dd392b9b3caf752028667b6d9015605ff00 (diff) | |
download | ATCD-73ef3cd622e026b83c2ee196c61f951145e64614.tar.gz |
ChangeLogTag:Wed May 16 17:41:21 UTC 2012 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ACE/ChangeLog | 7 | ||||
-rw-r--r-- | ACE/ace/OS_NS_Thread.cpp | 27 |
2 files changed, 16 insertions, 18 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 5403d3de22f..8cf3883e809 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,10 @@ +Wed May 16 17:41:21 UTC 2012 Steve Huston <shuston@riverace.com> + + * ace/OS_NS_Thread.cpp (ACE_Thread_ID::to_string): Use string literals + for the sprintf formats rather than build them up. Things have + simplified to the point we don't need that any longer. Thanks to + Rick Ohnemus for providing the patch. Fixes Bugzilla #4021. + Wed May 16 06:44:23 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> * tests/run_test.lst: diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp index 540c738ccd7..bce737c1914 100644 --- a/ACE/ace/OS_NS_Thread.cpp +++ b/ACE/ace/OS_NS_Thread.cpp @@ -50,27 +50,18 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Thread_ID::to_string (char *thr_string) const { - char format[128]; // Converted format string - char *fp = 0; // Current format pointer - fp = format; - *fp++ = '%'; // Copy in the % - #if defined (ACE_WIN32) - ACE_OS::strcpy (fp, "u"); - ACE_OS::sprintf (thr_string, - format, + ACE_OS::sprintf (thr_string, "%u", static_cast <unsigned> (this->thread_id_)); #else - // Yes, this is an ugly C-style cast, but the - // correct C++ cast is different depending on - // whether the t_id is an integral type or a pointer - // type. FreeBSD uses a pointer type, but doesn't - // have a _np function to get an integral type, like - // the OSes above. - ACE_OS::strcpy (fp, "lu"); - ACE_OS::sprintf (thr_string, - format, - (unsigned long) thread_handle_); + // Yes, this is an ugly C-style cast, but the + // correct C++ cast is different depending on + // whether the t_id is an integral type or a pointer + // type. FreeBSD uses a pointer type, but doesn't + // have a _np function to get an integral type like + // other OSes, so use the bigger hammer. + ACE_OS::sprintf (thr_string, "%lu", + (unsigned long) thread_handle_); #endif /* ACE_WIN32 */ } |