Skip to content

Commit

Permalink
Fix off-by-one errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Hill committed Sep 6, 2012
1 parent 6e6790a commit fcf21ea
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion xbmc/cores/AudioEngine/Utils/AEStreamInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ unsigned int CAEStreamInfo::SyncAC3(uint8_t *data, unsigned int size)
else
lfeon = ((data[6] >> pos) & 0x1) ? 1 : 0;

if (bsid > 0x11 || acmod > 8)
if (bsid > 0x11 || acmod > 7)
continue;

if (bsid <= 10)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/input/TouchInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ bool CTouchInput::Handle(TouchEvent event, float x, float y, int64_t time, int32

bool CTouchInput::Update(int32_t pointer, float x, float y, int64_t time, float size /* = 0.0f */)
{
if (pointer < 0 || pointer > TOUCH_MAX_POINTERS)
if (pointer < 0 || pointer >= TOUCH_MAX_POINTERS)
return false;

CSingleLock lock(m_critical);
Expand Down
2 changes: 1 addition & 1 deletion xbmc/music/karaoke/karaokelyricstext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ CKaraokeLyricsText::CKaraokeLyricsText()
m_karaokeFont = 0;

int coloridx = g_guiSettings.GetInt("karaoke.fontcolors");
if ( coloridx < KARAOKE_COLOR_START || coloridx > KARAOKE_COLOR_END )
if ( coloridx < KARAOKE_COLOR_START || coloridx >= KARAOKE_COLOR_END )
coloridx = 0;

m_colorLyrics = gLyricColors[coloridx].text;
Expand Down
6 changes: 4 additions & 2 deletions xbmc/pictures/SlideShowPicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,12 @@ void CSlideShowPic::Process(unsigned int currentTime, CDirtyRegionList &dirtyreg
int i;
for (i = 0; i < 10; i++)
{
if (fabs(m_fZoomAmount - zoomamount[i]) < 0.01 * zoomamount[i])
if (fabs(m_fZoomAmount - zoomamount[i]) < 0.01*zoomamount[i])
{
m_fZoomAmount = zoomamount[i];
break;
}
}
m_fZoomAmount = zoomamount[i];
m_bNoEffect = (m_fZoomAmount != 1.0f); // turn effect rendering back on.
}
/* not really needed anymore as we support arbitrary rotations
Expand Down
4 changes: 2 additions & 2 deletions xbmc/windows/GUIWindowFileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ bool CGUIWindowFileManager::Update(int iList, const CStdString &strDirectory)

void CGUIWindowFileManager::OnClick(int iList, int iItem)
{
if ( iList < 0 || iList > 2) return ;
if ( iList < 0 || iList >= 2) return ;
if ( iItem < 0 || iItem >= m_vecItems[iList]->Size() ) return ;

CFileItemPtr pItem = m_vecItems[iList]->Get(iItem);
Expand Down Expand Up @@ -964,7 +964,7 @@ int CGUIWindowFileManager::GetFocusedList() const

void CGUIWindowFileManager::OnPopupMenu(int list, int item, bool bContextDriven /* = true */)
{
if (list < 0 || list > 2) return ;
if (list < 0 || list >= 2) return ;
bool bDeselect = SelectItem(list, item);
// calculate the position for our menu
float posX = 200;
Expand Down

0 comments on commit fcf21ea

Please sign in to comment.