diff sd.c @ 56:f0563086040d

Fix more warnings. Note the 'buf might be used uninitialised' warning appears to be a GCC bug.
author Daniel O'Connor <darius@dons.net.au>
date Sun, 07 Apr 2013 22:44:23 +0930
parents b21db2b47a27
children 488085e0c7e1
line wrap: on
line diff
--- a/sd.c	Sun Apr 07 22:34:05 2013 +0930
+++ b/sd.c	Sun Apr 07 22:44:23 2013 +0930
@@ -98,14 +98,13 @@
     } else if (!strcmp(argv[0], "rdb")) {
 	uint32_t addr;
 	uint8_t *buf;
-	uint32_t i;
 	
 	if (argc != 2) {
 	    printf("Block to read not specified\n");
 	    return;
 	}
 	addr = atoi(argv[1]);
-
+	
 	if ((buf = malloc(SD_BLOCK_SIZE)) == NULL) {
 	    printf("Unable to allocate buffer\n");
 	    return;
@@ -133,7 +132,7 @@
     } else if (!strcmp(argv[0], "wrb")) {
 	uint32_t addr;
 	uint8_t *buf;
-	uint32_t i;
+	int32_t i;
 	
 	if (argc < 3) {
 	    printf("Block to read and/or fill value(s) not specified\n");
@@ -210,7 +209,7 @@
 	if ((fserr = f_getlabel("", label, &sn)) != FR_OK) {
 	    printf("Unable to read label: %d\n", fserr);
 	} else {
-	    printf("Label: %s Serial: %d\n", label, sn);
+	    printf("Label: %s Serial: %ld\n", label, sn);
 	}
 	
 	if ((fserr = f_opendir(&d, argc == 1 ? "\\" : argv[1])) != FR_OK) {
@@ -231,7 +230,7 @@
 #else
             fn = fno.fname;
 #endif
-	    printf("%-12s %5u %d/%d/%d %02d:%02d:%02d %s%s%s%s%s\n", fn, fno.fsize,
+	    printf("%-12s %5lu %d/%d/%d %02d:%02d:%02d %s%s%s%s%s\n", fn, fno.fsize,
 		   FAT_YEAR(fno.fdate), FAT_MONTH(fno.fdate), FAT_DAY(fno.fdate),
 		   FAT_HOUR(fno.ftime), FAT_MIN(fno.ftime), FAT_SEC(fno.ftime),
 		   fno.fattrib & AM_DIR ? "D" : "", fno.fattrib & AM_RDO ? "R" : "",