summaryrefslogtreecommitdiff
path: root/grpc
diff options
context:
space:
mode:
authorFrank Benkstein <frank@benkstein.net>2018-10-16 00:11:31 +0200
committerWouter van Oortmerssen <aardappel@gmail.com>2018-10-15 15:11:31 -0700
commit20396a1760dc7d847a84f153ecde73fde9d70388 (patch)
tree78493cdae6e46eaad523a705c6cb34811473e6f1 /grpc
parenta3d8391f7be8c29660f77953f2fea11c76864408 (diff)
downloadflatbuffers-20396a1760dc7d847a84f153ecde73fde9d70388.tar.gz
flatbuffers-20396a1760dc7d847a84f153ecde73fde9d70388.tar.bz2
flatbuffers-20396a1760dc7d847a84f153ecde73fde9d70388.zip
disallow c style casts (#4981)
Fixes #4857.
Diffstat (limited to 'grpc')
-rw-r--r--grpc/src/compiler/java_generator.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/grpc/src/compiler/java_generator.cc b/grpc/src/compiler/java_generator.cc
index 93d3108f..fd9cc28b 100644
--- a/grpc/src/compiler/java_generator.cc
+++ b/grpc/src/compiler/java_generator.cc
@@ -72,13 +72,14 @@ void GenerateImports(grpc_generator::File* file,
// - remove embedded underscores & capitalize the following letter
static string MixedLower(const string& word) {
string w;
- w += (string::value_type)tolower(word[0]);
+ w += static_cast<string::value_type>(tolower(word[0]));
bool after_underscore = false;
for (size_t i = 1; i < word.length(); ++i) {
if (word[i] == '_') {
after_underscore = true;
} else {
- w += after_underscore ? (string::value_type)toupper(word[i]) : word[i];
+ w += after_underscore ? static_cast<string::value_type>(toupper(word[i]))
+ : word[i];
after_underscore = false;
}
}
@@ -92,7 +93,7 @@ static string MixedLower(const string& word) {
static string ToAllUpperCase(const string& word) {
string w;
for (size_t i = 0; i < word.length(); ++i) {
- w += (string::value_type)toupper(word[i]);
+ w += static_cast<string::value_type>(toupper(word[i]));
if ((i < word.length() - 1) && islower(word[i]) && isupper(word[i + 1])) {
w += '_';
}
@@ -345,8 +346,8 @@ static void PrintMethodFields(Printer* p, VARS& vars,
for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
- vars["arg_in_id"] = to_string((long)2 * i); //trying to make msvc 10 happy
- vars["arg_out_id"] = to_string((long)2 * i + 1);
+ vars["arg_in_id"] = to_string(2L * i); //trying to make msvc 10 happy
+ vars["arg_out_id"] = to_string(2L * i + 1);
vars["method_name"] = method->name();
vars["input_type_name"] = method->get_input_type_name();
vars["output_type_name"] = method->get_output_type_name();