Gutenberg tweaks

Changed the catalog scan offset so we don't overrun the buffer.

Changed a strcpy() to strncpy().

Added Gutenberg to the list of formats MDC outputs.
This commit is contained in:
Andy McFadden 2015-01-09 18:19:14 -08:00
parent 090797a76f
commit 1362c73a7e
3 changed files with 11 additions and 4 deletions

View File

@ -22,7 +22,7 @@ const int kMaxVolNameLen = 9;
const int kSctSize = 256; const int kSctSize = 256;
const int kVTOCTrack = 17; const int kVTOCTrack = 17;
const int kVTOCSector = 7; const int kVTOCSector = 7;
const int kCatalogEntryOffset = 0x20; // first entry in cat sect starts here const int kCatalogEntryOffset = 0x10; // first entry in cat sect starts here
const int kCatalogEntrySize = 16; // length in bytes of catalog entries const int kCatalogEntrySize = 16; // length in bytes of catalog entries
const int kCatalogEntriesPerSect = 15; // #of entries per catalog sector const int kCatalogEntriesPerSect = 15; // #of entries per catalog sector
const int kEntryDeleted = 0x40; // this is used to designate deleted files const int kEntryDeleted = 0x40; // this is used to designate deleted files

View File

@ -348,9 +348,10 @@ LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
if (strlen(ccp) == 0) if (strlen(ccp) == 0)
ccp = kBlankFileName; ccp = kBlankFileName;
if (subVolName[0] == '\0') if (subVolName[0] == '\0') {
strcpy(dispName, ccp); strncpy(dispName, ccp, sizeof(dispName));
else { dispName[sizeof(dispName) - 1] = '\0';
} else {
snprintf(dispName, sizeof(dispName), "%s:%s", subVolName, ccp); snprintf(dispName, sizeof(dispName), "%s:%s", subVolName, ccp);
//dispName = subVolName; //dispName = subVolName;
//dispName += ':'; //dispName += ':';
@ -470,6 +471,9 @@ LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
case DiskImg::kFormatRDOS3: case DiskImg::kFormatRDOS3:
fmtStr = "RDOS "; fmtStr = "RDOS ";
break; break;
case DiskImg::kFormatGutenberg:
fmtStr = "Gutenb";
break;
default: default:
fmtStr = "??? "; fmtStr = "??? ";
break; break;

View File

@ -856,6 +856,9 @@ int MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
case DiskImg::kFormatMSDOS: case DiskImg::kFormatMSDOS:
fmtStr = "MS-DOS"; fmtStr = "MS-DOS";
break; break;
case DiskImg::kFormatGutenberg:
fmtStr = "Gutenb";
break;
default: default:
fmtStr = "??? "; fmtStr = "??? ";
break; break;