From b2c2738f09e9f3385616830bdab623c1d59b83b2 Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Fri, 1 Oct 2004 19:19:09 +0000 Subject: test code portable now git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5145 a1c6a512-1295-4272-9138-f99709370657 --- firmware/test/fat/ata-sim.c | 2 +- firmware/test/fat/main.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/firmware/test/fat/ata-sim.c b/firmware/test/fat/ata-sim.c index aac7fba0f4..cc3eb15209 100644 --- a/firmware/test/fat/ata-sim.c +++ b/firmware/test/fat/ata-sim.c @@ -56,7 +56,7 @@ int ata_init(char* filename) if (!filename) filename = "disk.img"; /* check disk size */ - file=fopen(filename,"r+"); + file=fopen(filename,"rb+"); if(!file) { fprintf(stderr, "read_disk() - Could not find \"%s\"\n",filename); return -1; diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c index fd43558c38..5607414bcb 100644 --- a/firmware/test/fat/main.c +++ b/firmware/test/fat/main.c @@ -3,7 +3,6 @@ #include #include #include -#include #include "fat.h" #include "debug.h" #include "disk.h" @@ -266,7 +265,7 @@ int dbg_wrtest(char* name) void dbg_type(char* name) { const int size = SECTOR_SIZE*5; - unsigned char buf[size+1]; + unsigned char buf[SECTOR_SIZE*5+1]; int fd,rc; fd = open(name,O_RDONLY); @@ -658,10 +657,8 @@ int main(int argc, char *argv[]) { int rc,i; struct partinfo* pinfo; - struct timeval tv; - gettimeofday(&tv, NULL); - srand(tv.tv_usec); + srand(clock()); if(ata_init("disk.img")) { DEBUGF("*** Warning! The disk is uninitialized\n"); @@ -674,7 +671,11 @@ int main(int argc, char *argv[]) } for ( i=0; i<4; i++ ) { - if ( pinfo[i].type == PARTITION_TYPE_FAT32 ) { + if ( pinfo[i].type == PARTITION_TYPE_FAT32 +#ifdef HAVE_FAT16SUPPORT + || pinfo[i].type == PARTITION_TYPE_FAT16 +#endif + ) { DEBUGF("*** Mounting at block %ld\n",pinfo[i].start); rc = fat_mount(pinfo[i].start); if(rc) { -- cgit v1.2.3