fix warnings and other minor issues

This commit is contained in:
Thomas Fussell 2019-12-26 12:52:14 -05:00
parent 1a0c61f5b0
commit 39503e8bf0
6 changed files with 15 additions and 10 deletions

View File

@ -84,6 +84,8 @@ file(GLOB WORKBOOK_HEADERS ${XLNT_INCLUDE_DIR}/xlnt/workbook/*.hpp)
file(GLOB WORKBOOK_SOURCES ${XLNT_SOURCE_DIR}/workbook/*.cpp)
file(GLOB WORKSHEET_HEADERS ${XLNT_INCLUDE_DIR}/xlnt/worksheet/*.hpp)
file(GLOB WORKSHEET_SOURCES ${XLNT_SOURCE_DIR}/worksheet/*.cpp)
file(GLOB MINIZ_HEADERS ${THIRD_PARTY_DIR}/miniz/*.h)
file(GLOB MINIZ_SOURCES ${THIRD_PARTY_DIR}/miniz/*.c)
file(GLOB DETAIL_ROOT_HEADERS ${XLNT_SOURCE_DIR}/detail/*.hpp)
file(GLOB DETAIL_ROOT_SOURCES ${XLNT_SOURCE_DIR}/detail/*.cpp)
@ -113,12 +115,12 @@ set(XLNT_HEADERS ${ROOT_HEADERS} ${CELL_HEADERS} ${CHARTS_HEADERS}
${CHARTSHEET_HEADERS} ${DRAWING_HEADERS} ${FORMULA_HEADERS}
${PACKAGING_HEADERS} ${STYLES_HEADERS} ${UTILS_HEADERS}
${WORKBOOK_HEADERS} ${WORKSHEET_HEADERS} ${DETAIL_HEADERS} ${DETAIL_CRYPTO_HEADERS}
${DRAWING_HEADERS})
${DRAWING_HEADERS} ${MINIZ_HEADERS})
set(XLNT_SOURCES ${CELL_SOURCES} ${CHARTS_SOURCES} ${CHARTSHEET_SOURCES}
${DRAWING_SOURCES} ${FORMULA_SOURCES} ${PACKAGING_SOURCES}
${STYLES_SOURCES} ${UTILS_SOURCES} ${WORKBOOK_SOURCES}
${WORKSHEET_SOURCES} ${DETAIL_SOURCES} ${DETAIL_CRYPTO_SOURCES}
${DRAWING_SOURCES})
${DRAWING_SOURCES} ${MINIZ_SOURCES})
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Set a default CMAKE_INSTALL_PREFIX if one wasn't specified
@ -184,6 +186,7 @@ target_include_directories(xlnt
PRIVATE
${XLNT_SOURCE_DIR}
${XLNT_SOURCE_DIR}/../third-party/libstudxml
${XLNT_SOURCE_DIR}/../third-party/miniz
${XLNT_SOURCE_DIR}/../third-party/utfcpp)
# Platform- and file-specific settings, MSVC
@ -237,6 +240,7 @@ source_group(styles FILES ${STYLES_HEADERS} ${STYLES_SOURCES})
source_group(utils FILES ${UTILS_HEADERS} ${UTILS_SOURCES})
source_group(workbook FILES ${WORKBOOK_HEADERS} ${WORKBOOK_SOURCES})
source_group(worksheet FILES ${WORKSHEET_HEADERS} ${WORKSHEET_SOURCES})
source_group(third-party\\miniz FILES ${MINIZ_HEADERS} ${MINIZ_SOURCES})
# Install library
install(TARGETS xlnt EXPORT XlntTargets

View File

@ -26,8 +26,8 @@
#pragma clang diagnostic ignored "-Wweak-vtables"
#pragma clang diagnostic ignored "-Wextra-semi"
#pragma clang diagnostic ignored "-Wdeprecated"
#include <xml/content>
#include <xml/parser>
#include <xml/qname>
#include <xml/serializer>
#include <libstudxml/content.hxx>
#include <libstudxml/parser.hxx>
#include <libstudxml/qname.hxx>
#include <libstudxml/serializer.hxx>
#pragma clang diagnostic pop

View File

@ -349,7 +349,7 @@ std::pair<xlnt::row_properties, int> parse_row(xml::parser *parser, xlnt::detail
switch (e)
{
case xml::parser::start_element: {
parsed_cells.push_back(parse_cell(props.second, parser));
parsed_cells.push_back(parse_cell(static_cast<xlnt::row_t>(props.second), parser));
break;
}
case xml::parser::end_element: {

View File

@ -78,7 +78,7 @@ size_t string_length(const std::string &utf8_string)
throw xlnt::exception("Invalid UTF-8 encoding detected");
}
return utf8::distance(utf8_string.begin(), end_it);
return static_cast<std::size_t>(utf8::distance(utf8_string.begin(), end_it));
}
} // namespace detail

View File

@ -126,7 +126,7 @@ date date::today()
int date::weekday() const
{
std::tm tm{0, 0, 0, day, month - 1, year - 1900};
std::tm tm{0, 0, 0, day, month - 1, year - 1900, 0, 0, 0, 0, nullptr};
std::time_t time = std::mktime(&tm);
return safe_localtime(time).tm_wday;

View File

@ -48,7 +48,8 @@ target_link_libraries(xlnt.test PRIVATE xlnt)
target_include_directories(xlnt.test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../source
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libstudxml)
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libstudxml
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../third-party/miniz)
set(XLNT_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
target_compile_definitions(xlnt.test PRIVATE XLNT_TEST_DATA_DIR=${XLNT_TEST_DATA_DIR})