signedness fix

This commit is contained in:
simonb 2006-04-15 16:46:37 +00:00
parent 7c79084433
commit 02aa83a59e
2 changed files with 4 additions and 2 deletions

View file

@ -1,6 +1,8 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 0.9.16: Changes for 0.9.16:
*06/04/16: *06/04/16:
* signedness fix in Container moveItem (thanks _markt)
Container.cc
* Vertical toolbar (Simon) * Vertical toolbar (Simon)
Toolbar.cc ToolbarItem.hh/cc IconbarTool.hh/cc IconButton.hh/cc Toolbar.cc ToolbarItem.hh/cc IconbarTool.hh/cc IconButton.hh/cc
ClockTool.hh/cc ButtonTool.cc WorkspaceNameTool.hh/cc Container.cc ClockTool.hh/cc ButtonTool.cc WorkspaceNameTool.hh/cc Container.cc

View file

@ -129,11 +129,11 @@ void Container::moveItem(Item item, int movement) {
int index = find(item); int index = find(item);
const size_t size = m_item_list.size(); const size_t size = m_item_list.size();
if (index < 0 || (movement % size) == 0) { if (index < 0 || (movement % static_cast<signed>(size)) == 0) {
return; return;
} }
int newindex = (index + movement) % size; int newindex = (index + movement) % static_cast<signed>(size);
if (newindex < 0) // neg wrap if (newindex < 0) // neg wrap
newindex += size; newindex += size;