Fix off-by-one block used size.

This commit is contained in:
michaelangel007 2025-02-08 17:43:12 -08:00
parent 8e82d82f81
commit 1489ffe543

View File

@ -1100,7 +1100,6 @@ bool ProDOS_FileAdd( const char *to_path, const char *from_filename, ProDOS_File
printf( "DEBUG: ADD: Path @ %06X\n", base );
#endif
// int nDirBlocks = prodos_BlockGetDirectoryCount();
// int nDirEntriesTotal = 0;
// int nDirEntriesFree = 0;
@ -1126,7 +1125,6 @@ bool ProDOS_FileAdd( const char *to_path, const char *from_filename, ProDOS_File
return false;
}
// Block Management
int nSrcSize = File_Size( pSrcFile );
@ -1149,7 +1147,6 @@ bool ProDOS_FileAdd( const char *to_path, const char *from_filename, ProDOS_File
return false;
}
uint8_t *buffer = new uint8_t[ nSrcSize + PRODOS_BLOCK_SIZE ];
memset( buffer, 0, nSrcSize + PRODOS_BLOCK_SIZE );
@ -1280,7 +1277,7 @@ bool ProDOS_FileAdd( const char *to_path, const char *from_filename, ProDOS_File
entry.kind = iKind;
entry.inode = iNode;
entry.blocks = nBlocksTotal;
entry.blocks = nBlocksData; // Note: File Entry does NOT include meta file block(s)
entry.size = nSrcSize;
entry.dir_block = iDirBlock;