null+****@clear*****
null+****@clear*****
2012年 1月 11日 (水) 14:17:29 JST
Susumu Yata 2012-01-11 14:17:29 +0900 (Wed, 11 Jan 2012)
New Revision: 9d23f98b1c74f5ccf130c34d15ec8ec6494273ae
Log:
removed an unsafe-cast.
Modified files:
lib/dat/key.hpp
Modified: lib/dat/key.hpp (+6 -4)
===================================================================
--- lib/dat/key.hpp 2012-01-11 14:17:00 +0900 (f1c1aa0)
+++ lib/dat/key.hpp 2012-01-11 14:17:29 +0900 (e46ad86)
@@ -86,8 +86,10 @@ class Key {
// Returns a reference to an invalid key.
static const Key &invalid_key() {
- static const UInt32 invalid_key_buf[2] = { INVALID_KEY_ID << 4, 0 };
- return *reinterpret_cast<const Key *>(invalid_key_buf);
+ static const Key invalid_key;
+ return invalid_key;
+// static const UInt32 invalid_key_buf[2] = { INVALID_KEY_ID << 4, 0 };
+// return *reinterpret_cast<const Key *>(invalid_key_buf);
}
private:
@@ -96,8 +98,8 @@ class Key {
const UInt8 buf_[3];
// Disallows instantiation.
- Key();
- ~Key();
+ Key() : id_and_length_low_(INVALID_KEY_ID << 4), length_high_(0), buf_() {}
+ ~Key() {}
// Disallows copy and assignment.
Key(const Key &);