eliminate GCC warnings

This commit is contained in:
Jinhao 2016-06-21 04:37:05 +08:00
parent d0d5480a4c
commit 369d506fdd
5 changed files with 43 additions and 52 deletions

View File

@ -375,7 +375,8 @@ namespace nana
utf8_error_police_def_char( unsigned long mark): error_mark{mark}{} utf8_error_police_def_char( unsigned long mark): error_mark{mark}{}
unsigned long next_code_point(const unsigned char*& current_code_unit, const unsigned char* end) override unsigned long next_code_point(const unsigned char*& current_code_unit, const unsigned char* end) override
{ {
++current_code_unit; //check (p != end) ? if(current_code_unit < end)
++current_code_unit;
return error_mark; return error_mark;
} }
@ -399,7 +400,7 @@ namespace nana
struct utf8_error_police_latin : public encoding_error_police struct utf8_error_police_latin : public encoding_error_police
{ {
unsigned long next_code_point(const unsigned char*& current_code_unit, const unsigned char* end) override unsigned long next_code_point(const unsigned char*& current_code_unit, const unsigned char* /*end*/) override
{ {
return *(current_code_unit++) ; return *(current_code_unit++) ;
} }
@ -408,12 +409,11 @@ namespace nana
/// buggie? /// buggie?
struct utf8_error_police_system : public encoding_error_police struct utf8_error_police_system : public encoding_error_police
{ {
unsigned long next_code_point(const unsigned char*& current_code_unit, const unsigned char* end) override unsigned long next_code_point(const unsigned char*& current_code_unit, const unsigned char* /*end*/) override
{ {
std::wstring wc; std::wstring wc;
mb2wc(wc, reinterpret_cast<const char*>(current_code_unit)); mb2wc(wc, reinterpret_cast<const char*>(current_code_unit));
current_code_unit++; current_code_unit++;
//wchar_t *p = &wc[0];
return wc[0]; // use utf16char but what endian? return wc[0]; // use utf16char but what endian?
} }

View File

@ -156,6 +156,7 @@ namespace nana{
fn(); fn();
#else #else
static_cast<void>(native_handle);
fn(); fn();
#endif #endif
} }

View File

@ -71,6 +71,8 @@ namespace nana
::Shell_NotifyIcon(icon_added ? NIM_MODIFY : NIM_ADD, &icon_data); ::Shell_NotifyIcon(icon_added ? NIM_MODIFY : NIM_ADD, &icon_data);
icon_added = true; icon_added = true;
} }
#else
static_cast<void>(ico);
#endif #endif
} }
}; };

View File

