Do not use C-style casts.

GitOrigin-RevId: 6187bc8f4837fd40aba7ef613e09ecb93e3cf951
This commit is contained in:
levlam 2020-06-14 05:27:49 +03:00
parent 18b8e87e74
commit 480f826d16
2 changed files with 7 additions and 7 deletions

View File

@ -82,13 +82,13 @@ class TlWriterDotNet : public TL_writer {
static std::string to_cCamelCase(const std::string &name, bool flag) { static std::string to_cCamelCase(const std::string &name, bool flag) {
bool next_to_upper = flag; bool next_to_upper = flag;
std::string result; std::string result;
for (int i = 0; i < (int)name.size(); i++) { for (std::size_t i = 0; i < name.size(); i++) {
if (!is_alnum(name[i])) { if (!is_alnum(name[i])) {
next_to_upper = true; next_to_upper = true;
continue; continue;
} }
if (next_to_upper) { if (next_to_upper) {
result += (char)to_upper(name[i]); result += to_upper(name[i]);
next_to_upper = false; next_to_upper = false;
} else { } else {
result += name[i]; result += name[i];
@ -98,7 +98,7 @@ class TlWriterDotNet : public TL_writer {
} }
std::string gen_native_field_name(std::string name) const { std::string gen_native_field_name(std::string name) const {
for (int i = 0; i < (int)name.size(); i++) { for (std::size_t i = 0; i < name.size(); i++) {
if (!is_alnum(name[i])) { if (!is_alnum(name[i])) {
name[i] = '_'; name[i] = '_';
} }
@ -115,7 +115,7 @@ class TlWriterDotNet : public TL_writer {
if (name == "#") { if (name == "#") {
return "int32_t"; return "int32_t";
} }
for (int i = 0; i < (int)name.size(); i++) { for (std::size_t i = 0; i < name.size(); i++) {
if (!is_alnum(name[i])) { if (!is_alnum(name[i])) {
name[i] = '_'; name[i] = '_';
} }
@ -163,7 +163,7 @@ class TlWriterDotNet : public TL_writer {
if (name == "Vector") { if (name == "Vector") {
assert(t->arity == 1); assert(t->arity == 1);
assert((int)tree_type->children.size() == 1); assert(tree_type->children.size() == 1);
assert(tree_type->children[0]->get_type() == NODE_TYPE_TYPE); assert(tree_type->children[0]->get_type() == NODE_TYPE_TYPE);
const tl_tree_type *child = static_cast<const tl_tree_type *>(tree_type->children[0]); const tl_tree_type *child = static_cast<const tl_tree_type *>(tree_type->children[0]);
@ -172,7 +172,7 @@ class TlWriterDotNet : public TL_writer {
assert(!is_built_in_simple_type(name) && !is_built_in_complex_type(name)); assert(!is_built_in_simple_type(name) && !is_built_in_complex_type(name));
for (int i = 0; i < (int)tree_type->children.size(); i++) { for (std::size_t i = 0; i < tree_type->children.size(); i++) {
assert(tree_type->children[i]->get_type() == NODE_TYPE_NAT_CONST); assert(tree_type->children[i]->get_type() == NODE_TYPE_NAT_CONST);
} }

View File

@ -467,7 +467,7 @@ TEST(MessageEntities, url) {
check_url("@.", {}); check_url("@.", {});
check_url( check_url(
"a.b.google.com dfsknnfs gsdfgsg http://códuia.de/ dffdg,\" 12)(cpia.de/())(\" http://гришка.рф/ sdufhdf " "a.b.google.com dfsknnfs gsdfgsg http://códuia.de/ dffdg,\" 12)(cpia.de/())(\" http://гришка.рф/ sdufhdf "
"http://xn--80afpi2a3c.xn--p1ai/ I have a good time.Thanks, guys!\n\n(hdfughidufhgdis)go#ogle.com гришка.рф " "http://xn--80afpi2a3c.xn--p1ai/ I have a good time.Thanks, guys!\n\n(hdfughidufhgdis) go#ogle.com гришка.рф "
"hsighsdf gi почта.рф\n\n✪df.ws/123 " "hsighsdf gi почта.рф\n\n✪df.ws/123 "
"xn--80afpi2a3c.xn--p1ai\n\nhttp://foo.com/blah_blah\nhttp://foo.com/blah_blah/\n(Something like " "xn--80afpi2a3c.xn--p1ai\n\nhttp://foo.com/blah_blah\nhttp://foo.com/blah_blah/\n(Something like "
"http://foo.com/blah_blah)\nhttp://foo.com/blah_blah_(wikipedi8989a_Вася)\n(Something like " "http://foo.com/blah_blah)\nhttp://foo.com/blah_blah_(wikipedi8989a_Вася)\n(Something like "