Resolved some VC++ Level 5 warnings
git-svn-id: http://svn.code.sf.net/p/utfcpp/code@56 a809a056-fc17-0410-9590-b4f493f8b08e
This commit is contained in:
parent
1d0a0435be
commit
dab1a9da5a
3 changed files with 14 additions and 10 deletions
|
@ -14,4 +14,8 @@ struct timer {
|
|||
std::clock_t start;
|
||||
std::clock_t end;
|
||||
std::ostream& report;
|
||||
|
||||
private:
|
||||
// just to surpress a VC++ 8.0 warning
|
||||
timer& operator = (const timer&) {};
|
||||
};
|
||||
|
|
|
@ -35,7 +35,7 @@ int main(int argc, char** argv)
|
|||
// the UTF-16 result will not be larger than this (I hope :) )
|
||||
vector<wchar_t> temputf16;
|
||||
utf8::utf8to16(buf, buf + length, back_inserter(temputf16));
|
||||
int wlength = temputf16.size();
|
||||
vector<wchar_t>::size_type wlength = temputf16.size();
|
||||
wchar_t* utf16buf = new wchar_t[wlength];
|
||||
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ int main(int argc, char** argv)
|
|||
|
||||
{
|
||||
timer t(cout);
|
||||
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, buf, length, utf16iconvbuf, wlength);
|
||||
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, buf, length, utf16iconvbuf, int(wlength));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ int main(int argc, char** argv)
|
|||
|
||||
{
|
||||
timer t(cout);
|
||||
WideCharToMultiByte(CP_UTF8, 0, utf16buf, wlength, buf, length, NULL, NULL);
|
||||
WideCharToMultiByte(CP_UTF8, 0, utf16buf, int(wlength), buf, length, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ int main(int argc, char** argv)
|
|||
string::iterator line_end = line.end();
|
||||
line_end = find_invalid(line_start, line_end);
|
||||
if (line_end != line.end())
|
||||
cout << "Line " << line_count << ": Invalid utf-8 at byte " << line.end() - line_end << '\n';
|
||||
cout << "Line " << line_count << ": Invalid utf-8 at byte " << int(line.end() - line_end) << '\n';
|
||||
|
||||
// Convert it to utf-16 and write to the file
|
||||
vector<unsigned short> utf16_line;
|
||||
|
@ -59,7 +59,7 @@ int main(int argc, char** argv)
|
|||
unsigned char_count = 0;
|
||||
string::iterator it = line_start;
|
||||
while (it != line_end) {
|
||||
unsigned cp = next(it, line_end);
|
||||
next(it, line_end);
|
||||
char_count++;
|
||||
}
|
||||
if (char_count != utf32_line.size())
|
||||
|
@ -70,11 +70,11 @@ int main(int argc, char** argv)
|
|||
if (adv_it != line_end)
|
||||
cout << "Line " << line_count << ": Error in advance function" << '\n';
|
||||
|
||||
if (utf8::distance(line_start, line_end) != char_count)
|
||||
if (string::size_type(utf8::distance(line_start, line_end)) != char_count)
|
||||
cout << "Line " << line_count << ": Error in distance function" << '\n';
|
||||
|
||||
while (it != line_start) {
|
||||
unsigned cp = previous(it, line.rend().base());
|
||||
previous(it, line.rend().base());
|
||||
char_count--;
|
||||
}
|
||||
if (char_count != 0)
|
||||
|
@ -109,7 +109,7 @@ int main(int argc, char** argv)
|
|||
char_count = 0;
|
||||
it = line_start;
|
||||
while (it != line_end) {
|
||||
unsigned cp = unchecked::next(it);
|
||||
unchecked::next(it);
|
||||
char_count++;
|
||||
}
|
||||
if (char_count != utf32_line.size())
|
||||
|
@ -120,11 +120,11 @@ int main(int argc, char** argv)
|
|||
if (adv_it != line_end)
|
||||
cout << "Line " << line_count << ": Error in unchecked::advance function" << '\n';
|
||||
|
||||
if (utf8::unchecked::distance(line_start, line_end) != char_count)
|
||||
if (string::size_type(utf8::unchecked::distance(line_start, line_end)) != char_count)
|
||||
cout << "Line " << line_count << ": Error in unchecked::distance function" << '\n';
|
||||
|
||||
while (it != line_start) {
|
||||
unsigned cp = unchecked::previous(it);
|
||||
unchecked::previous(it);
|
||||
char_count--;
|
||||
}
|
||||
if (char_count != 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue