diff options
author | 2011-11-25 13:39:59 +0000 | |
---|---|---|
committer | 2011-11-25 13:39:59 +0000 | |
commit | b1c3a23ed47c2900915f32020566dbcbb12e59e3 (patch) | |
tree | f8525a7af9f5656f25e35495c08d9d794ef69ed8 /src | |
parent | cb3d823e86ba95ebd45d7081f88b6a3cc2c7ad85 (diff) |
Sync with MESS (no whatsnew)
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/formats/ap2_dsk.c | 2 | ||||
-rw-r--r-- | src/lib/formats/tzx_cas.c | 5 |
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); |