mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
fix msvc errors
This commit is contained in:
parent
b2b9732a09
commit
6cbe7c0bf9
|
@ -48,7 +48,7 @@ after_success:
|
|||
- if [ "$COMPILER" = "g++-4.9" ]; then cd .. && ./bin/xlnt.test ; fi
|
||||
- if [ "$COMPILER" = "g++-4.9" ]; then export OLDWD=$(pwd) ; fi
|
||||
- if [ "$COMPILER" = "g++-4.9" ]; then cd "build/CMakeFiles/xlnt.static.dir$(pwd)" ; pwd ; fi
|
||||
- if [ "$COMPILER" = "g++-4.9" ]; then coveralls --root $OLDWD --verbose -x ".cpp" --gcov-options '\-p' --exclude include --exclude third-party ; fi
|
||||
- if [ "$COMPILER" = "g++-4.9" ]; then coveralls --root $OLDWD --verbose -x ".cpp" --gcov-options '\-p' --exclude include --exclude third-party --exclude tests --exclude samples --exclude benchmarks ; fi
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
|
|
@ -40,7 +40,7 @@ struct XLNT_CLASS timedelta
|
|||
|
||||
timedelta(int days_, int hours_, int minutes_, int seconds_, int microseconds_);
|
||||
|
||||
double to_number() const;
|
||||
long double to_number() const;
|
||||
|
||||
int days;
|
||||
int hours;
|
||||
|
|
|
@ -8,18 +8,18 @@ class test_timedelta : public CxxTest::TestSuite
|
|||
public:
|
||||
void test_from_number()
|
||||
{
|
||||
auto td = xlnt::timedelta::from_number(1.0);
|
||||
auto td = xlnt::timedelta::from_number(1.0423726852L);
|
||||
|
||||
TS_ASSERT(td.days == 1);
|
||||
TS_ASSERT(td.hours == 0);
|
||||
TS_ASSERT(td.minutes == 0);
|
||||
TS_ASSERT(td.seconds == 0);
|
||||
TS_ASSERT(td.microseconds == 0);
|
||||
TS_ASSERT(td.hours == 1);
|
||||
TS_ASSERT(td.minutes == 1);
|
||||
TS_ASSERT(td.seconds == 1);
|
||||
TS_ASSERT(td.microseconds == 1);
|
||||
}
|
||||
|
||||
void test_round_trip()
|
||||
{
|
||||
long double time = 3.14159265;
|
||||
long double time = 3.14159265359L;
|
||||
auto td = xlnt::timedelta::from_number(time);
|
||||
auto time_rt = td.to_number();
|
||||
TS_ASSERT_EQUALS(time, time_rt);
|
||||
|
@ -28,6 +28,6 @@ public:
|
|||
void test_to_number()
|
||||
{
|
||||
xlnt::timedelta td(1, 1, 1, 1, 1);
|
||||
TS_ASSERT_EQUALS(td.to_number(), 1.0423726851999999);
|
||||
TS_ASSERT_EQUALS(td.to_number(), 1.0423726852L);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ timedelta::timedelta(int days_, int hours_, int minutes_, int seconds_, int micr
|
|||
{
|
||||
}
|
||||
|
||||
double timedelta::to_number() const
|
||||
long double timedelta::to_number() const
|
||||
{
|
||||
std::uint64_t total_microseconds = static_cast<std::uint64_t>(microseconds);
|
||||
total_microseconds += static_cast<std::uint64_t>(seconds * 1e6);
|
||||
|
@ -37,10 +37,10 @@ timedelta timedelta::from_number(long double raw_time)
|
|||
{
|
||||
timedelta result;
|
||||
|
||||
double integer_part;
|
||||
double fractional_part = std::modf((double)raw_time, &integer_part);
|
||||
long double integer_part;
|
||||
long double fractional_part = std::modf(raw_time, &integer_part);
|
||||
|
||||
result.days = integer_part;
|
||||
result.days = static_cast<int>(integer_part);
|
||||
|
||||
fractional_part *= 24;
|
||||
result.hours = (int)fractional_part;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <xlnt/packaging/manifest.hpp>
|
||||
#include <xlnt/packaging/relationship.hpp>
|
||||
#include <xlnt/packaging/zip_file.hpp>
|
||||
#include <xlnt/serialization/encoding.hpp>
|
||||
#include <xlnt/serialization/excel_serializer.hpp>
|
||||
#include <xlnt/styles/alignment.hpp>
|
||||
#include <xlnt/styles/border.hpp>
|
||||
|
@ -48,6 +49,8 @@ workbook::workbook() : d_(new detail::workbook_impl())
|
|||
create_relationship("rId4", "theme/theme1.xml", relationship::type::theme);
|
||||
|
||||
add_number_format(number_format::general());
|
||||
|
||||
d_->encoding_ = encoding::ascii;
|
||||
|
||||
d_->manifest_.add_default_type("rels", "application/vnd.openxmlformats-package.relationships+xml");
|
||||
d_->manifest_.add_default_type("xml", "application/xml");
|
||||
|
|
Loading…
Reference in New Issue
Block a user