From c8e7df62896832598a45429f2e38f01e6024cf8b Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Sat, 10 Dec 2016 18:39:51 +0000 Subject: [PATCH] fix a few more warnings [ci skip] --- source/cell/cell.cpp | 6 ++---- source/detail/xlsx_consumer.cpp | 20 ++------------------ source/styles/border.cpp | 13 ++++++++++--- third-party/CMakeLists.txt | 2 ++ 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/source/cell/cell.cpp b/source/cell/cell.cpp index 83501f2d..a14304c6 100644 --- a/source/cell/cell.cpp +++ b/source/cell/cell.cpp @@ -825,11 +825,9 @@ std::string cell::to_string() const return nf.format(value()); case cell::type::boolean: return value() == 0.L ? "FALSE" : "TRUE"; -#ifdef WIN32 - default: - throw xlnt::exception("unhandled"); -#endif } + + return ""; } bool cell::has_format() const diff --git a/source/detail/xlsx_consumer.cpp b/source/detail/xlsx_consumer.cpp index 75793e0b..a0de6a48 100644 --- a/source/detail/xlsx_consumer.cpp +++ b/source/detail/xlsx_consumer.cpp @@ -1551,26 +1551,10 @@ void xlsx_consumer::read_worksheet(const std::string &rel_id) ws.row_properties(row_index).height = parser().attribute("ht"); } - skip_attribute("customHeight"); - - auto min_column = full_range.top_left().column_index(); - auto max_column = full_range.bottom_right().column_index(); - - if (parser().attribute_present("spans")) - { - std::string span_string = parser().attribute("spans"); - auto colon_index = span_string.find(':'); - - if (colon_index != std::string::npos) - { - min_column = static_cast(std::stoll(span_string.substr(0, colon_index))); - max_column = static_cast(std::stoll(span_string.substr(colon_index + 1))); - } - } - skip_attributes({xml::qname(xmlns_x14ac, "dyDescent")}); skip_attributes({"customFormat", "s", "customFont", "hidden", - "outlineLevel", "collapsed", "thickTop", "thickBot", "ph"}); + "outlineLevel", "collapsed", "thickTop", "thickBot", "ph", + "spans", "customHeight"}); while (in_element(xml::qname(xmlns, "row"))) { diff --git a/source/styles/border.cpp b/source/styles/border.cpp index eec4b0c0..d53b86b5 100644 --- a/source/styles/border.cpp +++ b/source/styles/border.cpp @@ -25,6 +25,14 @@ #include #include +#define EXCEPT_ON_UNHANDLED_SWITCH_CASE + +#ifdef EXCEPT_ON_UNHANDLED_SWITCH_CASE +#define default_case(default_value) throw xlnt::exception("unhandled case"); +#else +#define default_case(default_value) return default_value; +#endif + namespace xlnt { optional border::border_property::color() const @@ -112,10 +120,9 @@ optional border::side(border_side s) const case border_side::vertical: return vertical_; case border_side::horizontal: return horizontal_; case border_side::diagonal: return diagonal_; -#ifdef WIN32 - default: throw xlnt::exception("unhandled"); -#endif } + + default_case(start_); } border &border::side(border_side s, const border_property &prop) diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 78feb43f..5c6fd1cb 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -53,6 +53,8 @@ set(BOTAN if(MSVC) set_source_files_properties(${BOTAN} PROPERTIES COMPILE_FLAGS "/wd\"4244\" /wd\"4267\"") +else() + set_source_files_properties(${BOTAN} PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations") endif() if (CMAKE_SIZEOF_VOID_P EQUAL 8)