mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
fix mingw build, closes #80
This commit is contained in:
parent
daab3cf8ba
commit
455be8fb5f
|
@ -4,6 +4,8 @@ set(LIBRARY_VERSION 0.9.0)
|
|||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||
|
||||
# Global platform-specific definitions
|
||||
if(MSVC)
|
||||
add_definitions(-DUNICODE -D_UNICODE)
|
||||
|
|
|
@ -375,7 +375,7 @@ public:
|
|||
void load(std::istream &stream, const std::string &password);
|
||||
void load(const std::vector<std::uint8_t> &data, const std::string &password);
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _MSC_VER
|
||||
void save(const std::wstring &filename);
|
||||
void save(const std::wstring &filename, const std::string &password);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#define XML_DETAILS_CONFIG_H
|
||||
|
||||
#undef LIBSTUDXML_STATIC_LIB
|
||||
#define LIBSTUDXML_STATIC_LIB
|
||||
#undef LIBSTUDXML_EXTERNAL_EXPAT
|
||||
#undef LIBSTUDXML_BYTEORDER
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
namespace {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef WIN32
|
||||
|
||||
char system_separator()
|
||||
{
|
||||
|
|
|
@ -59,10 +59,8 @@ timedelta timedelta::from_number(long double raw_time)
|
|||
{
|
||||
timedelta result;
|
||||
|
||||
long double integer_part;
|
||||
long double fractional_part = std::modf(raw_time, &integer_part);
|
||||
|
||||
result.days = static_cast<int>(integer_part);
|
||||
result.days = static_cast<int>(raw_time);
|
||||
long double fractional_part = raw_time - result.days;
|
||||
|
||||
fractional_part *= 24;
|
||||
result.hours = static_cast<int>(fractional_part);
|
||||
|
|
|
@ -67,13 +67,15 @@ public:
|
|||
|
||||
void test_read_unicode_filename()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _MSC_VER
|
||||
xlnt::workbook wb;
|
||||
wb.load(L"data\\19_unicode_Λ.xlsx");
|
||||
TS_ASSERT_EQUALS(wb.get_active_sheet().get_cell("A1").get_value<std::string>(), "unicode!");
|
||||
#endif
|
||||
#ifndef __MINGW32__
|
||||
xlnt::workbook wb2;
|
||||
wb2.load(u8"data/19_unicode_Λ.xlsx");
|
||||
TS_ASSERT_EQUALS(wb2.get_active_sheet().get_cell("A1").get_value<std::string>(), "unicode!");
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
namespace {
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _MSC_VER
|
||||
std::wstring utf8_to_utf16(const std::string &utf8_string)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> convert;
|
||||
|
@ -822,7 +822,7 @@ void workbook::save(std::ostream &stream, const std::string &password)
|
|||
producer.write(stream, password);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _MSC_VER
|
||||
void workbook::save(const std::wstring &filename)
|
||||
{
|
||||
std::ofstream file_stream;
|
||||
|
|
|
@ -11,24 +11,7 @@ namespace {
|
|||
|
||||
static std::string create_temporary_filename()
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
std::array<TCHAR, MAX_PATH> buffer;
|
||||
DWORD result = GetTempPath(static_cast<DWORD>(buffer.size()), buffer.data());
|
||||
|
||||
if (result > MAX_PATH)
|
||||
{
|
||||
throw std::runtime_error("buffer is too small");
|
||||
}
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
throw std::runtime_error("GetTempPath failed");
|
||||
}
|
||||
|
||||
return std::string(buffer.begin(), buffer.begin() + result) + "xlnt.xlsx";
|
||||
#else
|
||||
return "/tmp/xlnt.xlsx";
|
||||
#endif
|
||||
return "temp.xlsx";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
2
third-party/botan
vendored
2
third-party/botan
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 923a95d546df5b6d31f39b0af900d0361fb2e6a6
|
||||
Subproject commit 523b2a4ca48fa5cf04ea371aabe7167ce2e5cd13
|
Loading…
Reference in New Issue
Block a user