From 5ce726f180b84af771159cbe0f664141c8d4ac43 Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 16 Mar 2012 13:19:29 +0000 Subject: [PATCH] Fixed some compiler warnings picked up by Xcode 4.3 git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2417 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/debugger/DiStella.cxx | 2 +- src/debugger/gui/DataGridWidget.cxx | 2 +- src/emucore/Console.cxx | 11 +++++------ src/emucore/TIASnd.cxx | 2 +- src/emucore/unzip.c | 2 +- src/gui/EditTextWidget.cxx | 2 +- src/gui/EditTextWidget.hxx | 2 +- src/gui/EditableWidget.cxx | 2 +- src/gui/EditableWidget.hxx | 2 +- 9 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index 7e6fcee9a..554590327 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -818,7 +818,7 @@ int DiStella::mark(uInt32 address, uInt8 mask, bool directive) if(directive) myDirectives[address-myOffset] = mask; return 1; } - else if (address >= 0 && address <= 0x3f) + else if (address <= 0x3f) { return 2; } diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index 6b6876c86..4c292b5a7 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -637,7 +637,7 @@ void DataGridWidget::startEditMode() if (_editable && !_editMode && _selectedItem >= 0) { _editMode = true; - setEditString(""); // Erase current entry when starting editing + setEditString("", true ); // Erase current entry when starting editing } } diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index fbfa8689b..1ffdbf660 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -150,8 +150,7 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props) // TODO - query these values directly from the TIA if value is 'AUTO' uInt32 ystart = atoi(myProperties.get(Display_YStart).c_str()); - if(ystart < 0) ystart = 0; - else if(ystart > 64) ystart = 64; + if(ystart > 64) ystart = 64; uInt32 height = atoi(myProperties.get(Display_Height).c_str()); if(height < 210) height = 210; else if(height > 256) height = 256; @@ -537,21 +536,21 @@ void Console::changeYStart(int direction) if(direction == +1) // increase YStart { - ystart++; - if(ystart > 64) + if(ystart >= 64) { myOSystem->frameBuffer().showMessage("YStart at maximum"); return; } + ystart++; } else if(direction == -1) // decrease YStart { - ystart--; - if(ystart < 0) + if(ystart == 0) { myOSystem->frameBuffer().showMessage("YStart at minimum"); return; } + ystart--; } else return; diff --git a/src/emucore/TIASnd.cxx b/src/emucore/TIASnd.cxx index a516d6f84..ccb6b7403 100644 --- a/src/emucore/TIASnd.cxx +++ b/src/emucore/TIASnd.cxx @@ -149,7 +149,7 @@ uInt8 TIASound::get(uInt16 address) const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIASound::volume(uInt32 percent) { - if((percent >= 0) && (percent <= 100)) + if(percent <= 100) myVolumePercentage = percent; } diff --git a/src/emucore/unzip.c b/src/emucore/unzip.c index a31730ee2..405191d43 100644 --- a/src/emucore/unzip.c +++ b/src/emucore/unzip.c @@ -992,7 +992,7 @@ extern int ZEXPORT unzReadCurrentFile return UNZ_PARAMERROR; - if ((pfile_in_zip_read_info->read_buffer == NULL)) + if (pfile_in_zip_read_info->read_buffer == NULL) return UNZ_END_OF_LIST_OF_FILE; if (len==0) return 0; diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx index 26b7540f5..1f5d88456 100644 --- a/src/gui/EditTextWidget.cxx +++ b/src/gui/EditTextWidget.cxx @@ -44,7 +44,7 @@ EditTextWidget::EditTextWidget(GuiObject* boss, const GUI::Font& font, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EditTextWidget::setEditString(const string& str, bool changed) { - EditableWidget::setEditString(str); + EditableWidget::setEditString(str, changed); _backupString = str; _changed = changed; } diff --git a/src/gui/EditTextWidget.hxx b/src/gui/EditTextWidget.hxx index a2a0f5e1c..1c8484e93 100644 --- a/src/gui/EditTextWidget.hxx +++ b/src/gui/EditTextWidget.hxx @@ -36,7 +36,7 @@ class EditTextWidget : public EditableWidget void setEditString(const string& str, bool changed = false); - virtual void handleMouseDown(int x, int y, int button, int clickCount); + void handleMouseDown(int x, int y, int button, int clickCount); protected: void drawWidget(bool hilite); diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index bca059981..21a1d8774 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -51,7 +51,7 @@ EditableWidget::~EditableWidget() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EditableWidget::setEditString(const string& str) +void EditableWidget::setEditString(const string& str, bool) { // TODO: We probably should filter the input string here, // e.g. using tryInsertChar. diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx index bbb6bf470..d2cae8beb 100644 --- a/src/gui/EditableWidget.hxx +++ b/src/gui/EditableWidget.hxx @@ -43,7 +43,7 @@ class EditableWidget : public Widget, public CommandSender int x, int y, int w, int h); virtual ~EditableWidget(); - virtual void setEditString(const string& str); + virtual void setEditString(const string& str, bool changed = false); virtual const string& getEditString() const { return _editString; } bool isEditable() const { return _editable; }