diff options
Diffstat (limited to 'ipc/ipc_message_utils.cc')
-rw-r--r-- | ipc/ipc_message_utils.cc | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc index 8bf7609..2acddce 100644 --- a/ipc/ipc_message_utils.cc +++ b/ipc/ipc_message_utils.cc @@ -253,6 +253,40 @@ void ParamTraits<bool>::Log(const param_type& p, std::string* l) { l->append(p ? "true" : "false"); } +void ParamTraits<unsigned char>::Write(Message* m, const param_type& p) { + m->WriteBytes(&p, sizeof(param_type)); +} + +bool ParamTraits<unsigned char>::Read(const Message* m, PickleIterator* iter, + param_type* r) { + const char* data; + if (!m->ReadBytes(iter, &data, sizeof(param_type))) + return false; + memcpy(r, data, sizeof(param_type)); + return true; +} + +void ParamTraits<unsigned char>::Log(const param_type& p, std::string* l) { + l->append(base::UintToString(p)); +} + +void ParamTraits<unsigned short>::Write(Message* m, const param_type& p) { + m->WriteBytes(&p, sizeof(param_type)); +} + +bool ParamTraits<unsigned short>::Read(const Message* m, PickleIterator* iter, + param_type* r) { + const char* data; + if (!m->ReadBytes(iter, &data, sizeof(param_type))) + return false; + memcpy(r, data, sizeof(param_type)); + return true; +} + +void ParamTraits<unsigned short>::Log(const param_type& p, std::string* l) { + l->append(base::UintToString(p)); +} + void ParamTraits<int>::Log(const param_type& p, std::string* l) { l->append(base::IntToString(p)); } @@ -277,23 +311,6 @@ void ParamTraits<unsigned long long>::Log(const param_type& p, std::string* l) { l->append(base::Uint64ToString(p)); } -void ParamTraits<unsigned short>::Write(Message* m, const param_type& p) { - m->WriteBytes(&p, sizeof(param_type)); -} - -bool ParamTraits<unsigned short>::Read(const Message* m, PickleIterator* iter, - param_type* r) { - const char* data; - if (!m->ReadBytes(iter, &data, sizeof(param_type))) - return false; - memcpy(r, data, sizeof(param_type)); - return true; -} - -void ParamTraits<unsigned short>::Log(const param_type& p, std::string* l) { - l->append(base::UintToString(p)); -} - void ParamTraits<float>::Write(Message* m, const param_type& p) { m->WriteData(reinterpret_cast<const char*>(&p), sizeof(param_type)); } |