diff --git a/include/odata/core/odata_entity_reference_collection.h b/include/odata/core/odata_entity_reference_collection.h index 4eeda8f..d56043e 100644 --- a/include/odata/core/odata_entity_reference_collection.h +++ b/include/odata/core/odata_entity_reference_collection.h @@ -79,7 +79,7 @@ class odata_entity_reference_collection int size() const { - return m_references.size(); + return (int)m_references.size(); } private: diff --git a/include/odata/core/odata_operation.h b/include/odata/core/odata_operation.h index e46c0b2..66123cd 100644 --- a/include/odata/core/odata_operation.h +++ b/include/odata/core/odata_operation.h @@ -56,6 +56,10 @@ class odata_operation class odata_function : public odata_operation { public: + odata_function(::odata::utility::string_t name) : odata_operation(name) + { + } + bool is_function() { return true; @@ -65,6 +69,10 @@ class odata_function : public odata_operation class odata_action : public odata_operation { public: + odata_action(::odata::utility::string_t name) : odata_operation(name) + { + } + bool is_function() { return false; diff --git a/include/odata/core/odata_property_map.h b/include/odata/core/odata_property_map.h index 80371d9..66a1719 100644 --- a/include/odata/core/odata_property_map.h +++ b/include/odata/core/odata_property_map.h @@ -141,7 +141,7 @@ class odata_property_map int size() const { - return m_properties.size(); + return (int)m_properties.size(); } private: diff --git a/include/odata/core/odata_service_document.h b/include/odata/core/odata_service_document.h index a702010..de95373 100644 --- a/include/odata/core/odata_service_document.h +++ b/include/odata/core/odata_service_document.h @@ -42,7 +42,7 @@ class odata_service_document int size() const { - return m_elements.size(); + return (int)m_elements.size(); } private: diff --git a/msvc/vs11/odata_library.vs11.vcxproj b/msvc/vs11/odata_library.vs11.vcxproj index 33c319e..ca7b576 100644 --- a/msvc/vs11/odata_library.vs11.vcxproj +++ b/msvc/vs11/odata_library.vs11.vcxproj @@ -54,7 +54,7 @@ - Level3 + Level4 Disabled true WIN32;_USRDLL;ODATALIB_EXPORTS;%(PreprocessorDefinitions) @@ -72,7 +72,7 @@ - Level3 + Level4 MaxSpeed true true diff --git a/msvc/vs12/odata_library.vs12.vcxproj b/msvc/vs12/odata_library.vs12.vcxproj index 98b0e83..acb703a 100644 --- a/msvc/vs12/odata_library.vs12.vcxproj +++ b/msvc/vs12/odata_library.vs12.vcxproj @@ -56,7 +56,7 @@ - Level3 + Level4 Disabled true WIN32;_USRDLL;ODATALIB_EXPORTS;%(PreprocessorDefinitions) @@ -74,7 +74,7 @@ - Level3 + Level4 MaxSpeed true true diff --git a/src/common/utility.cpp b/src/common/utility.cpp index a28312e..73a422b 100644 --- a/src/common/utility.cpp +++ b/src/common/utility.cpp @@ -76,9 +76,7 @@ bool is_relative_path(const string_t& _root_url, const string_t& _path) std::transform(root_url.begin(), root_url.end(), root_url.begin(), ::tolower); std::transform(path.begin(), path.end(), path.begin(), ::tolower); - size_t index = path.find(root_url); - - return path.find(root_url) != 0 ? true : false; + return path.find(root_url) != 0; } string_t print_double(const double& db, int precision) @@ -91,11 +89,11 @@ string_t print_double(const double& db, int precision) } string_t output = oss.str(); - int dot = output.find(U('.')); + int dot = (int)output.find(U('.')); if (dot > 0) { - int i = output.length() - 1; - for (i = output.length() - 1; i > dot; i--) + int i; + for (i = (int)output.length() - 1; i > dot; i--) { if (output[i] != U('0')) { @@ -124,11 +122,11 @@ string_t print_float(const float& db, int precision) } string_t output = oss.str(); - int dot = output.find(U('.')); + int dot = (int)output.find(U('.')); if (dot > 0) { - int i = output.length() - 1; - for (i = output.length() - 1; i > dot; i--) + int i; + for (i = (int)output.length() - 1; i > dot; i--) { if (output[i] != U('0')) { diff --git a/src/common/xmlhelpers.cpp b/src/common/xmlhelpers.cpp index 5a79777..6a8bdd2 100644 --- a/src/common/xmlhelpers.cpp +++ b/src/common/xmlhelpers.cpp @@ -293,11 +293,14 @@ namespace odata { namespace edm { #endif } - ::odata::utility::string_t xml_reader::read_to_end(std::istream& stream) - { #ifdef WIN32 + ::odata::utility::string_t xml_reader::read_to_end(std::istream&) + { throw std::runtime_error("xml_reader::read_to_end() should not be called in Windows"); + } #else // LINUX + ::odata::utility::string_t xml_reader::read_to_end(std::istream& stream) + { ::odata::utility::string_t text; while (stream.good()) { @@ -309,8 +312,8 @@ namespace odata { namespace edm { text.push_back(c); } return text; -#endif } +#endif void xml_writer::initialize(std::ostream& stream) { diff --git a/src/core/odata_context_url_parser.cpp b/src/core/odata_context_url_parser.cpp index 2584806..cdec046 100644 --- a/src/core/odata_context_url_parser.cpp +++ b/src/core/odata_context_url_parser.cpp @@ -79,8 +79,8 @@ std::shared_ptr odata_contex_url_parser::get_payload_content_typ } //Handle select/expand items. Right now just remove them. - int index_last_slash = path.rfind(U("/")); - int index_last_bracket = path.find_first_of(U("("), ++index_last_slash); + int index_last_slash = (int)path.rfind(U("/")); + int index_last_bracket = (int)path.find_first_of(U("("), ++index_last_slash); if (index_last_slash < index_last_bracket) { auto first_part = path.substr(0, index_last_bracket); @@ -123,7 +123,7 @@ std::shared_ptr odata_contex_url_parser::get_payload_content_typ std::shared_ptr last_segment; int index; - for (index = segments.size() - 1; index >=0; index--) + for (index = (int)segments.size() - 1; index >= 0; index--) { if (segments[index]->segment_type() != odata_path_segment_type::Type) { @@ -179,7 +179,7 @@ std::shared_ptr odata_contex_url_parser::get_payload_content_typ throw std::runtime_error("Invalid context url"); } - if (index != segments.size() - 1) + if (index != (int)segments.size() - 1) { last_segment = segments[segments.size() - 1]; if (last_segment->segment_type() == odata_path_segment_type::Type) diff --git a/src/core/odata_json_reader_full.cpp b/src/core/odata_json_reader_full.cpp index aca9bab..4af9cd4 100644 --- a/src/core/odata_json_reader_full.cpp +++ b/src/core/odata_json_reader_full.cpp @@ -12,7 +12,8 @@ using namespace ::odata::utility; namespace odata { namespace core { -std::shared_ptr entity_json_reader_full::deserilize(const odata::utility::json::value& response, std::shared_ptr set) +std::shared_ptr entity_json_reader_full::deserilize( + const odata::utility::json::value& /*response*/, std::shared_ptr /*set*/) { throw std::runtime_error("full metadata reader not implemented!"); } diff --git a/src/core/odata_json_reader_minimal.cpp b/src/core/odata_json_reader_minimal.cpp index eb88689..6246bd5 100644 --- a/src/core/odata_json_reader_minimal.cpp +++ b/src/core/odata_json_reader_minimal.cpp @@ -28,18 +28,18 @@ ::odata::utility::string_t odata_json_reader_minimal::get_navigation_source_from { ::odata::utility::string_t ret = context_url; - int index = ret.find(U("#")); + int index = (int)ret.find(U("#")); ret = ret.substr(index + 1, ret.length() - index - 1); - index = ret.find(U("/$entity")); + index = (int)ret.find(U("/$entity")); if (index != -1) { ret = ret.substr(0, index); } - int index_last_slash = ret.rfind(U("/")); + int index_last_slash = (int)ret.rfind(U("/")); - int index_last_bracket = ret.find_first_of(U("("), ++index_last_slash); + int index_last_bracket = (int)ret.find_first_of(U("("), ++index_last_slash); if (index_last_slash < index_last_bracket) { ret = ret.substr(0, index_last_bracket); @@ -118,7 +118,7 @@ void odata_json_reader_minimal::set_edit_link_for_entity_value(const std::shared throw std::runtime_error("Invalid context url"); } std::shared_ptr last_segment; - for (int i = segments.size() - 1; i >=0; i--) + for (int i = (int)segments.size() - 1; i >=0; i--) { if (segments[i]->segment_type() != odata_path_segment_type::Type) { diff --git a/src/core/odata_json_writer.cpp b/src/core/odata_json_writer.cpp index dc18564..9d07223 100644 --- a/src/core/odata_json_writer.cpp +++ b/src/core/odata_json_writer.cpp @@ -301,7 +301,6 @@ namespace odata { namespace core { return collection_json; } - return result; } bool odata_json_writer::is_type_serializable(const std::shared_ptr& property_type) diff --git a/src/core/odata_uri_parser.cpp b/src/core/odata_uri_parser.cpp index e703136..ba15972 100644 --- a/src/core/odata_uri_parser.cpp +++ b/src/core/odata_uri_parser.cpp @@ -183,8 +183,6 @@ void odata_path_parser::bind_path(std::vector<::odata::utility::string_t> raw_se { m_bound_segments.clear(); - bool should_be_no_segment = false; - for (::size_t i = 0; i < raw_segments.size(); ++i) { if (i == 0) diff --git a/src/edm/edm_model_utility.cpp b/src/edm/edm_model_utility.cpp index 6296278..3ac1d25 100644 --- a/src/edm/edm_model_utility.cpp +++ b/src/edm/edm_model_utility.cpp @@ -119,8 +119,8 @@ std::shared_ptr edm_model_utility::get_edm_type_from_name(const } else if (type_name.substr(0, 10) == U("Collection")) { - int index_first = type_name.find_first_of('(') + 1; - int index_last = type_name.find_last_of(')'); + int index_first = (int)type_name.find_first_of('(') + 1; + int index_last = (int)type_name.find_last_of(')'); ::odata::utility::string_t element_name = type_name.substr(index_first, index_last - index_first); auto element_type = edm_model_utility::get_edm_type_from_name(element_name); @@ -263,8 +263,8 @@ std::shared_ptr edm_model_utility::resolve_type_from_name(const } else if (qualified_name.substr(0, 10) == U("Collection")) { - int index_first = qualified_name.find_first_of('(') + 1; - int index_last = qualified_name.find_last_of(')'); + int index_first = (int)qualified_name.find_first_of('(') + 1; + int index_last = (int)qualified_name.find_last_of(')'); if (index_first >= index_last) { @@ -287,8 +287,8 @@ ::odata::utility::string_t edm_model_utility::get_collection_element_name(const if (collection_full_name.substr(0, 10) == U("Collection")) { - int index_first = collection_full_name.find_first_of('(') + 1; - int index_last = collection_full_name.find_last_of(')'); + int index_first = (int)collection_full_name.find_first_of('(') + 1; + int index_last = (int)collection_full_name.find_last_of(')'); if (index_first >= index_last) { @@ -404,8 +404,8 @@ std::shared_ptr edm_model_utility::resolve_undetermined_type(con ::odata::utility::string_t type_name = undeterminedType->get_name(); if (type_name.substr(0, 10) == U("Collection")) { - int index_first = type_name.find_first_of('(') + 1; - int index_last = type_name.find_last_of(')'); + int index_first = (int)type_name.find_first_of('(') + 1; + int index_last = (int)type_name.find_last_of(')'); if (index_first >= index_last) {