summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/formats/ap2_dsk.c2
-rw-r--r--src/lib/formats/tzx_cas.c5
2 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/formats/ap2_dsk.c b/src/lib/formats/ap2_dsk.c
index 7be7150ad28..dc5931c1752 100644
--- a/src/lib/formats/ap2_dsk.c
+++ b/src/lib/formats/ap2_dsk.c
@@ -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;
diff --git a/src/lib/formats/tzx_cas.c b/src/lib/formats/tzx_cas.c
index a3ac4f42b19..1ad91f771c2 100644
--- a/src/lib/formats/tzx_cas.c
+++ b/src/lib/formats/tzx_cas.c
@@ -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);