summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_utils.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-08-11 19:45:13 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-08-11 19:45:13 +0000
commit41ec75629ab19e84dd25a168797afe5fe8c01594 (patch)
tree688a9f1cb8df882de08c3a199aa1bdaf467b2b8b /protocols/Tox/src/tox_utils.cpp
parent9f7023fdefc4bbdc888c8bb208bc79bbaa8df225 (diff)
Tox: some of message sending
git-svn-id: http://svn.miranda-ng.org/main/trunk@10158 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_utils.cpp')
-rw-r--r--protocols/Tox/src/tox_utils.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp
index 456b1dd75a..b8eed67c68 100644
--- a/protocols/Tox/src/tox_utils.cpp
+++ b/protocols/Tox/src/tox_utils.cpp
@@ -21,7 +21,7 @@ TOX_USERSTATUS CToxProto::MirandaToToxStatus(int status)
return userstatus;
}
-std::vector<uint8_t> HexStringToData(const std::string hex)
+std::vector<uint8_t> CToxProto::HexStringToData(std::string hex)
{
std::stringstream ss;
std::vector<uint8_t> data;
@@ -29,16 +29,16 @@ std::vector<uint8_t> HexStringToData(const std::string hex)
size_t count = hex.length() / 2;
for (size_t i = 0; i < count; i++)
{
- uint8_t temp;
- ss << std::hex << hex.substr(i * 2, 2);
- ss >> temp;
- data.push_back(temp);
+ unsigned byte;
+ std::istringstream hex_byte(hex.substr(i * 2, 2));
+ hex_byte >> std::hex >> byte;
+ data.push_back(static_cast<unsigned char>(byte));
}
return data;
}
-std::string CToxProto::DataToHexString(const std::vector<uint8_t> data)
+std::string CToxProto::DataToHexString(std::vector<uint8_t> data)
{
std::stringstream ss;
ss << std::hex << std::uppercase;