Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximKalininMS committed Sep 9, 2015
1 parent d930af9 commit 10c6989
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 40 deletions.
2 changes: 1 addition & 1 deletion include/odata/core/odata_entity_reference_collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class odata_entity_reference_collection

int size() const
{
return m_references.size();
return (int)m_references.size();
}

private:
Expand Down
8 changes: 8 additions & 0 deletions include/odata/core/odata_operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/odata/core/odata_property_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class odata_property_map

int size() const
{
return m_properties.size();
return (int)m_properties.size();
}

private:
Expand Down
2 changes: 1 addition & 1 deletion include/odata/core/odata_service_document.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class odata_service_document

int size() const
{
return m_elements.size();
return (int)m_elements.size();
}

private:
Expand Down
4 changes: 2 additions & 2 deletions msvc/vs11/odata_library.vs11.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_USRDLL;ODATALIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand All @@ -72,7 +72,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
Expand Down
4 changes: 2 additions & 2 deletions msvc/vs12/odata_library.vs12.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_USRDLL;ODATALIB_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand All @@ -74,7 +74,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
Expand Down
16 changes: 7 additions & 9 deletions src/common/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'))
{
Expand Down Expand Up @@ -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'))
{
Expand Down
9 changes: 6 additions & 3 deletions src/common/xmlhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand All @@ -309,8 +312,8 @@ namespace odata { namespace edm {
text.push_back(c);
}
return text;
#endif
}
#endif

void xml_writer::initialize(std::ostream& stream)
{
Expand Down
8 changes: 4 additions & 4 deletions src/core/odata_context_url_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ std::shared_ptr<edm_named_type> 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);
Expand Down Expand Up @@ -123,7 +123,7 @@ std::shared_ptr<edm_named_type> odata_contex_url_parser::get_payload_content_typ

std::shared_ptr<odata_path_segment> 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)
{
Expand Down Expand Up @@ -179,7 +179,7 @@ std::shared_ptr<edm_named_type> 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)
Expand Down
3 changes: 2 additions & 1 deletion src/core/odata_json_reader_full.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ using namespace ::odata::utility;
namespace odata { namespace core
{

std::shared_ptr<odata_value> entity_json_reader_full::deserilize(const odata::utility::json::value& response, std::shared_ptr<edm_entity_set> set)
std::shared_ptr<odata_value> entity_json_reader_full::deserilize(
const odata::utility::json::value& /*response*/, std::shared_ptr<edm_entity_set> /*set*/)
{
throw std::runtime_error("full metadata reader not implemented!");
}
Expand Down
10 changes: 5 additions & 5 deletions src/core/odata_json_reader_minimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<odata_path_segment> 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)
{
Expand Down
1 change: 0 additions & 1 deletion src/core/odata_json_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ namespace odata { namespace core
{
return collection_json;
}
return result;
}

bool odata_json_writer::is_type_serializable(const std::shared_ptr<edm_named_type>& property_type)
Expand Down
2 changes: 0 additions & 2 deletions src/core/odata_uri_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions src/edm/edm_model_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ std::shared_ptr<edm_named_type> 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);
Expand Down Expand Up @@ -263,8 +263,8 @@ std::shared_ptr<edm_named_type> 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)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -404,8 +404,8 @@ std::shared_ptr<edm_named_type> 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)
{
Expand Down

0 comments on commit 10c6989

Please sign in to comment.