From 696bfc0817797e76888454a29d94317f9e273f4c Mon Sep 17 00:00:00 2001
From: Claus <claus@protovision.games>
Date: Mon, 14 Jan 2019 18:56:31 +0100
Subject: [PATCH 02/36] Tabs to spaces.
---
cc1541.c | 38 +++++++++++++--------------
test_cc1541/test_cc1541.c | 54 +++++++++++++++++++--------------------
2 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/cc1541.c b/cc1541.c
index 1e45275..9cd5d68 100644
--- a/cc1541.c
+++ b/cc1541.c
@@ -126,7 +126,7 @@ usage()
printf("-l filename Write loop file (an additional dir entry) to existing file to\n");
printf(" disk, set filename with -f.\n");
printf("-B numblocks Write the given value as file size in blocks to the directory for\n");
- printf(" the next file.\n");
+ printf(" the next file.\n");
printf("-x Don't split files over dirtrack hole (default split files).\n");
printf("-t Use dirtrack to also store files (makes -x useless) (default no).\n");
printf("-d track Maintain a shadow directory (copy of the actual directory).\n");
@@ -578,7 +578,7 @@ find_file(image_type type, unsigned char* image, char* filename, unsigned char *
if (dirstrcmp((char *) image + dirblock + entryOffset + FILENAMEOFFSET, filename) == 0) {
*track = image[dirblock + entryOffset + FILETRACKOFFSET];
*sector = image[dirblock + entryOffset + FILESECTOROFFSET];
- *numblocks = image[dirblock + entryOffset + FILEBLOCKSLOOFFSET] + 256*image[dirblock + entryOffset + FILEBLOCKSHIOFFSET];
+ *numblocks = image[dirblock + entryOffset + FILEBLOCKSLOOFFSET] + 256*image[dirblock + entryOffset + FILEBLOCKSHIOFFSET];
return direntryindex;
}
break;
@@ -865,9 +865,9 @@ write_files(image_type type, unsigned char* image, imagefile* files, int num_fil
image[entryOffset + FILETRACKOFFSET] = file->track;
image[entryOffset + FILESECTOROFFSET] = file->sector;
- if (file->nrSectorsShown == -1) {
- file->nrSectorsShown = file->nrSectors;
- }
+ if (file->nrSectorsShown == -1) {
+ file->nrSectorsShown = file->nrSectors;
+ }
image[entryOffset + FILEBLOCKSLOOFFSET] = file->nrSectorsShown % 256;
image[entryOffset + FILEBLOCKSHIOFFSET] = file->nrSectorsShown / 256;
@@ -1161,9 +1161,9 @@ write_files(image_type type, unsigned char* image, imagefile* files, int num_fil
image[entryOffset + FILETRACKOFFSET] = file->track;
image[entryOffset + FILESECTOROFFSET] = file->sector;
- if (file->nrSectorsShown < 0) {
- file->nrSectorsShown = file->nrSectors;
- }
+ if (file->nrSectorsShown < 0) {
+ file->nrSectorsShown = file->nrSectors;
+ }
image[entryOffset + FILEBLOCKSLOOFFSET] = file->nrSectorsShown & 255;
image[entryOffset + FILEBLOCKSHIOFFSET] = file->nrSectorsShown >> 8;
@@ -1478,7 +1478,7 @@ main(int argc, char* argv[])
files[nrFiles].sectorInterleave = sectorInterleave ? sectorInterleave : defaultSectorInterleave;
files[nrFiles].first_sector_new_track = first_sector_new_track;
files[nrFiles].nrSectors = 0;
- files[nrFiles].nrSectorsShown = nrSectorsShown;
+ files[nrFiles].nrSectorsShown = nrSectorsShown;
nrFiles++;
} else {
fprintf(stderr, "File '%s' (%d) not found\n", argv[j + 1], nrFiles + 1);
@@ -1504,16 +1504,16 @@ main(int argc, char* argv[])
printf("Error parsing argument for -u\n");
return -1;
}
- } else if (strcmp(argv[j], "-B") == 0) {
- if ((argc < j + 2) || !sscanf(argv[++j], "%d", &nrSectorsShown)) {
- printf("Error parsing argument for -B\n");
- return -1;
- }
- if (nrSectorsShown < 0 || nrSectorsShown > 65535) {
- printf("Argument must be between 0 and 65535 for -B\n");
- return -1;
- }
- } else if (strcmp(argv[j], "-4") == 0) {
+ } else if (strcmp(argv[j], "-B") == 0) {
+ if ((argc < j + 2) || !sscanf(argv[++j], "%d", &nrSectorsShown)) {
+ printf("Error parsing argument for -B\n");
+ return -1;
+ }
+ if (nrSectorsShown < 0 || nrSectorsShown > 65535) {
+ printf("Argument must be between 0 and 65535 for -B\n");
+ return -1;
+ }
+ } else if (strcmp(argv[j], "-4") == 0) {
type = IMAGE_D64_EXTENDED_SPEED_DOS;
} else if (strcmp(argv[j], "-5") == 0) {
type = IMAGE_D64_EXTENDED_DOLPHIN_DOS;
diff --git a/test_cc1541/test_cc1541.c b/test_cc1541/test_cc1541.c
index f541add..8941110 100644
--- a/test_cc1541/test_cc1541.c
+++ b/test_cc1541/test_cc1541.c
@@ -557,33 +557,33 @@ main(int argc, char* argv[]) {
remove("1.prg");
remove("2.prg");
- description = "File should have DIR block size 0 for -B";
- test++;
- create_value_file("1.prg", 3 * 254, 1);
- if (run_binary_cleanup(binary, "-B 0 -w 1.prg", "image.d64", &image, &size) != NO_ERROR) {
- printf("UNRESOLVED: %s\n", description);
- }
- else if (image[track_offset[17] + 256 + 30] == 0 && image[track_offset[17] + 256 + 31] == 0) {
- passed++;
- }
- else {
- printf("FAIL: %s\n", description);
- }
- remove("1.prg");
-
- description = "File should have DIR block size 65535 for -B";
- test++;
- create_value_file("1.prg", 3 * 254, 1);
- if (run_binary_cleanup(binary, "-B 65535 -w 1.prg", "image.d64", &image, &size) != NO_ERROR) {
- printf("UNRESOLVED: %s\n", description);
- }
- else if (image[track_offset[17] + 256 + 30] == (char)255 && image[track_offset[17] + 256 + 31] == (char)255) {
- passed++;
- }
- else {
- printf("FAIL: %s\n", description);
- }
- remove("1.prg");
+ description = "File should have DIR block size 0 for -B";
+ test++;
+ create_value_file("1.prg", 3 * 254, 1);
+ if (run_binary_cleanup(binary, "-B 0 -w 1.prg", "image.d64", &image, &size) != NO_ERROR) {
+ printf("UNRESOLVED: %s\n", description);
+ }
+ else if (image[track_offset[17] + 256 + 30] == 0 && image[track_offset[17] + 256 + 31] == 0) {
+ passed++;
+ }
+ else {
+ printf("FAIL: %s\n", description);
+ }
+ remove("1.prg");
+
+ description = "File should have DIR block size 65535 for -B";
+ test++;
+ create_value_file("1.prg", 3 * 254, 1);
+ if (run_binary_cleanup(binary, "-B 65535 -w 1.prg", "image.d64", &image, &size) != NO_ERROR) {
+ printf("UNRESOLVED: %s\n", description);
+ }
+ else if (image[track_offset[17] + 256 + 30] == (char)255 && image[track_offset[17] + 256 + 31] == (char)255) {
+ passed++;
+ }
+ else {
+ printf("FAIL: %s\n", description);
+ }
+ remove("1.prg");
description = "Loop file should have actual DIR block size per default";
test++;
--
2.21.0