fix some compiler errors and warnings

This commit is contained in:
Jinhao 2016-10-31 06:36:03 +08:00
parent b1ce0eaff2
commit 043ebad317
2 changed files with 69 additions and 70 deletions

View File

@ -1117,9 +1117,9 @@ namespace nana
delete impl_;
}
auto menu::append(std::string text_utf8, const menu::event_fn_t& f) -> item_proxy
auto menu::append(std::string text_utf8, const menu::event_fn_t& callback) -> item_proxy
{
impl_->mbuilder.data().items.emplace_back(new item_type(std::move(text_utf8, callback));
impl_->mbuilder.data().items.emplace_back(new item_type(std::move(text_utf8), callback));
return item_proxy(size() - 1, *impl_->mbuilder.data().items.back());
}
@ -1159,7 +1159,7 @@ namespace nana
void menu::text(std::size_t index, std::string text_utf8)
{
impl_->mbuilder.data().items.at(index).text.swap(text_utf8);
impl_->mbuilder.data().items.at(index)->text.swap(text_utf8);
}
bool menu::link(std::size_t index, menu& menu_obj)

View File

@ -235,15 +235,14 @@ public:
if (!file.is_open()) return false;
// allocates a buffer for the image
std::streampos size = 0;
file.seekg(0, std::ios::end);
size = file.tellg() - size;
const auto bytes = static_cast<std::size_t>(file.tellg());
file.seekg(0, std::ios::beg);
auto buffer = new char[size];
auto buffer = new char[bytes];
// read data from the file and set them in the buffer
file.read(buffer, size);
auto okret = _m_read_ico(buffer, size);
file.read(buffer, bytes);
auto okret = _m_read_ico(buffer, bytes);
// delete buffer and return
delete[] buffer;