From a2e3d77c3aa849f3dd29be0ef114f9ea7e126146 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Feb 2016 09:37:04 +0000 Subject: unified project for WhatsApp git-svn-id: http://svn.miranda-ng.org/main/trunk@16249 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/WhatsAPI++/utilities.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'protocols/WhatsApp/src/WhatsAPI++/utilities.cpp') diff --git a/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp b/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp index bbffd4712a..9c56a0c7dd 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp @@ -1,4 +1,4 @@ -#include "../common.h" // #TODO Remove Miranda-dependency +#include "../stdafx.h" // #TODO Remove Miranda-dependency #include "utilities.h" #include "WAException.h" @@ -166,7 +166,6 @@ string bytesToHex(unsigned char* bytes, int length) { string ret(length * 2, ' '); string::iterator p = ret.begin(); - int i = 0; for (int c = 0; c < length; c++) { int ub = bytes[c]; *p++ = forDigit(ub >> 4); @@ -283,11 +282,9 @@ bool saveChallengeData(const std::vector& data, const std::string std::string utf8_to_utf16(const std::string &utf8) { std::vector unicode; - size_t i = 0; - while (i < utf8.size()) { + for (size_t i = 0; i < utf8.size();) { unsigned long uni; size_t todo; - bool error = false; unsigned char ch = utf8[i++]; if (ch <= 0x7F) { uni = ch; @@ -314,7 +311,7 @@ std::string utf8_to_utf16(const std::string &utf8) for (size_t j = 0; j < todo; ++j) { if (i == utf8.size()) throw std::logic_error("not a UTF-8 string"); - unsigned char ch = utf8[i++]; + ch = utf8[i++]; if (ch < 0x80 || ch > 0xBF) throw std::logic_error("not a UTF-8 string"); uni <<= 6; -- cgit v1.2.3