@ -326,7 +326,7 @@ namespace nana
struct essence_t; struct essence_t;
struct item_t struct item_data
{ {
using container = std::vector<cell>; using container = std::vector<cell>;
@ -344,12 +344,12 @@ namespace nana
mutable std::unique_ptr<nana::any> anyobj; mutable std::unique_ptr<nana::any> anyobj;
item_t() item_data()
{ {
flags.selected = flags.checked = false; flags.selected = flags.checked = false;
} }
item_t(const item_t& r) item_data(const item_data& r)
: cells(r.cells), : cells(r.cells),
bgcolor(r.bgcolor), bgcolor(r.bgcolor),
fgcolor(r.fgcolor), fgcolor(r.fgcolor),
@ -358,27 +358,19 @@ namespace nana
anyobj(r.anyobj ? new nana::any(*r.anyobj) : nullptr) anyobj(r.anyobj ? new nana::any(*r.anyobj) : nullptr)
{} {}
item_t(container&& cont) item_data(container&& cont)
: cells(std::move(cont)) : cells(std::move(cont))
{ {
flags.selected = flags.checked = false; flags.selected = flags.checked = false;
} }
item_t(std::string&& s) item_data(std::string&& s)
{ {
flags.selected = flags.checked = false; flags.selected = flags.checked = false;
cells.emplace_back(std::move(s)); cells.emplace_back(std::move(s));
} }
item_t(std::string&& s, const nana::color& bg, const nana::color& fg) item_data& operator=(const item_data& r)
: bgcolor(bg),
fgcolor(fg)
{
flags.selected = flags.checked = false;
cells.emplace_back(std::move(s));
}
item_t& operator=(const item_t& r)
{ {
if (this != &r) if (this != &r)
{ {
@ -415,7 +407,7 @@ namespace nana
struct category_t struct category_t
{ {
using container = std::deque<item_t>; using container = std::deque<item_data>;
native_string_type text; native_string_type text;
std::vector<std::size_t> sorted; std::vector<std::size_t> sorted;
@ -495,7 +487,7 @@ namespace nana
visible_state(other.visible_state), visible_state(other.visible_state),
index(other.index), index(other.index),
alignment(other.alignment), alignment(other.alignment),
weak_ordering(weak_ordering), weak_ordering(std::move(other.weak_ordering)),
ess_(other.ess_) ess_(other.ess_)
{ {
} }
@ -590,16 +582,16 @@ namespace nana
using container = std::vector<column>; using container = std::vector<column>;
export_options::columns_indexs all_headers(bool only_visibles) const export_options::columns_indexs all_headers(bool only_visibles) const
{ {
export_options::columns_indexs idx; export_options::columns_indexs idx;
for(const auto &col : cont()) for(const auto &col : cont())
{ {
if(col.visible_state || !only_visibles) if(col.visible_state || !only_visibles)
idx.push_back(col.index); idx.push_back(col.index);
} }
return idx; return idx;
} }
std::string to_string(const export_options& exp_opt) const std::string to_string(const export_options& exp_opt) const
{ {
@ -801,7 +793,7 @@ namespace nana
return npos; return npos;
} }
/// Returns the left point position and width(in variable * pixels) of column originaly at position pos. /// Returns the left point position and width(in variable *pixels) of column originaly at position pos.
int position(size_type pos, unsigned * pixels) const int position(size_type pos, unsigned * pixels) const
{ {
int left = 0; int left = 0;
@ -1120,9 +1112,11 @@ namespace nana
catobj.sorted.push_back(n); catobj.sorted.push_back(n);
if (pos.item < n) if (pos.item < n)
catobj.items.emplace(catobj.items.begin() + pos.item, std::move(text)); catobj.items.emplace(catobj.items.begin() + pos.item);
else else
catobj.items.emplace_back(std::move(text)); catobj.items.emplace_back();
catobj.items.back().cells.emplace_back(std::move(text));
} }
/// convert from display order to absolute (find the real item in that display pos) but without check from current active sorting, in fact using just the last sorting !!! /// convert from display order to absolute (find the real item in that display pos) but without check from current active sorting, in fact using just the last sorting !!!
@ -1398,18 +1392,19 @@ namespace nana
if (enb) if (enb)
{ {
::nana::detail::key_interface * refkey = nullptr; ::nana::detail::key_interface * refkey = nullptr;
for (auto i = list_.begin(); i != list_.end(); ++i)
for (auto & cat : list_)
{ {
if (i->key_ptr) if (!cat.key_ptr)
continue;
if (refkey)
{ {
if (refkey) if (!cat.key_ptr->same_type(refkey))
{ return false;
if (!i->key_ptr->same_type(refkey))
return false;
}
else
refkey = i->key_ptr.get();
} }
else
refkey = cat.key_ptr.get();
} }
} }
@ -2964,7 +2959,7 @@ namespace nana
//grab_move //grab_move
/// @brief draw when an item is grabbing. /// @brief draw when an item is grabbing.
/// @return true if refresh is needed, false otherwise /// @return true if refresh is needed, false otherwise
bool grab_move(const nana::rectangle& rect, const nana::point& pos) bool grab_move(const nana::point& pos)
{ {
if(npos == grabs_.splitter) if(npos == grabs_.splitter)
{ // move column, not resize it { // move column, not resize it
@ -3016,9 +3011,6 @@ namespace nana
if ((parts::header == essence_->pointer_where.first) && (npos == grabs_.splitter)) if ((parts::header == essence_->pointer_where.first) && (npos == grabs_.splitter))
state = essence_->ptr_state; state = essence_->ptr_state;
const unsigned height = r.height - 1;
const int bottom_y = r.bottom() - 2;
rectangle column_r{ rectangle column_r{
r.x - static_cast<int>(essence_->scroll.x_offset()), r.y, r.x - static_cast<int>(essence_->scroll.x_offset()), r.y,
0, r.height - 1 0, r.height - 1
@ -3036,7 +3028,7 @@ namespace nana
if (right_pos > r.x) if (right_pos > r.x)
{ {
_m_draw_header_item(graph, column_r, text_top, text_color, col, (col.index == essence_->pointer_where.second ? state : item_state::normal)); _m_draw_header_item(graph, column_r, text_top, text_color, col, (col.index == essence_->pointer_where.second ? state : item_state::normal));
graph.line({ right_pos - 1, r.y }, { right_pos - 1, bottom_y }, _m_border_color()); graph.line({ right_pos - 1, r.y }, { right_pos - 1, r.bottom() - 2 }, _m_border_color());
} }
column_r.x = right_pos; column_r.x = right_pos;
@ -3163,7 +3155,7 @@ namespace nana
struct grab_variables struct grab_variables
{ {
int start_pos{ npos }; int start_pos;
unsigned item_width; unsigned item_width;
size_type splitter{ npos }; size_type splitter{ npos };
@ -3440,7 +3432,7 @@ namespace nana
bool draw_column = true; bool draw_column = true;
if ( content_pos + essence_->scheme_ptr->text_margin < static_cast<int>(col.width_px)) // we have room if ( content_pos + essence_->scheme_ptr->text_margin < col.width_px) // we have room
{ {
auto inline_wdg = _m_get_inline_pane(cat, column_pos); auto inline_wdg = _m_get_inline_pane(cat, column_pos);
if (inline_wdg) if (inline_wdg)
@ -3503,7 +3495,6 @@ namespace nana
auto cell_txtcolor = fgcolor; auto cell_txtcolor = fgcolor;
auto & m_cell = item.cells[column_pos]; auto & m_cell = item.cells[column_pos];
review_utf8(m_cell.text); review_utf8(m_cell.text);
nana::size ts = graph->text_extent_size(m_cell.text); // precalcule text geometry
if (m_cell.custom_format && (!m_cell.custom_format->bgcolor.invisible())) // adapt to costum format if need if (m_cell.custom_format && (!m_cell.custom_format->bgcolor.invisible())) // adapt to costum format if need
{ {
@ -3699,10 +3690,7 @@ namespace nana
{ // moving a grabbed header { // moving a grabbed header
nana::point pos = arg.pos; nana::point pos = arg.pos;
essence_->widget_to_header(pos); essence_->widget_to_header(pos);
need_refresh = drawer_header_->grab_move(pos);
nana::rectangle r;
essence_->rect_header(r);
need_refresh = drawer_header_->grab_move(r, pos);
} }
else if(essence_->calc_where(arg.pos)) else if(essence_->calc_where(arg.pos))
{ {

View File

@ -17,7 +17,7 @@ namespace nana
: public renderer_interface : public renderer_interface
{ {
private: private:
void background(window wd, graph_reference graph, bool transparent, const scheme& schm) override void background(window, graph_reference graph, bool transparent, const scheme& schm) override
{ {
if (!transparent) if (!transparent)
graph.rectangle(true, schm.background); graph.rectangle(true, schm.background);
@ -277,7 +277,7 @@ namespace nana
return other_.wd; return other_.wd;
} }
void attached(nana::slider& wdg, graph_reference graph) void attached(nana::slider& wdg, graph_reference)
{ {
other_.wd = wdg.handle(); other_.wd = wdg.handle();
other_.widget = &wdg; other_.widget = &wdg;