Sync with MESS (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2011-11-25 13:39:59 +00:00
parent cb3d823e86
commit b1c3a23ed4
2 changed files with 3 additions and 4 deletions

View File

@ -139,7 +139,7 @@ static FLOPPY_IDENTIFY(apple2_dsk_identify)
if (size == expected_size)
*vote = 100;
else if (size - expected_size < 8 && size - expected_size > -8)
else if (abs(size - expected_size) < 8)
*vote = 90; /* tolerate images with up to eight fewer/extra bytes (bug #638) */
else
*vote = 0;

View File

@ -81,7 +81,7 @@ static void tzx_cas_get_blocks( const UINT8 *casdata, int caslen )
int pos = sizeof(TZX_HEADER) + 2;
int max_block_count = INITIAL_MAX_BLOCK_COUNT;
blocks = (UINT8**)malloc(max_block_count);
blocks = (UINT8**)malloc(max_block_count * sizeof(UINT8*));
memset(blocks,0,max_block_count);
block_count = 0;
@ -94,9 +94,8 @@ static void tzx_cas_get_blocks( const UINT8 *casdata, int caslen )
{
void *old_blocks = blocks;
int old_max_block_count = max_block_count;
printf("realoc");
max_block_count = max_block_count + BLOCK_COUNT_INCREMENTS;
blocks = (UINT8**)malloc(max_block_count); // SHOULD NOT BE USING auto_alloc_array()
blocks = (UINT8**)malloc(max_block_count * sizeof(UINT8*)); // SHOULD NOT BE USING auto_alloc_array()
memset(blocks,0,max_block_count);
memcpy(blocks, old_blocks, old_max_block_count * sizeof(UINT8*));
if (blocks) free(old_blocks);