1
0
Fork 0
forked from len0rd/rockbox

Fix SCSI inquiry on W32.

W32 returns additional bytes containing garbage on pages returning the maximum amount (i.e. 255) of bytes. Ignoring those bytes makes the output being correct. Someone needs to find out why those additional bytes are indicated at all.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22199 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2009-08-07 22:58:20 +00:00
parent 8b77ce2d61
commit 059255705b

View file

@ -110,7 +110,10 @@ int ipod_scsi_inquiry(struct ipod_t* ipod, int page_code,
FALSE);
if (status) {
memcpy(buf, sptwb.DataBuf, returned);
/* W32 sometimes returns more bytes with additional garbage.
* Make sure to not copy that garbage. */
memcpy(buf, sptwb.DataBuf,
(DWORD)bufsize >= returned ? returned : (DWORD)bufsize);
return 0;
} else {
return -1;