fix compiling errors by using GCC/Clang
This commit is contained in:
parent
396163c1b7
commit
894e7e61c8
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* A filesystem Implementation
|
||||
* A ISO C++ filesystem Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
@ -195,7 +195,7 @@ namespace filesystem
|
||||
directory_iterator():end_(true), handle_(nullptr){}
|
||||
|
||||
directory_iterator(const nana::string& file_path) { _m_prepare(file_path); }
|
||||
//directory_iterator(const path& file_path) { _m_prepare(file_path.filename()); }
|
||||
directory_iterator(const path& file_path) { _m_prepare(file_path.filename()); }
|
||||
|
||||
const value_type&
|
||||
operator*() const { return value_; }
|
||||
@ -320,9 +320,9 @@ namespace filesystem
|
||||
return;
|
||||
}
|
||||
}
|
||||
value_ = value_type(wfd_.cFileName,
|
||||
(FILE_ATTRIBUTE_DIRECTORY & wfd_.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY,
|
||||
wfd_.nFileSizeLow);
|
||||
value_ = value_type(wfd_.cFileName,
|
||||
(FILE_ATTRIBUTE_DIRECTORY & wfd_.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY,
|
||||
wfd_.nFileSizeLow);
|
||||
}
|
||||
else
|
||||
end_ = true;
|
||||
@ -339,13 +339,13 @@ namespace filesystem
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nana::string d_name = nana::charset(dnt->d_name);
|
||||
struct stat fst;
|
||||
if(stat((path_ + "/" + dnt->d_name).c_str(), &fst) == 0)
|
||||
value_ = value_type(static_cast<nana::string>(nana::charset(wfd_.cFileName)),
|
||||
(FILE_ATTRIBUTE_DIRECTORY & wfd_.dwFileAttributes) == FILE_ATTRIBUTE_DIRECTORY,
|
||||
wfd_.nFileSizeLow);
|
||||
value_ = value_type(std::move(d_name), (0 != S_ISDIR(fst.st_mode)), fst.st_size);
|
||||
else
|
||||
value_.m_path = nana::charset(dnt->d_name);
|
||||
value_.m_path = path(std::move(d_name));
|
||||
}
|
||||
else
|
||||
end_ = true;
|
||||
@ -361,7 +361,7 @@ namespace filesystem
|
||||
{
|
||||
#if defined(NANA_WINDOWS)
|
||||
::FindClose(*handle);
|
||||
#elif defined(NANA_LINUX)
|
||||
#elif defined(NANA_LINUX)
|
||||
::closedir(*handle);
|
||||
#endif
|
||||
}
|
||||
@ -369,7 +369,7 @@ namespace filesystem
|
||||
}
|
||||
};
|
||||
private:
|
||||
bool end_{false};
|
||||
bool end_{false};
|
||||
|
||||
#if defined(NANA_WINDOWS)
|
||||
WIN32_FIND_DATA wfd_;
|
||||
@ -378,8 +378,7 @@ namespace filesystem
|
||||
std::string path_;
|
||||
#endif
|
||||
std::shared_ptr<find_handle_t> find_ptr_;
|
||||
|
||||
find_handle_t handle_{nullptr};
|
||||
find_handle_t handle_{nullptr};
|
||||
value_type value_;
|
||||
};
|
||||
|
||||
@ -406,7 +405,7 @@ namespace filesystem
|
||||
bool file_attrib(const nana::string& file, attribute&);
|
||||
|
||||
inline bool is_directory(file_status s) { return s.type() == file_type::directory ;}
|
||||
inline bool is_directory(const path& p) { return directory_iterator{ p }->attr.directory; }//works??
|
||||
inline bool is_directory(const path& p) { return directory_iterator(p)->attr.directory; }//works??
|
||||
inline bool is_directory(const directory_entry& d) { return d.attr.directory; }
|
||||
//bool is_directory(const path& p, error_code& ec) noexcept;
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ namespace nana{
|
||||
core_window_t * root_wd = wd->root_widget;
|
||||
auto & nimbus = root_wd->other.attribute.root->effects_edge_nimbus;
|
||||
|
||||
for (auto i = nimbus.cbegin(); i != nimbus.cend(); ++i)
|
||||
for (auto i = nimbus.begin(); i != nimbus.end(); ++i)
|
||||
{
|
||||
if (i->window == wd)
|
||||
{
|
||||
|
||||
@ -8,8 +8,8 @@ namespace nana{ namespace audio
|
||||
//class audio_stream
|
||||
bool audio_stream::open(const nana::string& file)
|
||||
{
|
||||
std::string fname{nana::charset(file)};//static_cast<std::string>()
|
||||
fs_.open(fname, std::ios::binary);
|
||||
std::string fname = nana::charset(file);
|
||||
fs_.open(fname, std::ios::binary);
|
||||
if(fs_)
|
||||
{
|
||||
wave_spec::master_riff_chunk riff;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* A FileSystem Utility Implementation
|
||||
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
|
||||
* A ISO C++ FileSystem Implementation
|
||||
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -206,8 +206,8 @@ namespace nana {
|
||||
struct stat fst;
|
||||
if (0 == ::stat(static_cast<std::string>(nana::charset(file)).c_str(), &fst))
|
||||
{
|
||||
attr.bytes = fst.st_size;
|
||||
attr.is_directory = (0 != (040000 & fst.st_mode));
|
||||
attr.size = fst.st_size;
|
||||
attr.directory = (0 != (040000 & fst.st_mode));
|
||||
attr.modified = *(::localtime(&fst.st_ctime));
|
||||
return true;
|
||||
}
|
||||
@ -435,7 +435,7 @@ namespace nana {
|
||||
#elif defined(NANA_LINUX)
|
||||
const char * s = ::getenv("PWD");
|
||||
if (s)
|
||||
return nana::charset(std::string(s, std::strlen(s)), nana::unicode::utf8);
|
||||
return static_cast<nana::string>(nana::charset(std::string(s, std::strlen(s)), nana::unicode::utf8));
|
||||
#endif
|
||||
return nana::string();
|
||||
}
|
||||
|
||||
@ -444,7 +444,7 @@ namespace detail
|
||||
arg.window_handle = reinterpret_cast<window>(wd);
|
||||
arg.button = ::nana::mouse::any_button;
|
||||
|
||||
int mask_state == 0;
|
||||
int mask_state = 0;
|
||||
if (ButtonPress == msg || ButtonRelease == msg)
|
||||
{
|
||||
mask_state = evt.xbutton.state;
|
||||
@ -483,11 +483,11 @@ namespace detail
|
||||
arg.pos.y = evt.xcrossing.y - wd->pos_root.y;
|
||||
}
|
||||
|
||||
arg.left_button = (Button1Mask & state);
|
||||
arg.right_button = (Button2Mask & state);
|
||||
arg.mid_button = (Button3Mask & state);
|
||||
arg.shift = (ShiftMask & state);
|
||||
arg.ctrl = (ControlMask & state);
|
||||
arg.left_button = (Button1Mask & mask_state);
|
||||
arg.right_button = (Button2Mask & mask_state);
|
||||
arg.mid_button = (Button3Mask & mask_state);
|
||||
arg.shift = (ShiftMask & mask_state);
|
||||
arg.ctrl = (ControlMask & mask_state);
|
||||
|
||||
}
|
||||
|
||||
@ -1133,7 +1133,7 @@ namespace detail
|
||||
brock.emit(event_code::key_release, msgwnd, arg, true, &context);
|
||||
}
|
||||
|
||||
if (context.platform.keychar < keyboard::os_arrow_left || keyboard::os_arrow_down < wParam)
|
||||
if (context.platform.keychar < keyboard::os_arrow_left || keyboard::os_arrow_down < context.platform.keychar)
|
||||
brock.delay_restore(2); //Restores while key release
|
||||
}
|
||||
else
|
||||
|
||||
@ -163,7 +163,7 @@ namespace nana
|
||||
btn_folder_.create(*this);
|
||||
btn_folder_.caption(STR("&New Folder"));
|
||||
|
||||
btn_folder_.events().click.connect_unignorable([this](const arg_mouse&)
|
||||
btn_folder_.events().click.connect_unignorable([this](const arg_click&)
|
||||
{
|
||||
form fm(this->handle(), API::make_center(*this, 300, 35));
|
||||
fm.caption(STR("Name the new folder"));
|
||||
@ -179,7 +179,7 @@ namespace nana
|
||||
button btn_cancel(fm, nana::rectangle(235, 5, 60, 25));
|
||||
btn_cancel.caption(STR("Cancel"));
|
||||
|
||||
btn_cancel.events().click.connect_unignorable([&fm](const arg_mouse&)
|
||||
btn_cancel.events().click.connect_unignorable([&fm](const arg_click&)
|
||||
{
|
||||
fm.close();
|
||||
});
|
||||
@ -288,14 +288,14 @@ namespace nana
|
||||
btn_ok_.create(*this);
|
||||
btn_ok_.caption(STR("&OK"));
|
||||
|
||||
btn_ok_.events().click.connect_unignorable([this](const arg_mouse&)
|
||||
btn_ok_.events().click.connect_unignorable([this](const arg_click&)
|
||||
{
|
||||
_m_ok();
|
||||
});
|
||||
btn_cancel_.create(*this);
|
||||
btn_cancel_.caption(STR("&Cancel"));
|
||||
|
||||
btn_cancel_.events().click.connect_unignorable([this](const arg_mouse&)
|
||||
btn_cancel_.events().click.connect_unignorable([this](const arg_click&)
|
||||
{
|
||||
API::close_window(handle());
|
||||
});
|
||||
|
||||
@ -48,7 +48,7 @@ namespace nana
|
||||
{
|
||||
graph.rectangle(rectangle{0, 0, graph.width(), graph.height() - 50}, true, colors::white);
|
||||
if(ico_.empty() == false)
|
||||
ico_.stretch(ico_.size(), graph, rectangle{12, 25, 32, 32});
|
||||
ico_.stretch(rectangle{ico_.size()}, graph, rectangle{12, 25, 32, 32});
|
||||
});
|
||||
|
||||
unsigned width_pixel = 45;
|
||||
@ -57,7 +57,7 @@ namespace nana
|
||||
place_.bind(*this);
|
||||
|
||||
yes_.create(*this);
|
||||
yes_.events().click.connect_unignorable([this](const arg_mouse& arg)
|
||||
yes_.events().click.connect_unignorable([this](const arg_click& arg)
|
||||
{
|
||||
_m_click(arg);
|
||||
});
|
||||
@ -69,7 +69,7 @@ namespace nana
|
||||
yes_.caption(STR("Yes"));
|
||||
no_.create(*this);
|
||||
no_.caption(STR("No"));
|
||||
no_.events().click.connect_unignorable([this](const arg_mouse& arg)
|
||||
no_.events().click.connect_unignorable([this](const arg_click& arg)
|
||||
{
|
||||
_m_click(arg);
|
||||
});
|
||||
@ -80,7 +80,7 @@ namespace nana
|
||||
{
|
||||
cancel_.create(*this);
|
||||
cancel_.caption(STR("Cancel"));
|
||||
cancel_.events().click.connect_unignorable([this](const arg_mouse& arg)
|
||||
cancel_.events().click.connect_unignorable([this](const arg_click& arg)
|
||||
{
|
||||
_m_click(arg);
|
||||
});
|
||||
@ -303,11 +303,11 @@ namespace nana
|
||||
nana::paint::pixel_buffer pxbuf(32, 32);
|
||||
pxbuf.put(reinterpret_cast<const unsigned char*>(rawpx), 32, 32, 32, 4*32, true);
|
||||
ico_.make({32, 32});
|
||||
pxbuf.paste(ico_.handle(), 0, 0);
|
||||
pxbuf.paste(ico_.handle(), {});
|
||||
}
|
||||
}
|
||||
|
||||
void _m_click(const arg_mouse& arg)
|
||||
void _m_click(const arg_click& arg)
|
||||
{
|
||||
if(arg.window_handle == yes_)
|
||||
pick_ = (no_.empty() ? msgbox::pick_ok : msgbox::pick_yes);
|
||||
|
||||
@ -114,7 +114,7 @@ namespace nana
|
||||
void load_monitors()
|
||||
{
|
||||
displays.clear();
|
||||
displays.emplace_back(0, primary_monitor_size());
|
||||
displays.emplace_back(0, rectangle{primary_monitor_size()});
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -165,13 +165,13 @@ namespace nana{
|
||||
return *this;
|
||||
}
|
||||
|
||||
group& group::collocate()
|
||||
group& group::collocate() throw ()
|
||||
{
|
||||
impl_->place_content.collocate();
|
||||
return *this;
|
||||
}
|
||||
|
||||
group& group::div(const char* div_str)
|
||||
group& group::div(const char* div_str) throw ()
|
||||
{
|
||||
if (div_str)
|
||||
impl_->usr_div_str = div_str;
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <nana/unicode_bidi.hpp>
|
||||
#include <numeric>
|
||||
#include <cwctype>
|
||||
#include <cstring>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@ -417,7 +417,7 @@ namespace nana{ namespace paint
|
||||
#elif defined(NANA_X11)
|
||||
try
|
||||
{
|
||||
storage_ = std::make_shared<pixel_buffer_storage>(drawable, sz);
|
||||
storage_ = std::make_shared<pixel_buffer_storage>(drawable, nana::rectangle{sz});
|
||||
storage_->detach();
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user