diff --git a/src/asfont.cpp b/src/asfont.cpp index 401bd12..b13da9e 100644 --- a/src/asfont.cpp +++ b/src/asfont.cpp @@ -3,6 +3,7 @@ #include "surface.h" #include "utilities.h" +#include #include #include @@ -115,7 +116,7 @@ int ASFont::getTextWidth(const char *text) { while (char ch = *text++) { if (ch == '\n') { // New line. - maxWidth = max(width, maxWidth); + maxWidth = std::max(width, maxWidth); width = 0; } else { std::string::size_type pos; @@ -133,7 +134,7 @@ int ASFont::getTextWidth(const char *text) { width += charpos[pos * 2 + 2] - charpos[pos * 2 + 1]; } } - return max(width, maxWidth); + return std::max(width, maxWidth); } int ASFont::getTextWidth(const std::string& text) { diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 4e4401c..6ee4d88 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -1541,7 +1541,8 @@ void GMenu2X::contextMenu() { } bool close = false; - uint i, sel=0, fadeAlpha=0; + uint i, fadeAlpha=0; + int sel = 0; int h = font->getHeight(); SDL_Rect box; @@ -1624,10 +1625,10 @@ void GMenu2X::contextMenu() { close = true; break; case InputManager::UP: - sel = max(0, sel-1); + sel = std::max(0, sel-1); break; case InputManager::DOWN: - sel = min((int)voices.size()-1, sel+1); + sel = std::min((int)voices.size()-1, sel+1); break; case InputManager::ACCEPT: voices[sel].action(); diff --git a/src/selector.cpp b/src/selector.cpp index 5c0a82b..1b82b03 100644 --- a/src/selector.cpp +++ b/src/selector.cpp @@ -20,6 +20,7 @@ #include #include +#include //for browsing the filesystem #include @@ -102,8 +103,11 @@ int Selector::exec(int startSelection) { //Screenshot if (selected-fl.dirCount()200) - gmenu2x->sc[screens[selected-fl.dirCount()]]->blitRight(gmenu2x->s, 311, 42, 160, 160, min((curTick-selTick-200)/3,255)); + if (curTick - selTick > 200) { + gmenu2x->sc[screens[selected-fl.dirCount()]]->blitRight( + gmenu2x->s, 311, 42, 160, 160, + min((curTick - selTick - 200) / 3, 255u)); + } } //Files & Dirs diff --git a/src/textdialog.cpp b/src/textdialog.cpp index 02fb921..118f5a2 100644 --- a/src/textdialog.cpp +++ b/src/textdialog.cpp @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2006 by Massimiliano Torromeo * - * massimiliano.torromeo@gmail.com * + * Copyright (C) 2006 by Massimiliano Torromeo * + * massimiliano.torromeo@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -138,7 +138,7 @@ void TextDialog::exec() { if (firstRow + rowsPerPage*2 -1 < text->size()) { firstRow += rowsPerPage-1; } else { - firstRow = max(0, text->size() - rowsPerPage); + firstRow = max(0u, text->size() - rowsPerPage); } break; case InputManager::SETTINGS: diff --git a/src/textmanualdialog.cpp b/src/textmanualdialog.cpp index 23b8e56..44ad763 100644 --- a/src/textmanualdialog.cpp +++ b/src/textmanualdialog.cpp @@ -22,6 +22,7 @@ #include "gmenu2x.h" +#include #include using namespace std; @@ -131,7 +132,7 @@ void TextManualDialog::exec() { break; case InputManager::ALTRIGHT: if (firstRow + rowsPerPage*2 -1 < pages[page].text.size()) firstRow += rowsPerPage-1; - else firstRow = max(0, pages[page].text.size() - rowsPerPage); + else firstRow = max(0u, pages[page].text.size() - rowsPerPage); break; case InputManager::CANCEL: case InputManager::SETTINGS: diff --git a/src/utilities.cpp b/src/utilities.cpp index 770b788..a69f093 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -23,6 +23,7 @@ #include "debug.h" #include +#include //for browsing the filesystem #include @@ -86,14 +87,8 @@ bool rmtree(string path) { return rmdir(path.c_str())==0; } -int max (int a, int b) { - return a>b ? a : b; -} -int min (int a, int b) { - return a