Skip to content

Commit

Permalink
Merge pull request #2 from digarok/GSOS-sparse-file-P8-FST-block-0-issue
Browse files Browse the repository at this point in the history
disallow any checks for empty blocks on block 0
  • Loading branch information
digarok authored Jun 10, 2022
2 parents b976d68 + b661153 commit b9d9c61
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Src/Prodos_Add.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@ static void ComputeFileBlockUsage(struct prodos_file *current_file)
for(i=0; i<current_file->data_length; i+=BLOCK_SIZE)
{
/* Recherche les plages de 0 */
if(i+BLOCK_SIZE <= current_file->data_length)
/* Le premier block ne peut pas être zéro (not sparse - GSOS P8 FST issues) */
if(i>0 && (i+BLOCK_SIZE <= current_file->data_length))
result = memcmp(&current_file->data[i],empty_block,BLOCK_SIZE);
else
result = memcmp(&current_file->data[i],empty_block,current_file->data_length-i);
Expand All @@ -524,7 +525,8 @@ static void ComputeFileBlockUsage(struct prodos_file *current_file)
for(i=0; i<current_file->resource_length; i+=BLOCK_SIZE)
{
/* Recherche les plages de 0 */
if(i+BLOCK_SIZE <= current_file->resource_length)
/* Le premier block ne peut pas être zéro (not sparse - GSOS P8 FST issues) */
if(i>0 && (i+BLOCK_SIZE <= current_file->resource_length))
result = memcmp(&current_file->resource[i],empty_block,BLOCK_SIZE);
else
result = memcmp(&current_file->resource[i],empty_block,current_file->resource_length-i);
Expand Down Expand Up @@ -813,7 +815,8 @@ static WORD CreateSaplingContent(struct prodos_image *current_image, struct prod
for(i=0,j=1,k=0; i<data_length; i+=BLOCK_SIZE,k++)
{
/* Recherche les plages de 0 */
if(i+BLOCK_SIZE <= data_length)
/* Le premier block ne peut pas être zéro (not sparse - GSOS P8 FST issues) */
if(i>0 && (i+BLOCK_SIZE <= data_length))
is_empty = !memcmp(&data[i],empty_block,BLOCK_SIZE);
else
is_empty = !memcmp(&data[i],empty_block,data_length-i);
Expand Down Expand Up @@ -936,7 +939,8 @@ static WORD CreateTreeContent(struct prodos_image *current_image, struct prodos_
for(i=0,j=index_data,k=0,l=0; i<data_length; i+=BLOCK_SIZE,k++)
{
/* Recherche les plages de 0 */
if(i+BLOCK_SIZE <= data_length)
/* Le premier block ne peut pas être zéro (not sparse - GSOS P8 FST issues) */
if(i>0 && (i+BLOCK_SIZE <= data_length))
is_empty = !memcmp(&data[i],empty_block,BLOCK_SIZE);
else
is_empty = !memcmp(&data[i],empty_block,data_length-i);
Expand Down

0 comments on commit b9d9c61

Please sign in to comment.