THRIFT-2850 get windows cmake working again and building the unit tests for lib/cpp, and pass make check through cmake - also resolve some compiler warnings
diff --git a/compiler/cpp/src/generate/t_delphi_generator.cc b/compiler/cpp/src/generate/t_delphi_generator.cc
index c435a31..2684811 100644
--- a/compiler/cpp/src/generate/t_delphi_generator.cc
+++ b/compiler/cpp/src/generate/t_delphi_generator.cc
@@ -510,13 +510,13 @@
}
bool t_delphi_generator::find_keyword(std::map<std::string, int>& keyword_map, std::string name) {
- int len = name.length();
+ std::string::size_type len = name.length();
if (len <= 0) {
return false;
}
- int nlast = name.find_last_of('_');
+ std::string::size_type nlast = name.find_last_of('_');
if (nlast >= 1) {
if (nlast == (len - 1)) {
diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/generate/t_go_generator.cc
index ff44828..8c219ad 100644
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/generate/t_go_generator.cc
@@ -2057,7 +2057,7 @@
t_struct* arg_struct = (*f_iter)->get_arglist();
const std::vector<t_field*>& args = arg_struct->get_members();
vector<t_field*>::const_iterator a_iter;
- int num_args = args.size();
+ std::vector<t_field*>::size_type num_args = args.size();
bool first = true;
for (int i = 0; i < num_args; ++i) {
@@ -2183,7 +2183,7 @@
t_struct* arg_struct = (*f_iter)->get_arglist();
const std::vector<t_field*>& args = arg_struct->get_members();
vector<t_field*>::const_iterator a_iter;
- int num_args = args.size();
+ std::vector<t_field*>::size_type num_args = args.size();
string funcName((*f_iter)->get_name());
string pubName(publicize(funcName));
string argumentsName(publicize(funcName + "_args", true));
diff --git a/compiler/cpp/src/generate/t_hs_generator.cc b/compiler/cpp/src/generate/t_hs_generator.cc
index 638cc30..4297397 100644
--- a/compiler/cpp/src/generate/t_hs_generator.cc
+++ b/compiler/cpp/src/generate/t_hs_generator.cc
@@ -1201,7 +1201,7 @@
string t_hs_generator::render_hs_type_for_function_name(t_type* type) {
string type_str = render_hs_type(type, false);
- int found = -1;
+ std::string::size_type found = -1;
while (true) {
found = type_str.find_first_of("[]. ", found + 1);
diff --git a/compiler/cpp/src/generate/t_html_generator.cc b/compiler/cpp/src/generate/t_html_generator.cc
index 8e54ac1..6333d71 100644
--- a/compiler/cpp/src/generate/t_html_generator.cc
+++ b/compiler/cpp/src/generate/t_html_generator.cc
@@ -665,7 +665,7 @@
* Prints out the provided type in HTML
*/
int t_html_generator::print_type(t_type* ttype) {
- int len = 0;
+ std::string::size_type len = 0;
f_out_ << "<code>";
if (ttype->is_container()) {
if (ttype->is_list()) {
@@ -708,7 +708,7 @@
f_out_ << type_name << "</a>";
}
f_out_ << "</code>";
- return len;
+ return (int)len;
}
/**
@@ -1030,7 +1030,7 @@
f_out_ << "<h4 id=\"Fn_" << service_name_ << "_" << fn_name << "\">Function: " << service_name_
<< "." << fn_name << "</h4>" << endl;
f_out_ << "<pre>";
- int offset = print_type((*fn_iter)->get_returntype());
+ std::string::size_type offset = print_type((*fn_iter)->get_returntype());
bool first = true;
f_out_ << " " << fn_name << "(";
offset += fn_name.size() + 2;
diff --git a/compiler/cpp/src/generate/t_py_generator.cc b/compiler/cpp/src/generate/t_py_generator.cc
index a21dff1..22658a1 100644
--- a/compiler/cpp/src/generate/t_py_generator.cc
+++ b/compiler/cpp/src/generate/t_py_generator.cc
@@ -1413,7 +1413,7 @@
t_struct* arg_struct = (*f_iter)->get_arglist();
const std::vector<t_field*>& args = arg_struct->get_members();
vector<t_field*>::const_iterator a_iter;
- int num_args = args.size();
+ std::vector<t_field*>::size_type num_args = args.size();
bool first = true;
for (int i = 0; i < num_args; ++i) {
if (first) {
@@ -1466,7 +1466,7 @@
t_struct* arg_struct = (*f_iter)->get_arglist();
const std::vector<t_field*>& args = arg_struct->get_members();
vector<t_field*>::const_iterator a_iter;
- int num_args = args.size();
+ std::vector<t_field*>::size_type num_args = args.size();
f_remote << "if cmd == '" << (*f_iter)->get_name() << "':" << endl
<< " if len(args) != " << num_args << ":" << endl << " print('"
diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc
index c0166a1..97d523e 100644
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/main.cc
@@ -1111,7 +1111,7 @@
#ifdef _WIN32
// strip out trailing \ on Windows
- int last = out_path.length() - 1;
+ std::string::size_type last = out_path.length() - 1;
if (out_path[last] == '\\') {
out_path.erase(last);
}
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index 2b2d948..cfab691 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -271,7 +271,7 @@
include_prefix_ = include_prefix;
// this is intended to be a directory; add a trailing slash if necessary
- int len = include_prefix_.size();
+ std::string::size_type len = include_prefix_.size();
if (len > 0 && include_prefix_[len - 1] != '/') {
include_prefix_ += '/';
}