Floppy: Fix some warnings in the floppy code

This commit is contained in:
darkstar
2018-03-12 22:14:50 +01:00
parent d013dbd0aa
commit 25051b3715
5 changed files with 28 additions and 26 deletions

View File

@@ -10,7 +10,7 @@
* data in the form of FM/MFM-encoded transitions) which also
* forms the core of the emulator's floppy disk emulation.
*
* Version: @(#)fdd_86f.c 1.0.3 2018/03/11
* Version: @(#)fdd_86f.c 1.0.4 2018/03/12
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -1134,7 +1134,7 @@ static void d86f_calccrc(int drive, uint8_t byte)
int d86f_word_is_aligned(int drive, int side, uint32_t base_pos)
{
int adjusted_track_pos = d86f[drive].track_pos;
uint32_t adjusted_track_pos = d86f[drive].track_pos;
if (base_pos == 0xFFFFFFFF)
{
@@ -1756,8 +1756,8 @@ void d86f_write_direct_common(int drive, int side, uint16_t byte, uint8_t type,
if (fdc_get_diswr(d86f_fdc))
return;
dbyte.byte = byte;
dpbyte.byte = d86f[drive].preceding_bit[side];
dbyte.byte = byte & 0xff;
dpbyte.byte = d86f[drive].preceding_bit[side] & 0xff;
if (type == 0)
{
@@ -2086,7 +2086,7 @@ void d86f_turbo_read(int drive, int side)
}
else
{
if (d86f[drive].data_find.bytes_obtained < (128 << d86f[drive].last_sector.id.n))
if (d86f[drive].data_find.bytes_obtained < (128UL << d86f[drive].last_sector.id.n))
{
if (d86f[drive].state != STATE_16_VERIFY_DATA)
{
@@ -2756,7 +2756,7 @@ uint16_t d86f_prepare_sector(int drive, int side, int prev_pos, uint8_t *id_buf,
void d86f_construct_encoded_buffer(int drive, int side)
{
int i = 0;
uint32_t i = 0;
/* *_fuzm are fuzzy bit masks, *_holm are hole masks, dst_neim are masks is mask for bits that are neither fuzzy nor holes in both,
and src1_d and src2_d are filtered source data. */
uint16_t src1_fuzm, src2_fuzm, dst_fuzm, src1_holm, src2_holm, dst_holm, dst_neim, src1_d, src2_d;
@@ -2806,7 +2806,7 @@ void d86f_construct_encoded_buffer(int drive, int side)
/* Decomposition is easier since we at most have to care about the holes. */
void d86f_decompose_encoded_buffer(int drive, int side)
{
int i = 0;
uint32_t i = 0;
uint16_t temp, temp2;
uint32_t len;
uint16_t *dst = d86f[drive].track_encoded_data[side];
@@ -3294,7 +3294,7 @@ void d86f_add_track(int drive, int track, int side)
void d86f_common_format(int drive, int side, int rate, uint8_t fill, int proxy)
{
int i = 0;
uint32_t i = 0;
uint16_t temp, temp2;
uint32_t array_size;

View File

@@ -8,7 +8,7 @@
*
* Implementation of the IMD floppy image format.
*
* Version: @(#)fdd_imd.c 1.0.2 2018/02/21
* Version: @(#)fdd_imd.c 1.0.3 2018/03/12
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -697,7 +697,7 @@ uint16_t imd_disk_flags(int drive)
uint16_t imd_side_flags(int drive)
{
int side = 0;
uint8_t sflags = 0;
uint16_t sflags = 0;
side = fdd_get_head(drive);
sflags = imd[drive].current_side_flags[side];
return sflags;

View File

@@ -8,7 +8,7 @@
*
* Implementation of the PCjs JSON floppy image format.
*
* Version: @(#)fdd_json.c 1.0.1 2018/02/14
* Version: @(#)fdd_json.c 1.0.2 2018/03/12
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -423,8 +423,10 @@ json_seek(int drive, int track)
id[0] = track;
id[1] = side;
id[2] = rsec;
id[3] = img->sects[track][side][asec].size;
ssize = fdd_sector_code_size(img->sects[track][side][asec].size);
if (img->sects[track][side][asec].size > 255)
perror("fdd_json.c: json_seek: sector size too big.");
id[3] = img->sects[track][side][asec].size & 0xff;
ssize = fdd_sector_code_size(img->sects[track][side][asec].size & 0xff);
pos = d86f_prepare_sector(
drive, side, pos, id,

View File

@@ -8,7 +8,7 @@
*
* Implementation of the Teledisk floppy image format.
*
* Version: @(#)fdd_td0.c 1.0.1 2018/02/14
* Version: @(#)fdd_td0.c 1.0.2 2018/03/12
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Milodrag Milanovic,
@@ -96,7 +96,7 @@ typedef struct {
typedef struct
{
FILE *fdd_file;
uint64_t fdd_file_offset;
off_t fdd_file_offset;
tdlzhuf tdctl;
uint8_t text_buf[N + F - 1];
@@ -177,7 +177,7 @@ int td0_state_data_read(td0dsk_t *state, uint8_t *buf, uint16_t size)
fseek(state->fdd_file, 0, SEEK_END);
image_size = ftell(state->fdd_file);
if (size > image_size - state->fdd_file_offset) {
size = image_size - state->fdd_file_offset;
size = (image_size - state->fdd_file_offset) & 0xffff;
}
fseek(state->fdd_file, state->fdd_file_offset, SEEK_SET);
fread(buf, 1, size, state->fdd_file);
@@ -486,8 +486,8 @@ int td0_state_Decode(td0dsk_t *state, uint8_t *buf, int len) /* Decoding/Uncomp
if((c = td0_state_DecodeChar(state)) < 0)
return(count); /* fatal error */
if (c < 256) {
*(buf++) = c;
state->text_buf[state->tdctl.r++] = c;
*(buf++) = c & 0xff;
state->text_buf[state->tdctl.r++] = c & 0xff;
state->tdctl.r &= (N - 1);
count++;
}
@@ -502,9 +502,9 @@ int td0_state_Decode(td0dsk_t *state, uint8_t *buf, int len) /* Decoding/Uncomp
else { /* still chars from last string */
while( state->tdctl.bufndx < state->tdctl.bufcnt && count < len ) {
c = state->text_buf[(state->tdctl.bufpos + state->tdctl.bufndx) & (N - 1)];
*(buf++) = c;
*(buf++) = c & 0xff;
state->tdctl.bufndx++;
state->text_buf[state->tdctl.r++] = c;
state->text_buf[state->tdctl.r++] = c & 0xff;
state->tdctl.r &= (N - 1);
count++;
}
@@ -536,8 +536,8 @@ void td0_init()
void d86f_register_td0(int drive);
const int max_size = 4*1024*1024; /* 4MB ought to be large enough for any floppy */
const int max_processed_size = 5*1024*1024;
const size_t max_size = 4*1024*1024; /* 4MB ought to be large enough for any floppy */
const size_t max_processed_size = 5*1024*1024;
uint8_t imagebuf[4*1024*1024];
uint8_t processed_buf[5*1024*1024];
uint8_t header[12];
@@ -1220,7 +1220,7 @@ uint16_t td0_disk_flags(int drive)
uint16_t td0_side_flags(int drive)
{
int side = 0;
uint8_t sflags = 0;
uint16_t sflags = 0;
side = fdd_get_head(drive);
sflags = td0[drive].current_side_flags[side];
return sflags;

View File

@@ -12,7 +12,7 @@
* addition of get_last_head and C++ callability by Thomas
* Harte.
*
* Version: @(#)fdi2raw.c 1.0.1 2018/02/14
* Version: @(#)fdi2raw.c 1.0.2 2018/03/12
*
* Authors: Toni Wilen, <twilen@arabuusimiehet.com>
* and Vincent Joguin,
@@ -1880,7 +1880,7 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache)
indexoffset = 0;
p1 = idxp;
for (i = 0; i < pulses; i++) {
if (p1[idx_off1] + p1[idx_off2] > maxidx)
if ((uint32_t)p1[idx_off1] + (uint32_t)p1[idx_off2] > maxidx)
maxidx = p1[idx_off1] + p1[idx_off2];
p1 += idx_off3;
}
@@ -1916,7 +1916,7 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache)
totalavg = 0;
weakbits = 0;
for (i = 0; i < pulses; i++) {
int sum = p1[idx_off1] + p1[idx_off2];
uint32_t sum = p1[idx_off1] + p1[idx_off2];
if (sum >= maxidx) {
totalavg += *p2;
} else {