Use array index 'i' only -after- bounds check

Reported by cppcheck

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30815 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Jarosch 2011-10-21 18:51:19 +00:00
parent 04a015dde0
commit eb97426c76

View file

@ -343,7 +343,7 @@ static void yearday_to_daymonth(int yd, int y, int *d, int *m)
t=tnl;
}
while(yd >= t[i] && i<12)
while(i<12 && yd >= t[i])
{
yd-=t[i];
i++;
@ -1233,7 +1233,7 @@ static void send_csw(int status)
static void copy_padded(char *dest, char *src, int len)
{
int i=0;
while(src[i]!=0 && i<len)
while(i<len && src[i]!=0)
{
dest[i]=src[i];
i++;