From 480f826d1654543f82f084a7a857c9a938e273b9 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 14 Jun 2020 05:27:49 +0300 Subject: [PATCH] Do not use C-style casts. GitOrigin-RevId: 6187bc8f4837fd40aba7ef613e09ecb93e3cf951 --- td/generate/tl_writer_dotnet.h | 12 ++++++------ test/message_entities.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/td/generate/tl_writer_dotnet.h b/td/generate/tl_writer_dotnet.h index 012958054..d3ac7aa3a 100644 --- a/td/generate/tl_writer_dotnet.h +++ b/td/generate/tl_writer_dotnet.h @@ -82,13 +82,13 @@ class TlWriterDotNet : public TL_writer { static std::string to_cCamelCase(const std::string &name, bool flag) { bool next_to_upper = flag; 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])) { next_to_upper = true; continue; } if (next_to_upper) { - result += (char)to_upper(name[i]); + result += to_upper(name[i]); next_to_upper = false; } else { result += name[i]; @@ -98,7 +98,7 @@ class TlWriterDotNet : public TL_writer { } 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])) { name[i] = '_'; } @@ -115,7 +115,7 @@ class TlWriterDotNet : public TL_writer { if (name == "#") { 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])) { name[i] = '_'; } @@ -163,7 +163,7 @@ class TlWriterDotNet : public TL_writer { if (name == "Vector") { 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); const tl_tree_type *child = static_cast(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)); - 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); } diff --git a/test/message_entities.cpp b/test/message_entities.cpp index e32ee0f83..ec72cfcc3 100644 --- a/test/message_entities.cpp +++ b/test/message_entities.cpp @@ -467,7 +467,7 @@ TEST(MessageEntities, url) { check_url("@.", {}); check_url( "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 " "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 "