diff options
author | Thomas Jarosch <tomj@simonv.com> | 2011-10-21 18:51:19 +0000 |
---|---|---|
committer | Thomas Jarosch <tomj@simonv.com> | 2011-10-21 18:51:19 +0000 |
commit | eb97426c76a0716fbc26e0581ccaaad2426d5c04 (patch) | |
tree | 3ad3c2a4e0822a23f27bb55e6893717f826e177c /firmware/usbstack | |
parent | 04a015dde0f7edfe5ee913dc8cc6c1395dc9a419 (diff) |
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
Diffstat (limited to 'firmware/usbstack')
-rw-r--r-- | firmware/usbstack/usb_storage.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 8203ad4177..c5fa47fa51 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c @@ -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++; |