Commit b04736f9 authored by aardappel's avatar aardappel

Fixed warnings in idl_gen_go.cpp

parent bc240b30
...@@ -161,7 +161,7 @@ class GoGenerator : public BaseGenerator { ...@@ -161,7 +161,7 @@ class GoGenerator : public BaseGenerator {
// A single enum member. // A single enum member.
void EnumMember(const EnumDef &enum_def, const EnumVal &ev, void EnumMember(const EnumDef &enum_def, const EnumVal &ev,
const int max_name_length, std::string *code_ptr) { size_t max_name_length, std::string *code_ptr) {
std::string &code = *code_ptr; std::string &code = *code_ptr;
code += "\t"; code += "\t";
code += enum_def.name; code += enum_def.name;
...@@ -189,7 +189,7 @@ class GoGenerator : public BaseGenerator { ...@@ -189,7 +189,7 @@ class GoGenerator : public BaseGenerator {
// A single enum name member. // A single enum name member.
void EnumNameMember(const EnumDef &enum_def, const EnumVal ev, void EnumNameMember(const EnumDef &enum_def, const EnumVal ev,
const int max_name_length, std::string *code_ptr) { size_t max_name_length, std::string *code_ptr) {
std::string &code = *code_ptr; std::string &code = *code_ptr;
code += "\t"; code += "\t";
code += enum_def.name; code += enum_def.name;
...@@ -229,7 +229,7 @@ class GoGenerator : public BaseGenerator { ...@@ -229,7 +229,7 @@ class GoGenerator : public BaseGenerator {
// A single enum value member. // A single enum value member.
void EnumValueMember(const EnumDef &enum_def, const EnumVal ev, void EnumValueMember(const EnumDef &enum_def, const EnumVal ev,
const int max_name_length, std::string *code_ptr) { size_t max_name_length, std::string *code_ptr) {
std::string &code = *code_ptr; std::string &code = *code_ptr;
code += "\t\""; code += "\t\"";
code += ev.name; code += ev.name;
...@@ -775,7 +775,7 @@ class GoGenerator : public BaseGenerator { ...@@ -775,7 +775,7 @@ class GoGenerator : public BaseGenerator {
void GenEnum(const EnumDef &enum_def, std::string *code_ptr) { void GenEnum(const EnumDef &enum_def, std::string *code_ptr) {
if (enum_def.generated) return; if (enum_def.generated) return;
const int max_name_length = MaxNameLength(enum_def); auto max_name_length = MaxNameLength(enum_def);
cur_name_space_ = enum_def.defined_namespace; cur_name_space_ = enum_def.defined_namespace;
GenComment(enum_def.doc_comment, code_ptr, nullptr); GenComment(enum_def.doc_comment, code_ptr, nullptr);
...@@ -989,12 +989,11 @@ class GoGenerator : public BaseGenerator { ...@@ -989,12 +989,11 @@ class GoGenerator : public BaseGenerator {
const Namespace *CurrentNameSpace() const { return cur_name_space_; } const Namespace *CurrentNameSpace() const { return cur_name_space_; }
static int MaxNameLength(const EnumDef &enum_def) { static size_t MaxNameLength(const EnumDef &enum_def) {
int max = 0; size_t max = 0;
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end(); for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end();
++it) { ++it) {
const int length = (*it)->name.length(); max = std::max((*it)->name.length(), max);
max = length > max ? length : max;
} }
return max; return max;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment