[complement-svn] SF.net SVN: complement: [1944] trunk/complement/explore/lib/mt
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2008-07-07 10:31:05
|
Revision: 1944 http://complement.svn.sourceforge.net/complement/?rev=1944&view=rev Author: complement Date: 2008-07-07 03:30:59 -0700 (Mon, 07 Jul 2008) Log Message: ----------- fixed bad conversion from string to binary for all uids; libxmt 2.0.7 Modified Paths: -------------- trunk/complement/explore/lib/mt/ChangeLog trunk/complement/explore/lib/mt/Makefile.inc trunk/complement/explore/lib/mt/uid.cc trunk/complement/explore/lib/mt/ut/mt_test_suite.cc trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc trunk/complement/explore/lib/mt/ut/mt_test_wg21.h Modified: trunk/complement/explore/lib/mt/ChangeLog =================================================================== --- trunk/complement/explore/lib/mt/ChangeLog 2008-07-07 06:39:32 UTC (rev 1943) +++ trunk/complement/explore/lib/mt/ChangeLog 2008-07-07 10:30:59 UTC (rev 1944) @@ -3,8 +3,13 @@ * uid.cc, uid.h: convert uid to string; output uid to ostream; - * libxmt: bump revision to 2.0.6. + * libxmt: bump revision to 2.0.6; + * uid.cc: fixed bad conversion from string form to binary + for all uids; + + * libxmt: bump revision to 2.0.7. + 2008-07-02 Petr Ovtchenkov <pt...@is...> * uid.cc: fix wrong type cast; Modified: trunk/complement/explore/lib/mt/Makefile.inc =================================================================== --- trunk/complement/explore/lib/mt/Makefile.inc 2008-07-07 06:39:32 UTC (rev 1943) +++ trunk/complement/explore/lib/mt/Makefile.inc 2008-07-07 10:30:59 UTC (rev 1944) @@ -3,7 +3,7 @@ LIBNAME = xmt MAJOR = 2 MINOR = 0 -PATCH = 6 +PATCH = 7 SRC_CC = xmt.cc thr_mgr.cc time.cc uid.cc shm.cc callstack.cc system_error.cc thread.cc \ date_time.cc SRC_C = fl.c Modified: trunk/complement/explore/lib/mt/uid.cc =================================================================== --- trunk/complement/explore/lib/mt/uid.cc 2008-07-07 06:39:32 UTC (rev 1943) +++ trunk/complement/explore/lib/mt/uid.cc 2008-07-07 10:30:59 UTC (rev 1944) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/07/07 04:14:12 ptr> +// -*- C++ -*- Time-stamp: <08/07/07 14:19:23 yeti> /* * Copyright (c) 2006, 2008 @@ -25,13 +25,22 @@ { std::ios_base::fmtflags f = s.flags( 0 ); s << hex << setfill('0') - << setw(2) << uid.u.b[0] << setw(2) << uid.u.b[1] << setw(2) << uid.u.b[2] << setw(2) << uid.u.b[3] << '-' - << setw(2) << uid.u.b[4] << setw(2) << uid.u.b[5] << '-' - << setw(2) << uid.u.b[6] << setw(2) << uid.u.b[7] << '-' - << setw(2) << uid.u.b[8] << setw(2) << uid.u.b[9] << '-' - << setw(2) << uid.u.b[10] << setw(2) << uid.u.b[11] - << setw(2) << uid.u.b[12] << setw(2) << uid.u.b[13] - << setw(2) << uid.u.b[14] << setw(2) << uid.u.b[15]; + << setw(2) << static_cast<unsigned>(uid.u.b[0]) + << setw(2) << static_cast<unsigned>(uid.u.b[1]) + << setw(2) << static_cast<unsigned>(uid.u.b[2]) + << setw(2) << static_cast<unsigned>(uid.u.b[3]) << '-' + << setw(2) << static_cast<unsigned>(uid.u.b[4]) + << setw(2) << static_cast<unsigned>(uid.u.b[5]) << '-' + << setw(2) << static_cast<unsigned>(uid.u.b[6]) + << setw(2) << static_cast<unsigned>(uid.u.b[7]) << '-' + << setw(2) << static_cast<unsigned>(uid.u.b[8]) + << setw(2) << static_cast<unsigned>(uid.u.b[9]) << '-' + << setw(2) << static_cast<unsigned>(uid.u.b[10]) + << setw(2) << static_cast<unsigned>(uid.u.b[11]) + << setw(2) << static_cast<unsigned>(uid.u.b[12]) + << setw(2) << static_cast<unsigned>(uid.u.b[13]) + << setw(2) << static_cast<unsigned>(uid.u.b[14]) + << setw(2) << static_cast<unsigned>(uid.u.b[15]); s.flags( f ); return s; @@ -89,12 +98,30 @@ << _host_id_str[30] << _host_id_str[31] << ' ' << _host_id_str[32] << _host_id_str[33] << ' ' << _host_id_str[34] << _host_id_str[35]; - - s >> hex - >> _host_id.u.b[0] >> _host_id.u.b[1] >> _host_id.u.b[2] >> _host_id.u.b[3] - >> _host_id.u.b[4] >> _host_id.u.b[5] >> _host_id.u.b[6] >> _host_id.u.b[7] - >> _host_id.u.b[8] >> _host_id.u.b[9] >> _host_id.u.b[10] >> _host_id.u.b[11] - >> _host_id.u.b[12] >> _host_id.u.b[13] >> _host_id.u.b[14] >> _host_id.u.b[15]; + + s >> hex; + + unsigned v[16]; + + s >> v[0] >> v[1] >> v[2] >> v[3] >> v[4] >> v[5] >> v[6] >> v[7] + >> v[8] >> v[9] >> v[10] >> v[11] >> v[12] >> v[13] >> v[14] >> v[15]; + + _host_id.u.b[0] = v[0]; + _host_id.u.b[1] = v[1]; + _host_id.u.b[2] = v[2]; + _host_id.u.b[3] = v[3]; + _host_id.u.b[4] = v[4]; + _host_id.u.b[5] = v[5]; + _host_id.u.b[6] = v[6]; + _host_id.u.b[7] = v[7]; + _host_id.u.b[8] = v[8]; + _host_id.u.b[9] = v[9]; + _host_id.u.b[10] = v[10]; + _host_id.u.b[11] = v[11]; + _host_id.u.b[12] = v[12]; + _host_id.u.b[13] = v[13]; + _host_id.u.b[14] = v[14]; + _host_id.u.b[15] = v[15]; } } @@ -167,12 +194,30 @@ << tmp[32] << tmp[33] << ' ' << tmp[34] << tmp[35]; - s >> hex - >> id.u.b[0] >> id.u.b[1] >> id.u.b[2] >> id.u.b[3] - >> id.u.b[4] >> id.u.b[5] >> id.u.b[6] >> id.u.b[7] - >> id.u.b[8] >> id.u.b[9] >> id.u.b[10] >> id.u.b[11] - >> id.u.b[12] >> id.u.b[13] >> id.u.b[14] >> id.u.b[15]; + s >> hex; + unsigned v[16]; + + s >> v[0] >> v[1] >> v[2] >> v[3] >> v[4] >> v[5] >> v[6] >> v[7] + >> v[8] >> v[9] >> v[10] >> v[11] >> v[12] >> v[13] >> v[14] >> v[15]; + + id.u.b[0] = v[0]; + id.u.b[1] = v[1]; + id.u.b[2] = v[2]; + id.u.b[3] = v[3]; + id.u.b[4] = v[4]; + id.u.b[5] = v[5]; + id.u.b[6] = v[6]; + id.u.b[7] = v[7]; + id.u.b[8] = v[8]; + id.u.b[9] = v[9]; + id.u.b[10] = v[10]; + id.u.b[11] = v[11]; + id.u.b[12] = v[12]; + id.u.b[13] = v[13]; + id.u.b[14] = v[14]; + id.u.b[15] = v[15]; + return id; } Modified: trunk/complement/explore/lib/mt/ut/mt_test_suite.cc =================================================================== --- trunk/complement/explore/lib/mt/ut/mt_test_suite.cc 2008-07-07 06:39:32 UTC (rev 1943) +++ trunk/complement/explore/lib/mt/ut/mt_test_suite.cc 2008-07-07 10:30:59 UTC (rev 1944) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/07/02 13:01:53 yeti> +// -*- C++ -*- Time-stamp: <08/07/07 13:15:01 yeti> /* * Copyright (c) 2006-2008 @@ -83,8 +83,9 @@ t.add( &uid_test_wg21::uid, test_wg21_uid, "uid_test_wg21::uid", t.add( &uid_test_wg21::uidstr, test_wg21_uid, "uid_test_wg21::uidstr" ) ); - t.add( &uid_test_wg21::hostid, test_wg21_uid, "uid_test_wg21::hostid", - t.add( &uid_test_wg21::hostidstr, test_wg21_uid, "uid_test_wg21::hostidstr" ) ); + t.add( &uid_test_wg21::uidconv, test_wg21_uid, "uid_test_wg21::uidconv", + t.add( &uid_test_wg21::hostid, test_wg21_uid, "uid_test_wg21::hostid", + t.add( &uid_test_wg21::hostidstr, test_wg21_uid, "uid_test_wg21::hostidstr" ) ) ); Opts opts; Modified: trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc =================================================================== --- trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc 2008-07-07 06:39:32 UTC (rev 1943) +++ trunk/complement/explore/lib/mt/ut/mt_test_wg21.cc 2008-07-07 10:30:59 UTC (rev 1944) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/07/02 13:00:38 yeti> +// -*- C++ -*- Time-stamp: <08/07/07 14:23:07 yeti> /* * Copyright (c) 2006-2008 @@ -18,6 +18,7 @@ #include <typeinfo> #include <iostream> +#include <sstream> #include <sys/wait.h> #include <sys/ipc.h> @@ -385,3 +386,19 @@ return EXAM_RESULT; } + +int EXAM_IMPL(uid_test_wg21::uidconv) +{ + xmt::uuid_type u1 = xmt::hostid(); + std::string u2 = xmt::hostid_str(); + + EXAM_CHECK( static_cast<std::string>(u1) == u2 ); // <-- conversion to string + + std::stringstream s; + + s << u1; + + EXAM_CHECK( s.str() == u2 ); + + return EXAM_RESULT; +} Modified: trunk/complement/explore/lib/mt/ut/mt_test_wg21.h =================================================================== --- trunk/complement/explore/lib/mt/ut/mt_test_wg21.h 2008-07-07 06:39:32 UTC (rev 1943) +++ trunk/complement/explore/lib/mt/ut/mt_test_wg21.h 2008-07-07 10:30:59 UTC (rev 1944) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/07/02 12:59:27 yeti> +// -*- C++ -*- Time-stamp: <08/07/07 13:10:54 yeti> /* * Copyright (c) 2006-2008 @@ -37,6 +37,7 @@ int EXAM_DECL(uid); int EXAM_DECL(hostidstr); int EXAM_DECL(hostid); + int EXAM_DECL(uidconv); }; #endif // __MT_TEST_WG21_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |