summaryrefslogtreecommitdiff
path: root/utils/imxtools/scsitools/stmp_scsi.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-01-05 16:21:55 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2017-01-07 15:52:33 +0100
commit456a3fc952d34a3e8781ca100851e6253c537109 (patch)
tree8406a3e38eb8a399a0bb155314be0ddc2d31e5a1 /utils/imxtools/scsitools/stmp_scsi.c
parent950f4bdc027cb8c83fd2145590549fdcf5522078 (diff)
downloadrockbox-456a3fc952d34a3e8781ca100851e6253c537109.tar.gz
rockbox-456a3fc952d34a3e8781ca100851e6253c537109.zip
imxtools: various fixes for Windows
Don't use colors since the terminal doesn't support it. Also packing is broken on MinGW so use #pragma pack when compiling for windows, this is also supported by MSCV. Change-Id: I635649d52ed5f2e0af46cb9ca2ec325955b2ddb2
Diffstat (limited to 'utils/imxtools/scsitools/stmp_scsi.c')
-rw-r--r--utils/imxtools/scsitools/stmp_scsi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/utils/imxtools/scsitools/stmp_scsi.c b/utils/imxtools/scsitools/stmp_scsi.c
index e1d0dc4c77..8daeb8a532 100644
--- a/utils/imxtools/scsitools/stmp_scsi.c
+++ b/utils/imxtools/scsitools/stmp_scsi.c
@@ -245,14 +245,22 @@ int stmp_get_logical_media_table(stmp_device_t dev, struct stmp_logical_media_ta
245 int len = sizeof(header); 245 int len = sizeof(header);
246 int ret = stmp_scsi_get_logical_table(dev, 0, &header, &len); 246 int ret = stmp_scsi_get_logical_table(dev, 0, &header, &len);
247 if(ret || len != sizeof(header)) 247 if(ret || len != sizeof(header))
248 {
249 stmp_debugf(dev, "Device returned the wrong size for logical media header: "
250 "%d bytes but expected %d\n", len, sizeof(header));
248 return -1; 251 return -1;
252 }
249 header.count = stmp_fix_endian16be(header.count); 253 header.count = stmp_fix_endian16be(header.count);
250 int sz = sizeof(header) + header.count * sizeof(struct scsi_stmp_logical_table_entry_t); 254 int sz = sizeof(header) + header.count * sizeof(struct scsi_stmp_logical_table_entry_t);
251 len = sz; 255 len = sz;
252 *table = malloc(sz); 256 *table = malloc(sz);
253 ret = stmp_scsi_get_logical_table(dev, header.count, &(*table)->header, &len); 257 ret = stmp_scsi_get_logical_table(dev, header.count, &(*table)->header, &len);
254 if(ret || len != sz) 258 if(ret || len != sz)
259 {
260 stmp_debugf(dev, "Device returned the wrong size for logical media table: "
261 "%d bytes but expected %d (%d entries)\n", len, sz, header.count);
255 return -1; 262 return -1;
263 }
256 (*table)->header.count = stmp_fix_endian16be((*table)->header.count); 264 (*table)->header.count = stmp_fix_endian16be((*table)->header.count);
257 for(unsigned i = 0; i < (*table)->header.count; i++) 265 for(unsigned i = 0; i < (*table)->header.count; i++)
258 (*table)->entry[i].size = stmp_fix_endian64be((*table)->entry[i].size); 266 (*table)->entry[i].size = stmp_fix_endian64be((*table)->entry[i].size);