summaryrefslogtreecommitdiffstats
path: root/firmware/usbstack
diff options
context:
space:
mode:
authorRafaël Carré <funman@videolan.org>2012-05-07 01:19:15 -0400
committerRafaël Carré <funman@videolan.org>2012-05-07 01:19:15 -0400
commit803408f18657bcd501737ad29e98a1b4cca0ec37 (patch)
treeb936c2c419dde68598b3556158e77f7a92509e87 /firmware/usbstack
parent7ca20810367d9a1b211f242d1b1183dbedeeda68 (diff)
downloadrockbox-803408f18657bcd501737ad29e98a1b4cca0ec37.tar.gz
rockbox-803408f18657bcd501737ad29e98a1b4cca0ec37.tar.bz2
rockbox-803408f18657bcd501737ad29e98a1b4cca0ec37.zip
simplify copy_padded
Diffstat (limited to 'firmware/usbstack')
-rw-r--r--firmware/usbstack/usb_storage.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index 211bf474f9..2da3e85a34 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -1228,17 +1228,13 @@ static void send_csw(int status)
static void copy_padded(char *dest, char *src, int len)
{
- int i=0;
- while(i<len && src[i]!=0)
- {
- dest[i]=src[i];
- i++;
- }
- while(i<len)
- {
- dest[i]=' ';
- i++;
- }
+ for (int i = 0; i < len; i++) {
+ if (src[i] != 0) {
+ memset(&dest[i], ' ', len - i);
+ return;
+ }
+ dest[i] = src[i];
+ }
}
/* build SCSI INQUIRY */