improve compatability with old compiler
This commit is contained in:
parent
80b3566e9b
commit
363953be20
@ -14,29 +14,28 @@
|
||||
#if defined(NANA_WINDOWS)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <cassert>
|
||||
#include <array>
|
||||
|
||||
namespace {
|
||||
std::tm localtime()
|
||||
{
|
||||
#if defined(NANA_WINDOWS) && !defined(NANA_MINGW)
|
||||
time_t t;
|
||||
::time(&t);
|
||||
std::time_t t = std::time(nullptr);
|
||||
std::tm tm;
|
||||
if(localtime_s(&tm, &t) != 0)
|
||||
assert(false);
|
||||
if (localtime_s(&tm, &t) != 0)
|
||||
throw std::runtime_error("invalid local time");
|
||||
|
||||
return tm;
|
||||
#else
|
||||
time_t t = std::time(nullptr);
|
||||
struct tm * tm_addr = std::localtime(&t);
|
||||
assert(tm_addr);
|
||||
|
||||
if(nullptr == tm_addr)
|
||||
throw std::runtime_error("invalid local time");
|
||||
|
||||
return *tm_addr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
::nana::date::value to_dateval(const std::tm& t)
|
||||
{
|
||||
return {static_cast<unsigned>(t.tm_year + 1900), static_cast<unsigned>(t.tm_mon + 1), static_cast<unsigned>(t.tm_mday)};
|
||||
@ -51,7 +50,7 @@ namespace {
|
||||
|
||||
namespace nana
|
||||
{
|
||||
//class date
|
||||
//class date
|
||||
void date::set(const std::tm& t)
|
||||
{
|
||||
value_ = to_dateval(t);
|
||||
|
@ -617,7 +617,7 @@ namespace nana
|
||||
|
||||
: std::invalid_argument{ what + " from place implementation " },
|
||||
pos{ pos },
|
||||
field { field.empty() ? "unnamed" : field }
|
||||
field(field.empty() ? "unnamed" : field)
|
||||
{}
|
||||
std::string::size_type pos;
|
||||
std::string field;
|
||||
@ -3674,18 +3674,18 @@ namespace nana
|
||||
std::string field,
|
||||
std::string::size_type pos)
|
||||
|
||||
: std::invalid_argument{ "from widget '"
|
||||
: std::invalid_argument( "from widget '"
|
||||
+ API::window_caption(plc.window_handle()).substr(0,80)
|
||||
+ "'; nana::place error "
|
||||
+ what
|
||||
+ "' in field '" + field
|
||||
+ (pos == std::string::npos ? "' " : "' at position " + std::to_string(pos))
|
||||
+ " in div_text:\n" + plc.div() },
|
||||
base_what{ what },
|
||||
owner_caption{ API::window_caption(plc.window_handle()).substr(0,80) },
|
||||
div_text{ plc.div() },
|
||||
field{ field },
|
||||
pos{ pos }
|
||||
+ " in div_text:\n" + plc.div() ),
|
||||
base_what( what ),
|
||||
owner_caption( API::window_caption(plc.window_handle()).substr(0,80) ),
|
||||
div_text( plc.div() ),
|
||||
field( field ),
|
||||
pos( pos )
|
||||
{}
|
||||
//end class place
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <nana/paint/graphics.hpp>
|
||||
#include <nana/paint/pixel_buffer.hpp>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#if defined(NANA_WINDOWS)
|
||||
@ -71,7 +70,6 @@ namespace nana{ namespace system{
|
||||
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
HDC hDC = ::GetDC(NULL);
|
||||
if (::GetDIBits(hDC, (HBITMAP)g.pixmap(), 0, 1, NULL, (BITMAPINFO *)&bmi, DIB_RGB_COLORS) == 0) {
|
||||
assert(false);
|
||||
::ReleaseDC(NULL, hDC);
|
||||
return false;
|
||||
}
|
||||
@ -109,7 +107,6 @@ namespace nana{ namespace system{
|
||||
::CloseClipboard();
|
||||
}
|
||||
}
|
||||
assert(false);
|
||||
::GlobalFree(h_gmem);
|
||||
return false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user