]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Warning fixes.
authorToni Wilen <twilen@winuae.net>
Thu, 28 Apr 2022 18:34:35 +0000 (21:34 +0300)
committerToni Wilen <twilen@winuae.net>
Thu, 28 Apr 2022 18:34:35 +0000 (21:34 +0300)
98 files changed:
a2091.cpp
akiko.cpp
amax.cpp
ar.cpp
archivers/chd/corealloc.h
archivers/lha/uae_lha.cpp
archivers/lzx/unlzx.cpp
archivers/wrp/warp.cpp
archivers/zip/unzip.cpp
audio.cpp
blkdev_cdimage.cpp
cd32_fmv.cpp
cfgfile.cpp
cpummu.cpp
cpummu30.cpp
custom.cpp
debug.cpp
devices.cpp
disk.cpp
dongle.cpp
driveclick.cpp
epsonprinter.cpp
fdi2raw.cpp
filesys.cpp
flashrom.cpp
fpp_softfloat.cpp
gayle.cpp
gfxboard.cpp
gfxutil.cpp
hardfile.cpp
ide.cpp
idecontrollers.cpp
identify.cpp
include/audio.h
include/cd32_fmv.h
include/cpu_prefetch.h
include/devices.h
include/disk.h
include/mmu_common.h
include/options.h
include/savestate.h
include/sndboard.h
include/x86.h
include/zfile.h
inputdevice.cpp
inputrecord.cpp
isofs.cpp
mame/a2410.cpp
memory.cpp
ncr9x_scsi.cpp
ncr_scsi.cpp
od-win32/ahidsound_dsonly.cpp
od-win32/ahidsound_new.cpp
od-win32/avioutput.cpp
od-win32/caps/caps_win32.cpp
od-win32/cda_play.cpp
od-win32/debug_win32.cpp
od-win32/dinput.cpp
od-win32/direct3d.cpp
od-win32/direct3d11.cpp
od-win32/driveclick_win32.cpp
od-win32/dxwrap.cpp
od-win32/dxwrap.h
od-win32/hardfile_win32.cpp
od-win32/hq2x_d3d.cpp
od-win32/mman.cpp
od-win32/mp3decoder.cpp
od-win32/rp.cpp
od-win32/scaler.cpp
od-win32/serial_win32.cpp
od-win32/sounddep/sound.cpp
od-win32/sounddep/sound.h
od-win32/win32_videograb.cpp
od-win32/win32gfx.cpp
od-win32/win32gui.cpp
od-win32/win32gui.h
od-win32/win32gui_extra.cpp
pcem/timer.h
pci.cpp
readcpu.cpp
rommgr.cpp
sampler.cpp
savestate.cpp
scp.cpp
scsiemul.cpp
scsitape.cpp
slirp/cksum.cpp
slirp/mbuf.h
slirp/tcp_timer.h
sndboard.cpp
softfloat/SOFTFLOAT-MACROS.H
softfloat/softfloat.cpp
softfloat/softfloat_decimal.cpp
statusline.cpp
uaenative.cpp
x86.cpp
zfile.cpp
zfile_archive.cpp

index 4d06121b6ccee4e113535cca57906ae21ae9be4c..a1c190dcc65644cdb42537849903734cdc076c19 100644 (file)
--- a/a2091.cpp
+++ b/a2091.cpp
@@ -733,11 +733,11 @@ static bool do_dma_commodore_8727(struct wd_state *wd, struct scsi_data *scsi)
                        uae_u16 v = dma_get_word((wd->cdmac.dmac_acr << 1) & wd->dma_mask);
                        if (wd->wc.wd_dataoffset < sizeof wd->wc.wd_data - 1) {
                                wd->wc.wd_data[wd->wc.wd_dataoffset++] = v >> 8;
-                               wd->wc.wd_data[wd->wc.wd_dataoffset++] = v;
+                               wd->wc.wd_data[wd->wc.wd_dataoffset++] = (uae_u8)v;
                        }
                        status = scsi_send_data (scsi, v >> 8);
                        if (!status)
-                               status = scsi_send_data (scsi, v);
+                               status = scsi_send_data (scsi, (uae_u8)v);
                        if (decreasetc (&wd->wc))
                                break;
                        if (decreasetc (&wd->wc))
@@ -4098,7 +4098,7 @@ bool a2091_init (struct autoconfig_info *aci)
        if (!aci->rc->autoboot_disabled) {
                struct zfile *z = read_device_from_romconfig(aci->rc, ROMTYPE_A2091);
                if (z) {
-                       wd->rom_size = zfile_size (z);
+                       wd->rom_size = zfile_size32(z);
                        zfile_fread (wd->rom, wd->rom_size, 1, z);
                        zfile_fclose (z);
                        if (wd->rom_size == 32768) {
@@ -4185,7 +4185,7 @@ static bool a2090x_init (struct autoconfig_info *aci, bool combitec)
        if (!aci->rc->autoboot_disabled && !combitec) {
                struct zfile *z = read_device_from_romconfig(aci->rc, ROMTYPE_A2090);
                if (z) {
-                       wd->rom_size = zfile_size (z);
+                       wd->rom_size = zfile_size32(z);
                        zfile_fread (wd->rom, wd->rom_size, 1, z);
                        zfile_fclose (z);
                        for (int i = 1; i < slotsize / wd->rom_size; i++) {
@@ -4353,11 +4353,11 @@ static bool gvp_init(struct autoconfig_info *aci, bool series2, bool accel)
        if (!autoboot_disabled) {
                struct zfile *z = read_device_from_romconfig(aci->rc, ROMTYPE_GVPS2);
                if (z) {
-                       int size = zfile_size(z);
+                       int size = zfile_size32(z);
                        if (series2) {
                                int total = 0;
                                int seekpos = 0;
-                               size = zfile_size(z);
+                               size = zfile_size32(z);
                                if (size > 16384 + 4096) {
                                        zfile_fread(wd->rom, 64, 1, z);
                                        zfile_fseek(z, 16384, SEEK_SET);
@@ -4511,7 +4511,7 @@ bool comspec_preinit (struct autoconfig_info *aci)
        wd->rom_mask = wd->rom_size - 1;
        struct zfile *z = read_device_from_romconfig(aci->rc, ROMTYPE_COMSPEC);
        if (z) {
-               wd->rom_size = zfile_size (z);
+               wd->rom_size = zfile_size32(z);
                zfile_fread (wd->rom, wd->rom_size, 1, z);
                zfile_fclose (z);
                wd->rom_mask = wd->rom_size - 1;
index d2117c5f2eaf57ca5481c59ae2f3978273ae37d8..99d1a9b5dfa89d3efbf5c4fb7c479f31ab8b3991 100644 (file)
--- a/akiko.cpp
+++ b/akiko.cpp
@@ -1461,13 +1461,13 @@ static void AKIKO_hsync_handler (void)
                } else {
                        cdrom_seek_delay--;
                }
-               framecounter1 += (float)maxvpos * vblank_hz / (75.0 * cdrom_speed);
+               framecounter1 += (float)maxvpos * vblank_hz / (75.0f * cdrom_speed);
                if (currprefs.cd_speed == 0 || currprefs.turbo_emulation)
                        framecounter1 = 1;
        }
        framecounter2--;
        if (framecounter2 <= 0) {
-               framecounter2 += (float)maxvpos * vblank_hz / (75.0 * cdrom_speed);
+               framecounter2 += (float)maxvpos * vblank_hz / (75.0f * cdrom_speed);
                framesync = true;
        }
 
@@ -1499,7 +1499,7 @@ static void AKIKO_hsync_handler (void)
                        }
                        uae_sem_post (&sub_sem);
                }
-               subcodecounter = maxvpos * vblank_hz / (75 * cdrom_speed) - 5;
+               subcodecounter = (int)(maxvpos * vblank_hz / (75 * cdrom_speed) - 5);
        }
 
        if (frame2counter > 0)
index ab5d1c50618f5887015b0280c441dc5fc4375cb2..1739d48788055d17f3e038d951b393ef409e5f51 100644 (file)
--- a/amax.cpp
+++ b/amax.cpp
@@ -152,7 +152,7 @@ void amax_init (void)
                z = read_device_rom(&currprefs, ROMTYPE_AMAX, 0, NULL);
        if (z) {
                zfile_fseek (z, 0, SEEK_END);
-               amax_rom_size = zfile_ftell (z);
+               amax_rom_size = zfile_ftell32(z);
                zfile_fseek (z, 0, SEEK_SET);
        } else {
                write_log (_T("AMAX: failed to load rom\n"));
diff --git a/ar.cpp b/ar.cpp
index 8e1d87bce1194193bea677818cc3efdae174bbc8..92a07f4cc4970aa778b73897f83e115da78e8adb 100644 (file)
--- a/ar.cpp
+++ b/ar.cpp
@@ -1674,7 +1674,7 @@ int action_replay_load (void)
                }
        }
        zfile_fseek(f, 0, SEEK_END);
-       ar_rom_file_size = zfile_ftell(f);
+       ar_rom_file_size = zfile_ftell32(f);
        zfile_fseek(f, 0, SEEK_SET);
        zfile_fread (header, 1, sizeof header, f);
        zfile_fseek (f, 0, SEEK_SET);
index 5abddda3de84a001ea44e1aaa4f2d90f75c162bd..9727b61ea473dbb6711ea538867d78e7a8a7da47 100644 (file)
@@ -70,16 +70,16 @@ ATTR_FORCE_INLINE inline void operator delete[](void *ptr) throw() { if (ptr !=
 #endif
 
 // file/line new/delete operators
-ATTR_FORCE_INLINE inline void *operator new(std::size_t size, const char *file, int line) throw (std::bad_alloc) { return malloc_file_line(size, file, line, false, true, false); }
-ATTR_FORCE_INLINE inline void *operator new[](std::size_t size, const char *file, int line) throw (std::bad_alloc) { return malloc_file_line(size, file, line, true, true, false); }
-ATTR_FORCE_INLINE inline void operator delete(void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
-ATTR_FORCE_INLINE inline void operator delete[](void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
+ATTR_FORCE_INLINE void *operator new(std::size_t size, const char *file, int line) { return malloc_file_line(size, file, line, false, true, false); }
+ATTR_FORCE_INLINE void *operator new[](std::size_t size, const char *file, int line) { return malloc_file_line(size, file, line, true, true, false); }
+ATTR_FORCE_INLINE void operator delete(void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
+ATTR_FORCE_INLINE void operator delete[](void *ptr, const char *file, int line) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
 
 // file/line new/delete operators with zeroing
-ATTR_FORCE_INLINE inline void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) { return malloc_file_line(size, file, line, false, true, true); }
-ATTR_FORCE_INLINE inline void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) { return malloc_file_line(size, file, line, true, true, true); }
-ATTR_FORCE_INLINE inline void operator delete(void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
-ATTR_FORCE_INLINE inline void operator delete[](void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
+ATTR_FORCE_INLINE void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) { return malloc_file_line(size, file, line, false, true, true); }
+ATTR_FORCE_INLINE void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) { return malloc_file_line(size, file, line, true, true, true); }
+ATTR_FORCE_INLINE void operator delete(void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, false); }
+ATTR_FORCE_INLINE void operator delete[](void *ptr, const char *file, int line, const zeromem_t &) { if (ptr != NULL) free_file_line(ptr, file, line, true); }
 
 
 
index 967b923e9258dabecb0eb47a9c2925d4bda26ac9..acc9d64fcc898c0cf93570d2a9d46493d01148be 100644 (file)
@@ -60,7 +60,7 @@ struct zvolume *archive_directory_lha (struct zfile *zf)
                } else {
                        zn = zvolume_addfile_abs (zv, &zai);
                        if (zn) {
-                               zn->offset = zfile_ftell(zf);
+                               zn->offset = zfile_ftell32(zf);
                                zn->packedsize = hdr.packed_size;
                                zn->method = method;
                        }
index 06dfd2a5e16b451be6d4e1ab0e21e0afcc37f1e2..f32d84f87cc75abe49883666e1dd42eced67fdc0 100644 (file)
@@ -147,7 +147,7 @@ static const unsigned char table_four[34]=
 
 static void crc_calc(struct lzxdata *d, unsigned char *memory, unsigned int length)
 {
register unsigned int temp;
+ unsigned int temp;
 
  if(length)
  {
@@ -168,8 +168,8 @@ static void crc_calc(struct lzxdata *d, unsigned char *memory, unsigned int leng
 static int make_decode_table(struct lzxdata *d, short number_symbols, short table_size,
                      unsigned char *length, unsigned short *table)
 {
register unsigned char bit_num = 0;
register short symbol;
+ unsigned char bit_num = 0;
+ short symbol;
  unsigned short leaf; /* could be a register */
  unsigned short bit_mask, fill, next_symbol, reverse;
  unsigned int table_mask, pos;
@@ -291,8 +291,8 @@ static int make_decode_table(struct lzxdata *d, short number_symbols, short tabl
 
 static int read_literal_table(struct lzxdata *d)
 {
register unsigned int control;
register short shift;
+ unsigned int control;
+ short shift;
  unsigned short temp; /* could be a register */
  unsigned short symbol, pos, count, fix, max_symbol;
 #if LZX_ERROR_CHECK
@@ -531,8 +531,8 @@ static int read_literal_table(struct lzxdata *d)
 
 static void decrunch(struct lzxdata *d)
 {
register unsigned int control;
register short shift;
+ unsigned int control;
+ short shift;
  unsigned short temp; /* could be a register */
  unsigned short symbol, count;
  unsigned char *string;
@@ -850,7 +850,7 @@ struct zvolume *archive_directory_lzx (struct zfile *in_file)
          {
           merge_size = 0;
           if (zn) {
-                  zn->offset = zfile_ftell(in_file);
+                  zn->offset = zfile_ftell32(in_file);
                   zn->packedsize = pack_size;
           }
           if(!zfile_fseek(in_file, pack_size, SEEK_CUR))
index 6b9f94ef4f5fea5e696ba28e17dc5ab0066e87d4..cb1c0a12b5e63bba0193fad14e9954325c8061af 100644 (file)
@@ -420,7 +420,7 @@ struct zfile *unwarp(struct zfile *zf)
                if (!memcmp (buf + 12, "TOP\0", 4))
                        side = 0;
                crc = (buf[20] << 8) | buf[21];
-               pos = zfile_ftell (zf);
+               pos = zfile_ftell32(zf);
                dstpos = -1;
                if (side >= 0 && track >= 0 && track <= 79)
                        dstpos = track * 22 * 512 + (side * 11 * 512);
@@ -465,9 +465,9 @@ struct zfile *unwarp(struct zfile *zf)
                        write_log (_T("WRP corrupt data, track=%d,side=%d,err=%d\n"), track, side, err);
                } else {
                        uae_u16 crc2;
-                       int os = zfile_ftell (tmpf);
-                       data = zfile_getdata (tmpf, 0, os, NULL);
-                       crc2 = wrpcrc16 (wrpcrc16table, data, os);
+                       int os = zfile_ftell32(tmpf);
+                       data = zfile_getdata(tmpf, 0, os, NULL);
+                       crc2 = wrpcrc16(wrpcrc16table, data, os);
                        if (crc != crc2)
                                write_log (_T("WRP crc error %04x<>%04x, track=%d,side=%d\n"), crc, crc2, track, side);
                        xfree (data);
index 4d6b33047b61632ef1850f40cdc50e71411e6369..81281c7e23220bf20e12d28f9a63ce3bb1872a5e 100644 (file)
@@ -274,7 +274,7 @@ local uLong unzlocal_SearchCentralDir(struct zfile *fin)
                return 0;
 
 
-       uSizeFile = zfile_ftell( fin );
+       uSizeFile = zfile_ftell32( fin );
 
        if (uMaxBack>uSizeFile)
                uMaxBack = uSizeFile;
index 768b0bf707b4c1fa77863b2375832d88fddef2ac..8cc148873fa3d6926c2ba573bc62389fd43e48f0 100644 (file)
--- a/audio.cpp
+++ b/audio.cpp
@@ -274,7 +274,7 @@ void audio_sampleripper (int mode)
                                convertsample (rs->sample, rs->len);
                                zfile_fwrite (rs->sample, rs->len, 1, wavfile);
                                convertsample (rs->sample, rs->len);
-                               write_wavheader (wavfile, zfile_ftell(wavfile), freq);
+                               write_wavheader (wavfile, zfile_ftell32(wavfile), freq);
                                zfile_fclose (wavfile);
                                write_log (_T("SAMPLERIPPER: %d: %dHz %d bytes\n"), cnt, freq, rs->len);
                        } else {
@@ -354,7 +354,7 @@ float scaled_sample_evtime;
 int sound_cd_volume[2];
 int sound_paula_volume[2];
 
-static unsigned long last_cycles;
+static evt_t last_cycles;
 static float next_sample_evtime;
 static int previous_volcnt_update;
 
@@ -453,8 +453,8 @@ static int filter (int input, struct filter_state *fs)
        switch (sound_use_filter) {
 
        case FILTER_MODEL_A500:
-               fs->rc1 = a500e_filter1_a0 * input + (1 - a500e_filter1_a0) * fs->rc1 + DENORMAL_OFFSET;
-               fs->rc2 = a500e_filter2_a0 * fs->rc1 + (1 - a500e_filter2_a0) * fs->rc2;
+               fs->rc1 = (float)(a500e_filter1_a0 * input + (1.0f - a500e_filter1_a0) * fs->rc1 + DENORMAL_OFFSET);
+               fs->rc2 = a500e_filter2_a0 * fs->rc1 + (1.0f - a500e_filter2_a0) * fs->rc2;
                normal_output = fs->rc2;
 
                fs->rc3 = filter_a0 * normal_output + (1 - filter_a0) * fs->rc3;
@@ -465,9 +465,9 @@ static int filter (int input, struct filter_state *fs)
                break;
 
        case FILTER_MODEL_A1200:
-               normal_output = input;
+               normal_output = (float)input;
 
-               fs->rc2 = filter_a0 * normal_output + (1 - filter_a0) * fs->rc2 + DENORMAL_OFFSET;
+               fs->rc2 = (float)(filter_a0 * normal_output + (1 - filter_a0) * fs->rc2 + DENORMAL_OFFSET);
                fs->rc3 = filter_a0 * fs->rc2       + (1 - filter_a0) * fs->rc3;
                fs->rc4 = filter_a0 * fs->rc3       + (1 - filter_a0) * fs->rc4;
 
@@ -481,9 +481,9 @@ static int filter (int input, struct filter_state *fs)
        }
 
        if (led_filter_on)
-               o = led_output;
+               o = (int)led_output;
        else
-               o = normal_output;
+               o = (int)normal_output;
 
        if (o > 32767)
                o = 32767;
@@ -895,7 +895,7 @@ static void sample16i_crux_handler (void)
        {
                struct audio_channel_data *cdp;
                unsigned long ratio, ratio1;
-#define INTERVAL (scaled_sample_evtime * 3)
+#define INTERVAL ((int)(scaled_sample_evtime * 3))
                cdp = audio_channel + 0;
                ratio1 = cdp->per - cdp->evtime;
                ratio = (ratio1 << 12) / INTERVAL;
@@ -1170,7 +1170,7 @@ static void sample16si_crux_handler (void)
        {
                struct audio_channel_data *cdp;
                unsigned long ratio, ratio1;
-#define INTERVAL (scaled_sample_evtime * 3)
+#define INTERVAL ((int)(scaled_sample_evtime * 3))
                cdp = audio_channel + 0;
                ratio1 = cdp->per - cdp->evtime;
                ratio = (ratio1 << 12) / INTERVAL;
@@ -1947,7 +1947,7 @@ double softfloat_tan(double v);
 /* This computes the 1st order low-pass filter term b0.
 * The a1 term is 1.0 - b0. The center frequency marks the -3 dB point. */
 #ifndef M_PI
-#define M_PI 3.14159265358979323846
+#define M_PI 3.14159265358979323846f
 #endif
 static float rc_calculate_a0 (int sample_rate, int cutoff_freq)
 {
@@ -1956,12 +1956,12 @@ static float rc_calculate_a0 (int sample_rate, int cutoff_freq)
        if (cutoff_freq >= sample_rate / 2)
                return 1.0;
 
-       omega = 2 * M_PI * cutoff_freq / sample_rate;
+       omega = 2.0f * M_PI * cutoff_freq / sample_rate;
        /* Compensate for the bilinear transformation. This allows us to specify the
        * stop frequency more exactly, but the filter becomes less steep further
        * from stopband. */
-       omega = softfloat_tan (omega / 2.0) * 2.0;
-       float out = 1.0 / (1.0 + 1.0 / omega);
+       omega = (float)softfloat_tan (omega / 2.0f) * 2.0f;
+       float out = 1.0f / (1.0f + 1.0f / omega);
        return out;
 }
 
@@ -2195,14 +2195,14 @@ static void update_audio_volcnt(int cycles, float evtime, bool nextsmp)
                out *= 8192;
 
                cdp->data.last_sample = cdp->data.current_sample;
-               cdp->data.current_sample = out;
+               cdp->data.current_sample = (int)out;
        }
        (*sample_handler) ();
 }
 
 void update_audio (void)
 {
-       unsigned long int n_cycles = 0;
+       int n_cycles = 0;
 #if SOUNDSTUFF > 1
        static int samplecounter;
 #endif
@@ -2214,10 +2214,10 @@ void update_audio (void)
        if (!is_audio_active ())
                goto end;
 
-       n_cycles = get_cycles () - last_cycles;
+       n_cycles = (int)(get_cycles () - last_cycles);
        while (n_cycles > 0) {
-               unsigned long int best_evtime = n_cycles + 1;
-               unsigned long rounded;
+               uae_u32 best_evtime = n_cycles + 1;
+               uae_u32 rounded;
                int i;
 
                for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) {
@@ -2230,7 +2230,7 @@ void update_audio (void)
                }
 
                /* next_sample_evtime >= 0 so floor() behaves as expected */
-               rounded = floorf (next_sample_evtime);
+               rounded = (uae_u32)floorf (next_sample_evtime);
                float nevtime = next_sample_evtime;
                if ((next_sample_evtime - rounded) >= 0.5)
                        rounded++;
@@ -2765,12 +2765,12 @@ void audio_state_stream_state(int streamid, int *samplep, int highestch, unsigne
        asd->evtime = evt;
 }
 
-static unsigned int cda_evt;
+static uae_u32 cda_evt;
 static uae_s16 dummy_buffer[4] = { 0 };
 
-void update_cda_sound(double clk)
+void update_cda_sound(float clk)
 {
-       cda_evt = clk * CYCLE_UNIT / 44100;
+       cda_evt = (uae_u32)(clk * CYCLE_UNIT / 44100.0f);
 }
 
 void audio_cda_volume(struct cd_audio_state *cas, int left, int right)
index 3baad1bca40aa20e65ab1b39d89d026519655bef..ae8283aa5e1e988abd081c7f2321b426c7f12db9 100644 (file)
@@ -176,7 +176,7 @@ static int do_read (struct cdunit *cdu, struct cdtoc *t, uae_u8 *data, int secto
                }
                if (audio && size == 2352)
                        type = CD_TRACK_AUDIO;
-               if (cdrom_read_data(cdu->chd_cdf, sector + t->offset, tmpbuf, type, true)) {
+               if (cdrom_read_data(cdu->chd_cdf, sector + (UINT32)t->offset, tmpbuf, type, true)) {
                        memcpy(data, tmpbuf + offset, size);
                        return 1;
                }
@@ -409,7 +409,7 @@ static void cdda_unpack_func (void *v)
                        zfile_fread (&b, 1, 1, t->handle);
                        zfile_fseek (t->handle, pos, SEEK_SET);
                        if (!t->data && (t->enctype == AUDENC_MP3 || t->enctype == AUDENC_FLAC)) {
-                               t->data = xcalloc (uae_u8, t->filesize + 2352);
+                               t->data = xcalloc (uae_u8, (int)t->filesize + 2352);
                                cdimage_unpack_active = 1;
                                if (t->data) {
                                        if (t->enctype == AUDENC_MP3) {
@@ -419,7 +419,7 @@ static void cdda_unpack_func (void *v)
                                                        } catch (exception) { };
                                                }
                                                if (mp3dec)
-                                                       t->data = mp3dec->get (t->handle, t->data, t->filesize);
+                                                       t->data = mp3dec->get (t->handle, t->data, (int)t->filesize);
                                        } else if (t->enctype == AUDENC_FLAC) {
                                                flac_get_data (t);
                                        }
@@ -554,7 +554,7 @@ static bool cdda_play_func2 (struct cdunit *cdu, int *outpos)
 
                        if (*outpos < 0) {
                                _ftime (&tb2);
-                               diff = (tb2.time * (uae_s64)1000 + tb2.millitm) - (tb1.time * (uae_s64)1000 + tb1.millitm);
+                               diff = (int)((tb2.time * (uae_s64)1000 + tb2.millitm) - (tb1.time * (uae_s64)1000 + tb1.millitm));
                                diff -= cdu->cdda_delay;
                                if (idleframes >= 0 && diff < 0 && cdu->cdda_play > 0)
                                        sleep_millis(-diff);
@@ -637,7 +637,7 @@ static bool cdda_play_func2 (struct cdunit *cdu, int *outpos)
 #endif
                                                } else if (t->handle) {
                                                        int totalsize = t->size + t->skipsize;
-                                                       int offset = t->offset;
+                                                       int offset = (int)t->offset;
                                                        if (offset >= 0) {
                                                                if ((t->enctype == AUDENC_MP3 || t->enctype == AUDENC_FLAC) && t->data) {
                                                                        if (t->filesize >= sector * totalsize + offset + t->size)
@@ -1303,14 +1303,14 @@ static int parsemds (struct cdunit *cdu, struct zfile *zmds, const TCHAR *img, c
        MDS_Header *head;
        struct cdtoc *t;
        uae_u8 *mds = NULL;
-       uae_u64 size;
+       uae_u32 size;
        MDS_SessionBlock *sb;
 
        if (curdir)
                my_setcurrentdir(occurdir, NULL);
 
        write_log (_T("MDS TOC: '%s'\n"), img);
-       size = zfile_size (zmds);
+       size = zfile_size32(zmds);
        mds = xmalloc (uae_u8, size);
        if (!mds)
                goto end;
@@ -1463,7 +1463,7 @@ static int parsechd (struct cdunit *cdu, struct zfile *zcue, const TCHAR *img, c
                dtrack->filesize = cf->logical_bytes ();
                dtrack->track = i + 1;
                dtrack[1].address = dtrack->address + strack->frames;
-               if (cf->hunk_info(dtrack->offset * CD_FRAME_SIZE / hunksize, compr, cbytes) == CHDERR_NONE) {
+               if (cf->hunk_info((UINT32)(dtrack->offset * CD_FRAME_SIZE / hunksize), compr, cbytes) == CHDERR_NONE) {
                        TCHAR tmp[100];
                        uae_u32 c = (uae_u32)compr;
                        for (int j = 0; j < 4; j++) {
@@ -2034,7 +2034,7 @@ static int parsenrg(struct cdunit *cdu, struct zfile *znrg, const TCHAR *img, co
                                                t->address = 0;
                                        }
                                        t->offset = index0;
-                                       t->index1 = (index1 - index0) / sectorsize;
+                                       t->index1 = (int)((index1 - index0) / sectorsize);
                                        t->size = sectorsize;
                                        t->handle = zfile_dup(znrg);
                                        t->fname = my_strdup(zfile_getname(znrg));
@@ -2042,7 +2042,7 @@ static int parsenrg(struct cdunit *cdu, struct zfile *znrg, const TCHAR *img, co
                                                t->enctype = AUDENC_PCM;
                                                if (type == 0x1000) {
                                                        // audio with sub.
-                                                       t->suboffset = t->offset;
+                                                       t->suboffset = (int)t->offset;
                                                        t->size -= SUB_CHANNEL_SIZE;
                                                        t->subcode = 1;
                                                        t->subhandle = zfile_dup(t->handle);
index 993fd4fef67a68b462a50a1a81579881d30a3715..5e70d9115815fe5b088cc926a78387183a0c1f98 100644 (file)
@@ -206,7 +206,7 @@ static const int fmv_board_size = 1048576;
 #define CL450_VIDEO_BUFFER_SIZE (352 * 288 * 4)
 
 static uae_u16 cl450_regs[256];
-static double cl450_scr;
+static float cl450_scr;
 #define CL450_IMEM_WORDS (2 * 512)
 #define CL450_TMEM_WORDS 128
 #define CL450_HMEM_WORDS 16
@@ -227,7 +227,7 @@ static int libmpeg_offset;
 static bool audio_mode;
 static uae_sem_t play_sem;
 static volatile bool fmv_bufon[2];
-static double fmv_syncadjust;
+static float fmv_syncadjust;
 static struct cd_audio_state cas;
 
 struct cl450_videoram
@@ -591,11 +591,11 @@ static uae_u8 *parse_audio_header(uae_u8 *p)
                        p += 5;
                        psize -= 5;
                        if (audio_head_detect >= 3) {
-                               l64111_regs[A_PRESENT1] = pts >> 0;
-                               l64111_regs[A_PRESENT2] = pts >> 8;
-                               l64111_regs[A_PRESENT3] = pts >> 16;
-                               l64111_regs[A_PRESENT4] = pts >> 24;
-                               l64111_regs[A_PRESENT5] = pts >> 32;
+                               l64111_regs[A_PRESENT1] = (uae_u16)(pts >> 0);
+                               l64111_regs[A_PRESENT2] = (uae_u16)(pts >> 8);
+                               l64111_regs[A_PRESENT3] = (uae_u16)(pts >> 16);
+                               l64111_regs[A_PRESENT4] = (uae_u16)(pts >> 24);
+                               l64111_regs[A_PRESENT5] = (uae_u16)(pts >> 32);
                                //write_log(_T("audio PTS %09llx SCR %09llx\n"), pts, (uae_u64)cl450_scr);
                                l64111_set_status(2, PTS_AVAILABLE);
                        }
@@ -751,7 +751,7 @@ static void l64111_wput (uaecptr addr, uae_u16 v)
                        return;
                }
                l64111_fifo[l64111_fifo_cnt++] = v >> 8;
-               l64111_fifo[l64111_fifo_cnt++] = v;
+               l64111_fifo[l64111_fifo_cnt++] = (uae_u8)v;
                if (l64111_fifo_cnt == L64111_FIFO_BYTES) {
                        l64111_parse();
                }
@@ -770,7 +770,7 @@ static void l64111_wput (uaecptr addr, uae_u16 v)
 
 static uae_u8 l64111_bget(uaecptr addr)
 {
-       return l64111_wget(addr);
+       return (uae_u8)l64111_wget(addr);
 }
 static void l64111_bput(uaecptr addr, uae_u8 v)
 {
@@ -793,7 +793,7 @@ static void cl450_write_dram(int addr, uae_u16 w)
        if (!fmv_ram_bank.baseaddr)
                return;
        fmv_ram_bank.baseaddr[addr * 2 + 0] = w >> 8;
-       fmv_ram_bank.baseaddr[addr * 2 + 1] = w;
+       fmv_ram_bank.baseaddr[addr * 2 + 1] = (uae_u8)w;
 }
 
 #if DUMP_VIDEO
@@ -965,7 +965,7 @@ static void cl450_to_scr(void)
        v = ((uae_u64)cl450_regs[HOST_scr0] & 7) << 30;
        v |= (cl450_regs[HOST_scr1] & 0x7fff) << 15;
        v |= cl450_regs[HOST_scr2] & 0x7fff;
-       cl450_scr = v;
+       cl450_scr = (float)v;
 }
 
 static void cl450_reset_cmd(void)
@@ -1127,7 +1127,7 @@ static uae_u16 cl450_wget (uaecptr addr)
 static void cl450_data_wput(uae_u16 v)
 {
        fmv_ram_bank.baseaddr[CL450_MPEG_BUFFER + cl450_buffer_offset + 0] = v >> 8;
-       fmv_ram_bank.baseaddr[CL450_MPEG_BUFFER + cl450_buffer_offset + 1] = v;
+       fmv_ram_bank.baseaddr[CL450_MPEG_BUFFER + cl450_buffer_offset + 1] = (uae_u8)v;
        if (cl450_buffer_offset < CL450_MPEG_BUFFER_SIZE - 2)
                cl450_buffer_offset += 2;
 }
@@ -1235,7 +1235,7 @@ static void cl450_wput(uaecptr addr, uae_u16 v)
 
 static uae_u8 cl450_bget(uaecptr addr)
 {
-       return cl450_wget(addr);
+       return (uae_u8)cl450_wget(addr);
 }
 static void cl450_bput(uaecptr addr, uae_u8 v)
 {
@@ -1365,10 +1365,10 @@ static void REGPARAM2 fmv_bput (uaecptr addr, uae_u32 w)
                io_bput (addr, w);
 }
 
-static double max_sync_vpos;
-static double remaining_sync_vpos;
+static float max_sync_vpos;
+static float remaining_sync_vpos;
 
-void cd32_fmv_set_sync(double svpos, double adjust)
+void cd32_fmv_set_sync(float svpos, float adjust)
 {
        max_sync_vpos = svpos / adjust;
        fmv_syncadjust = adjust;
@@ -1480,7 +1480,7 @@ static void cd32_fmv_hsync_handler(void)
                return;
 
        if (cl450_play > 0)
-               cl450_scr += 90000.0 / (hblank_hz / fmv_syncadjust);
+               cl450_scr += 90000.0f / (hblank_hz / fmv_syncadjust);
 
        if (cl450_video_hsync_wait > 0)
                cl450_video_hsync_wait--;
@@ -1493,7 +1493,7 @@ static void cd32_fmv_hsync_handler(void)
                        cl450_videoram_read &= CL450_VIDEO_BUFFERS - 1;
                        cl450_videoram_cnt--;
                }
-               cl450_video_hsync_wait = max_sync_vpos;
+               cl450_video_hsync_wait = (int)max_sync_vpos;
                while (remaining_sync_vpos >= 1.0) {
                        cl450_video_hsync_wait++;
                        remaining_sync_vpos -= 1.0;
index 50f7fb93ca491c3d63d8cc2dc805e3e25356e787..d445abeec69c9030969f5303efa3d4c7be8d7500 100644 (file)
@@ -2855,15 +2855,6 @@ int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, b
        return cfgfile_yesno (option, value, name, location, true);
 }
 
-static int cfgfile_doubleval (const TCHAR *option, const TCHAR *value, const TCHAR *name, double *location)
-{
-       TCHAR *endptr;
-       if (name != NULL && _tcscmp (option, name) != 0)
-               return 0;
-       *location = _tcstod (value, &endptr);
-       return 1;
-}
-
 static int cfgfile_floatval (const TCHAR *option, const TCHAR *value, const TCHAR *name, const TCHAR *nameext, float *location)
 {
        TCHAR *endptr;
@@ -3762,14 +3753,14 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                while (s) {
                        if (!_tcschr (s, ':'))
                                break;
-                       p->osd_pos.x =  (int)(_tstof (s) * 10.0);
+                       p->osd_pos.x =  (int)(_tstof (s) * 10.0f);
                        s = _tcschr (s, ':');
                        if (!s)
                                break;
                        if (s[-1] == '%')
                                p->osd_pos.x += 30000;
                        s++;
-                       p->osd_pos.y = (int)(_tstof (s) * 10.0);
+                       p->osd_pos.y = (int)(_tstof (s) * 10.0f);
                        s += _tcslen (s);
                        if (s[-1] == '%')
                                p->osd_pos.y += 30000;
@@ -4173,7 +4164,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                int vert = -1, horiz = -1, lace = -1, ntsc = -1, framelength = -1, vsync = -1, hres = 0;
                bool locked = false, rtg = false, exit = false;
                bool cmdmode = false, defaultdata = false;
-               double rate = -1;
+               float rate = -1;
                int rpct = 0;
                TCHAR cmd[MAX_DPATH], filter[64] = { 0 }, label[16] = { 0 };
                TCHAR *tmpp = tmpbuf;
@@ -4202,7 +4193,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                                        tmpp += 4;
                                }
                                if (rate < 0)
-                                       rate = _tstof(tmpp);
+                                       rate = (float)_tstof(tmpp);
                                else if (!_tcsnicmp(tmpp, _T("v="), 2))
                                        vert = _tstol(equals);
                                else if (!_tcsnicmp(tmpp, _T("h="), 2))
@@ -5407,12 +5398,12 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con
                                        }
                                        p = cfgfile_option_get(buf2, _T("mid"));
                                        if (p) {
-                                               brc->roms[idx].manufacturer = _tstol(p);
+                                               brc->roms[idx].manufacturer = (uae_u16)_tstol(p);
                                                xfree(p);
                                        }
                                        p = cfgfile_option_get(buf2, _T("pid"));
                                        if (p) {
-                                               brc->roms[idx].product = _tstol(p);
+                                               brc->roms[idx].product = (uae_u8)_tstol(p);
                                                xfree(p);
                                        }
                                        p = cfgfile_option_get(buf2, _T("data"));
@@ -5628,7 +5619,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
                || cfgfile_intval(option, value, _T("fpu_revision"), &p->fpu_revision, 1)
                || cfgfile_intval(option, value, _T("fatgary"), &p->cs_fatgaryrev, 1)
                || cfgfile_intval(option, value, _T("ramsey"), &p->cs_ramseyrev, 1)
-               || cfgfile_doubleval(option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate)
+               || cfgfile_floatval(option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate)
                || cfgfile_intval(option, value, _T("cpuboardmem1_size"), &p->cpuboardmem1.size, 0x100000)
                || cfgfile_intval(option, value, _T("cpuboardmem2_size"), &p->cpuboardmem2.size, 0x100000)
                || cfgfile_intval(option, value, _T("debugmem_size"), &p->debugmem_size, 0x100000)
@@ -6081,10 +6072,10 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
                p->m68k_speed *= CYCLE_UNIT;
                return 1;
        }
-       if (cfgfile_doubleval(option, value, _T("cpu_throttle"), &p->m68k_speed_throttle)) {
+       if (cfgfile_floatval(option, value, _T("cpu_throttle"), &p->m68k_speed_throttle)) {
                return 1;
        }
-       if (cfgfile_doubleval(option, value, _T("cpu_x86_throttle"), &p->x86_speed_throttle)) {
+       if (cfgfile_floatval(option, value, _T("cpu_x86_throttle"), &p->x86_speed_throttle)) {
                return 1;
        }
        if (cfgfile_intval (option, value, _T("finegrain_cpu_speed"), &p->m68k_speed, 1)) {
@@ -6096,7 +6087,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
                        p->m68k_speed = -1;
                return 1;
        }
-       if (cfgfile_doubleval(option, value, _T("blitter_throttle"), &p->blitter_speed_throttle)) {
+       if (cfgfile_floatval(option, value, _T("blitter_throttle"), &p->blitter_speed_throttle)) {
                return 1;
        }
 
index 5c316c98569027b99816fdce8c76bb16a29a2ef1..aa1fc95cab841d4cb96b3a9c7ff214c46ba648ba 100644 (file)
@@ -1081,7 +1081,7 @@ static void REGPARAM2 mmu_put_lrmw_word_unaligned(uaecptr addr, uae_u16 val)
        SAVE_EXCEPTION;
        TRY(prb) {
                mmu_put_user_byte(addr, val >> 8, regs.s != 0, sz_word, true);
-               mmu_put_user_byte(addr + 1, val, regs.s != 0, sz_word, true);
+               mmu_put_user_byte(addr + 1, (uae_u8)val, regs.s != 0, sz_word, true);
                RESTORE_EXCEPTION;
        }
        CATCH(prb) {
@@ -1122,7 +1122,7 @@ void REGPARAM2 mmu_put_word_unaligned(uaecptr addr, uae_u16 val, bool data)
        SAVE_EXCEPTION;
        TRY(prb) {
                mmu_put_byte(addr, val >> 8, data, sz_word);
-               mmu_put_byte(addr + 1, val, data, sz_word);
+               mmu_put_byte(addr + 1, (uae_u8)val, data, sz_word);
                RESTORE_EXCEPTION;
        }
        CATCH(prb) {
@@ -1251,7 +1251,7 @@ void REGPARAM2 dfc_put_word(uaecptr addr, uae_u16 val)
                        mmu_put_user_word(addr, val, super, sz_word, false);
                } else {
                        mmu_put_user_byte(addr, val >> 8, super, sz_word, false);
-                       mmu_put_user_byte(addr + 1, val, super, sz_word, false);
+                       mmu_put_user_byte(addr + 1, (uae_u8)val, super, sz_word, false);
                }
                RESTORE_EXCEPTION;
        }
index e4019a8ef7c833c812d74100f0f63035a534eaea..692cc907087416ceba48d54af64575be7535932b 100644 (file)
@@ -398,7 +398,7 @@ bool mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
         case 0x12: // SRP
             if (rw) {
                 x_put_long (extra, srp_030 >> 32);
-                x_put_long (extra + 4, srp_030);
+                x_put_long (extra + 4, (uae_u32)srp_030);
             } else {
                 srp_030 = (uae_u64)x_get_long (extra) << 32;
                 srp_030 |= x_get_long (extra + 4);
@@ -409,7 +409,7 @@ bool mmu_op30_pmove (uaecptr pc, uae_u32 opcode, uae_u16 next, uaecptr extra)
         case 0x13: // CRP
             if (rw) {
                 x_put_long (extra, crp_030 >> 32);
-                x_put_long (extra + 4, crp_030);
+                x_put_long (extra + 4, (uae_u32)crp_030);
             } else {
                 crp_030 = (uae_u64)x_get_long (extra) << 32;
                 crp_030 |= x_get_long (extra + 4);
@@ -989,7 +989,7 @@ bool mmu030_decode_tc(uae_u32 TC, bool check)
 
 bool mmu030_decode_rp(uae_u64 RP) {
     
-    uae_u8 descriptor_type = (RP & RP_DESCR_MASK) >> 32;
+    uae_u8 descriptor_type = (uae_u8)((RP & RP_DESCR_MASK) >> 32);
     if (!descriptor_type) { /* If descriptor type is invalid */
         write_log(_T("MMU Configuration Exception: Root Pointer is invalid!\n"));
         Exception(56); /* MMU Configuration Exception */
@@ -2912,7 +2912,7 @@ void m68k_do_rte_mmu030 (uaecptr a7)
                uae_u32 mmu030_state_1 = get_word_mmu030(a7 + 0x32);
                uae_u32 mmu030_state_2 = get_word_mmu030(a7 + 0x34);
 
-               uae_u32 mmu030_opcode_v = (ps & 0x80000000) ? -1U : (oc & 0xffff);
+               uae_u32 mmu030_opcode_v = (ps & 0x80000000) ? 0xffffffff : (oc & 0xffff);
 
                uae_u32 mmu030_fmovem_store_0 = 0;
                uae_u32 mmu030_fmovem_store_1 = 0;
@@ -2956,7 +2956,7 @@ void m68k_do_rte_mmu030 (uaecptr a7)
                // did we have ins fault and RB bit cleared?
                if ((ssw & MMU030_SSW_FB) && !(ssw & MMU030_SSW_RB)) {
                        uae_u16 stageb = get_word_mmu030(a7 + 0x0e);
-                       if (mmu030_opcode_v == -1U) {
+                       if (mmu030_opcode_v == 0xffffffff) {
                                mmu030_opcode_stageb = stageb;
                                write_log(_T("Software fixed stage B! opcode = %04x\n"), stageb);
                        } else {
@@ -3360,7 +3360,7 @@ void m68k_do_rte_mmu030c (uaecptr a7)
                uae_u32 mmu030_state_1 = get_word_mmu030c(a7 + 0x32);
                uae_u32 mmu030_state_2 = get_word_mmu030c(a7 + 0x34);
 
-               uae_u32 mmu030_opcode_v = (ps & 0x80000000) ? -1U : (oc & 0xffff);
+               uae_u32 mmu030_opcode_v = (ps & 0x80000000) ? 0xffffffff : (oc & 0xffff);
 
                uae_u32 mmu030_fmovem_store_0 = 0;
                uae_u32 mmu030_fmovem_store_1 = 0;
index baec81c66b7477305d408557760b22ce5fabd5a3..564a21abee28310a8777a5106e6b8e5db5d7c06b 100644 (file)
@@ -5496,13 +5496,13 @@ static void reset_decisions_hsync_start(void)
        }
 }
 
-int vsynctimebase_orig;
+frame_time_t vsynctimebase_orig;
 
 void compute_vsynctime(void)
 {
-       double svpos = maxvpos_nom;
-       double shpos = maxhpos_short;
-       double syncadjust = 1.0;
+       float svpos = maxvpos_nom + 0.0f;
+       float shpos = maxhpos_short + 0.0f;
+       float syncadjust = 1.0;
 
        fake_vblank_hz = 0;
        vblank_hz_mult = 0;
@@ -5535,15 +5535,15 @@ void compute_vsynctime(void)
        vsynctimebase_orig = vsynctimebase;
 
        if (islinetoggle()) {
-               shpos += 0.5;
+               shpos += 0.5f;
        }
        if (interlace_seen) {
-               svpos += 0.5;
+               svpos += 0.5f;
        } else if (lof_display) {
-               svpos += 1.0;
+               svpos += 1.0f;
        }
        if (currprefs.produce_sound > 1) {
-               double clk = svpos * shpos * fake_vblank_hz;
+               float clk = svpos * shpos * fake_vblank_hz;
                write_log(_T("SNDRATE %.1f*%.1f*%.6f=%.6f\n"), svpos, shpos, fake_vblank_hz, clk);
                devices_update_sound(clk, syncadjust);
        }
@@ -5870,32 +5870,34 @@ void compute_framesync(void)
 
        struct chipset_refresh *cr = get_chipset_refresh(&currprefs);
        while (cr) {
-               double v = -1;
+               float v = -1;
                if (!ad->picasso_on && !ad->picasso_requested_on) {
                        if (isvsync_chipset ()) {
                                if (!currprefs.gfx_variable_sync) {
                                        if (cr->index == CHIPSET_REFRESH_PAL || cr->index == CHIPSET_REFRESH_NTSC) {
-                                               if ((fabs(vblank_hz - 50.0) < 1 || fabs(vblank_hz - 60.0) < 1 || fabs(vblank_hz - 100.0) < 1 || fabs(vblank_hz - 120.0) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) {
+                                               if ((fabs(vblank_hz - 50.0f) < 1 || fabs(vblank_hz - 60.0f) < 1 || fabs(vblank_hz - 100.0) < 1 || fabs(vblank_hz - 120.0f) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) {
                                                        vsync_switchmode(0, (int)vblank_hz);
                                                }
                                        }
                                        if (isvsync_chipset() < 0) {
 
-                                               double v2;
+                                               float v2;
                                                v2 = target_getcurrentvblankrate(0);
                                                if (!cr->locked)
                                                        v = v2;
                                        } else if (isvsync_chipset() > 0) {
-                                               if (currprefs.gfx_apmode[0].gfx_refreshrate)
-                                                       v = abs(currprefs.gfx_apmode[0].gfx_refreshrate);
+                                               if (currprefs.gfx_apmode[0].gfx_refreshrate) {
+                                                       v = (float)abs(currprefs.gfx_apmode[0].gfx_refreshrate);
+                                               }
                                        }
                                }
                        } else {
                                if (cr->locked == false) {
                                        changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = vblank_hz;
                                        cfgfile_parse_lines (&changed_prefs, cr->commands, -1);
-                                       if (cr->commands[0])
-                                               write_log (_T("CMD1: '%s'\n"), cr->commands);
+                                       if (cr->commands[0]) {
+                                               write_log(_T("CMD1: '%s'\n"), cr->commands);
+                                       }
                                        break;
                                } else {
                                        v = cr->rate;
@@ -5906,8 +5908,9 @@ void compute_framesync(void)
                        if (v > 0) {
                                changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = v;
                                cfgfile_parse_lines (&changed_prefs, cr->commands, -1);
-                               if (cr->commands[0])
-                                       write_log (_T("CMD2: '%s'\n"), cr->commands);
+                               if (cr->commands[0]) {
+                                       write_log(_T("CMD2: '%s'\n"), cr->commands);
+                               }
                        }
                } else {
                        if (cr->locked == false)
@@ -5916,8 +5919,9 @@ void compute_framesync(void)
                                v = cr->rate;
                        changed_prefs.chipset_refreshrate = currprefs.chipset_refreshrate = v;
                        cfgfile_parse_lines (&changed_prefs, cr->commands, -1);
-                       if (cr->commands[0])
-                               write_log (_T("CMD3: '%s'\n"), cr->commands);
+                       if (cr->commands[0]) {
+                               write_log(_T("CMD3: '%s'\n"), cr->commands);
+                       }
                }
                found = true;
                break;
@@ -6022,7 +6026,7 @@ void compute_framesync(void)
 
        compute_vsynctime();
 
-       hblank_hz = (currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL) / (maxhpos + (islinetoggle() ? 0.5 : 0));
+       hblank_hz = (currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL) / (maxhpos + (islinetoggle() ? 0.5f : 0.0f));
 
        write_log(_T("%s mode%s%s V=%.4fHz H=%0.4fHz (%dx%d+%d) IDX=%d (%s) D=%d RTG=%d/%d\n"),
                isntsc ? _T("NTSC") : _T("PAL"),
@@ -6091,7 +6095,7 @@ static void init_hz(bool checkvposw)
        if (!ecs_agnus) {
                isntsc = currprefs.ntscmode ? 1 : 0;
        }
-       float clk = currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL;
+       float clk = (float)(currprefs.ntscmode ? CHIPSET_CLOCK_NTSC : CHIPSET_CLOCK_PAL);
        if (!isntsc) {
                maxvpos = MAXVPOS_PAL;
                maxhpos = MAXHPOS_PAL;
@@ -6100,9 +6104,9 @@ static void init_hz(bool checkvposw)
                hardwired_vbstop = VBLANK_STOP_PAL;
                equ_vblank_endline = EQU_ENDLINE_PAL;
                equ_vblank_toggle = true;
-               vblank_hz_shf = clk / ((maxvpos + 0) * maxhpos);
-               vblank_hz_lof = clk / ((maxvpos + 1.0) * maxhpos);
-               vblank_hz_lace = clk / ((maxvpos + 0.5) * maxhpos);
+               vblank_hz_shf = clk / ((maxvpos + 0.0f) * maxhpos);
+               vblank_hz_lof = clk / ((maxvpos + 1.0f) * maxhpos);
+               vblank_hz_lace = clk / ((maxvpos + 0.5f) * maxhpos);
        } else {
                maxvpos = MAXVPOS_NTSC;
                maxhpos = MAXHPOS_NTSC;
@@ -6111,9 +6115,9 @@ static void init_hz(bool checkvposw)
                hardwired_vbstop = VBLANK_STOP_NTSC;
                equ_vblank_endline = EQU_ENDLINE_NTSC;
                equ_vblank_toggle = false;
-               vblank_hz_shf = clk / ((maxvpos + 0) * (maxhpos + 0.5));
-               vblank_hz_lof = clk / ((maxvpos + 1.0) * (maxhpos + 0.5));
-               vblank_hz_lace = clk / ((maxvpos + 0.5) * (maxhpos + 0.5));
+               vblank_hz_shf = clk / ((maxvpos + 0.0f) * (maxhpos + 0.5f));
+               vblank_hz_lof = clk / ((maxvpos + 1.0f) * (maxhpos + 0.5f));
+               vblank_hz_lace = clk / ((maxvpos + 0.5f) * (maxhpos + 0.5f));
        }
 
        dmal_htotal_mask = 0xffff;
@@ -6279,7 +6283,7 @@ static void init_hz(bool checkvposw)
                if (vpos_count < 10) {
                        vpos_count = 10;
                }
-               vblank_hz = (isntsc ? 15734.0 : 15625.0) / vpos_count;
+               vblank_hz = (isntsc ? 15734.0f : 15625.0f) / vpos_count;
                vblank_hz_nom = vblank_hz_shf = vblank_hz_lof = vblank_hz_lace = (float)vblank_hz;
                maxvpos_nom = vpos_count - (lof_store ? 1 : 0);
                if ((maxvpos_nom >= 256 && maxvpos_nom <= 313) || (beamcon0 & BEAMCON0_VARBEAMEN)) {
@@ -6366,8 +6370,8 @@ static void init_hz(bool checkvposw)
        if (beamcon0 & BEAMCON0_VARBEAMEN) {
                vblank_hz_nom = vblank_hz = clk / (maxvpos * maxhpos);
                vblank_hz_shf = vblank_hz;
-               vblank_hz_lof = clk / ((maxvpos + 1) * maxhpos);
-               vblank_hz_lace = clk / ((maxvpos + 0.5) * maxhpos);
+               vblank_hz_lof = clk / ((maxvpos + 1.0f) * maxhpos);
+               vblank_hz_lace = clk / ((maxvpos + 0.5f) * maxhpos);
 
                maxvpos_nom = maxvpos;
                maxvpos_display = maxvpos;
@@ -8429,7 +8433,7 @@ static void SPRxDATB_1(uae_u16 v, int num, int hpos)
 static void sprite_get_bpl_data(int hpos, struct sprite *s, uae_u16 *dat)
 {
        int nr = get_bitplane_dma_rel(hpos, 1);
-       uae_u32 v = (fmode & 3) ? fetched_aga[nr] : fetched_aga_spr[nr];
+       uae_u32 v = (uae_u32)((fmode & 3) ? fetched_aga[nr] : fetched_aga_spr[nr]);
        dat[0] = v >> 16;
        dat[1] = (uae_u16)v;
 }
@@ -10420,7 +10424,7 @@ static bool framewait(void)
                }
                if (!currprefs.cpu_thread) {
                        while (!currprefs.turbo_emulation) {
-                               float v = rpt_vsync(clockadjust) / (syncbase / 1000.0);
+                               float v = rpt_vsync(clockadjust) / (syncbase / 1000.0f);
                                if (v >= -FRAMEWAIT_MIN_MS)
                                        break;
                                rtg_vsynccheck();
@@ -10501,7 +10505,7 @@ static void fpscounter(bool frameok)
 
        if ((timeframes & 7) == 0) {
                double idle = 1000 - (idle_mavg.mavg == 0 ? 0.0 : (double)idle_mavg.mavg * 1000.0 / vsynctimebase);
-               int fps = fps_mavg.mavg == 0 ? 0 : syncbase * 10 / fps_mavg.mavg;
+               int fps = fps_mavg.mavg == 0 ? 0 : (int)(syncbase * 10 / fps_mavg.mavg);
                if (fps > 99999)
                        fps = 99999;
                if (idle < 0)
@@ -11455,7 +11459,7 @@ static void scanlinesleep(int currline, int nextline)
        if (currline >= nextline)
                return;
        if (vsync_hblank) {
-               int diff = vsync_hblank / (nextline - currline);
+               int diff = (int)(vsync_hblank / (nextline - currline));
                int us = 1000000 / diff;
                if (us < target_sleep_nanos(-1)) { // spin if less than minimum sleep time
                        target_spin(nextline - currline - 1);
@@ -11519,7 +11523,7 @@ static bool linesync_beam_single_dual(void)
                frame_rendered = true;
                frame_shown = true;
                do_display_slice();
-               int vv = vsync_vblank;
+               int vv = (int)vsync_vblank;
                while (vv >= 85) {
                        while (!currprefs.turbo_emulation && sync_timeout_check(maxtime)) {
                                maybe_process_pull_audio();
@@ -11711,7 +11715,7 @@ static bool linesync_beam_multi_dual(void)
 
                        if (is_last_line()) {
                                // wait extra frames
-                               int vv = vsync_vblank;
+                               int vv = (int)vsync_vblank;
                                for(;;) {
                                        while (!currprefs.turbo_emulation && sync_timeout_check(maxtime)) {
                                                maybe_process_pull_audio();
@@ -14062,6 +14066,7 @@ uae_u8 *save_custom_sprite(int num, int *len, uae_u8 *dstptr)
 uae_u8 *restore_custom_extra(uae_u8 *src)
 {
        uae_u32 v = restore_u32();
+       uae_u8 tmp = 0;
 
        if (!(v & 1))
                v = 0;
@@ -14077,9 +14082,9 @@ uae_u8 *restore_custom_extra(uae_u8 *src)
 
        //currprefs.a2091rom.enabled = changed_prefs.a2091rom.enabled = RBB;
        //currprefs.a4091rom.enabled = changed_prefs.a4091rom.enabled = RBB;
-       RBB;
-       RBB;
-       RBB;
+       tmp = RBB;
+       tmp = RBB;
+       tmp = RBB;
 
        currprefs.cs_pcmcia = changed_prefs.cs_pcmcia = RBB;
        currprefs.cs_ciaatod = changed_prefs.cs_ciaatod = RB;
index 21334629b0cdb3311f72473d54b4cc5a8c3a8dc0..f11b3695425477d6e8ad38352545bcba796145ae 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -79,7 +79,7 @@ static int trace_cycles;
 static int last_hpos1, last_hpos2;
 static int last_vpos1, last_vpos2;
 static int last_frame = -1;
-static uae_u32 last_cycles1, last_cycles2;
+static evt_t last_cycles1, last_cycles2;
 
 static uaecptr processptr;
 static uae_char *processname;
@@ -1814,7 +1814,7 @@ static void memwatch_heatmap(uaecptr addr, int rwi, int size, uae_u32 accessmask
 
 struct refdata
 {
-       uae_u32 c;
+       evt_t c;
        uae_u32 cnt;
 };
 static struct refdata refreshtable[1024];
@@ -1825,7 +1825,7 @@ static void check_refreshed(void)
 {
        int max = ecs_agnus ? 512 : 256;
        int reffail = 0;
-       uae_u32 c = get_cycles();
+       evt_t c = get_cycles();
        for (int i = 0; i < max; i++) {
                struct refdata *rd = &refreshtable[i];
                if (rd->cnt < 10) {
@@ -1860,7 +1860,7 @@ void debug_mark_refreshed(uaecptr rp)
                ras = (rp >> 1) & 0xff;
        }
        struct refdata *rd = &refreshtable[ras];
-       uae_u32 c = get_cycles();
+       evt_t c = get_cycles();
        rd->c = c;
        rd->cnt = 0;
 }
@@ -1966,7 +1966,7 @@ void record_dma_read_value_wide(uae_u64 v, bool quad)
 {
        if (last_dma_rec) {
                if (last_dma_rec->cf_reg != 0xffff) {
-                       last_dma_rec->cf_dat = v;
+                       last_dma_rec->cf_dat = (uae_u16)v;
                } else {
                        last_dma_rec->dat = v;
                }
@@ -2033,7 +2033,7 @@ void record_dma_read(uae_u16 reg, uae_u32 addr, int hpos, int vpos, int type, in
        debug_mark_refreshed(dr->addr);
 }
 
-static bool get_record_dma_info(struct dma_rec *dr, int hpos, int vpos, uae_u32 cycles, TCHAR *l1, TCHAR *l2, TCHAR *l3, TCHAR *l4, TCHAR *l5)
+static bool get_record_dma_info(struct dma_rec *dr, int hpos, int vpos, evt_t cycles, TCHAR *l1, TCHAR *l2, TCHAR *l3, TCHAR *l4, TCHAR *l5)
 {
        int longsize = dr->size;
        bool got = false;
@@ -2274,7 +2274,7 @@ static void decode_dma_record (int hpos, int vpos, int toggle, bool logfile)
 {
        struct dma_rec *dr, *dr_start;
        int h, i, maxh;
-       uae_u32 cycles;
+       evt_t cycles;
 
        if (!dma_record[0] || hpos < 0 || vpos < 0)
                return;
@@ -5474,9 +5474,9 @@ static void debug_sprite (TCHAR **inptr)
                        console_out_f (_T("%04X "), get_word_debug (addr + i * 2));
                console_out_f (_T("\n"));
 
-               ypos = w1 >> 8;
+               ypos = (int)(w1 >> 8);
                xpos = w1 & 255;
-               ypose = w2 >> 8;
+               ypose = (int)(w2 >> 8);
                attach = (w2 & 0x80) ? 1 : 0;
                if (w2 & 4)
                        ypos |= 256;
@@ -7679,7 +7679,7 @@ struct dsprintfstack
 };
 static dsprintfstack debugsprintf_stack[DEBUGSPRINTF_SIZE];
 static uae_u16 debugsprintf_latch, debugsprintf_latched;
-static uae_u32 debugsprintf_cycles, debugsprintf_cycles_set;
+static evt_t debugsprintf_cycles, debugsprintf_cycles_set;
 static uaecptr debugsprintf_va;
 static int debugsprintf_mode;
 
@@ -7731,7 +7731,7 @@ static void parse_custom(char *out, int buffersize, char *format, char *p, char
        char s[256];
        if (!strcmp(p, "CYCLES")) {
                if (debugsprintf_cycles_set) {
-                       v = (get_cycles() - debugsprintf_cycles) / CYCLE_UNIT;
+                       v = (uae_u32)((get_cycles() - debugsprintf_cycles) / CYCLE_UNIT);
                } else {
                        v = 0xffffffff;
                }
index 439c1724ae837775143027b165259a8ee3724a13..0e8215737f11017cd4848d5b17fa32f1c1c6131c 100644 (file)
@@ -271,7 +271,7 @@ void devices_rethink(void)
        cpuboard_rethink();
 }
 
-void devices_update_sound(double clk, double syncadjust)
+void devices_update_sound(float clk, float syncadjust)
 {
        update_sound (clk);
        update_sndboard_sound (clk / syncadjust);
@@ -279,7 +279,7 @@ void devices_update_sound(double clk, double syncadjust)
        x86_update_sound(clk / syncadjust);
 }
 
-void devices_update_sync(double svpos, double syncadjust)
+void devices_update_sync(float svpos, float syncadjust)
 {
        cd32_fmv_set_sync(svpos, syncadjust);
 }
index 109fe4919be1d85083e3643f7933586d646c2843..f75942624247914e6c3669c04432a54a7a75a418 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -127,7 +127,7 @@ static uae_u16 fifo[3];
 static int fifo_inuse[3];
 static int dma_enable, bitoffset, syncoffset;
 static uae_u16 word, dsksync;
-static unsigned long dsksync_cycles;
+static evt_t dsksync_cycles;
 #define WORDSYNC_TIME 11
 /* Always carried through to the next line.  */
 int disk_hpos;
@@ -203,7 +203,7 @@ typedef struct {
        int dskready_down_time;
        int writtento;
        int steplimit;
-       frame_time_t steplimitcycle;
+       evt_t steplimitcycle;
        int indexhack, indexhackmode;
        int ddhd; /* 1=DD 2=HD */
        int drive_id_scnt; /* drive id shift counter */
@@ -1722,7 +1722,7 @@ static void set_steplimit (drive *drv)
        if (currprefs.m68k_speed != 0)
                return;
        drv->steplimit = 4;
-       drv->steplimitcycle = get_cycles ();
+       drv->steplimitcycle = get_cycles();
 }
 
 static bool drive_empty (drive * drv)
@@ -4240,7 +4240,7 @@ uae_u16 DSKBYTR (int hpos)
        DISK_update (hpos);
        v = dskbytr_val;
        dskbytr_val &= ~0x8000;
-       if (word == dsksync && cycles_in_range (dsksync_cycles)) {
+       if (word == dsksync && cycles_in_range(dsksync_cycles)) {
                v |= 0x1000;
                if (disk_debug_logging > 1) {
                        dumpdisk(_T("DSKBYTR SYNC"));
index 85609d28c26d49bd0ebe7c5fb01336946dccf4f4..1a529dcd97d0960f1d6c4a6684caf81609eed4c4 100644 (file)
@@ -30,7 +30,7 @@
 #define SCALA_GREEN 12
 
 static int dflag;
-static unsigned int cycles;
+static frame_time_t cycles;
 
 /*
 RoboCop 3
index dd22aa686cf6a04ab261db6422d6ee4a484c0f1e..58c6233ae7400605b91c35fc6b78459f63fe3fe6 100644 (file)
@@ -85,7 +85,7 @@ static int loadsample (TCHAR *path, struct drvsample *ds)
                }
        }
        zfile_fseek (f, 0, SEEK_END);
-       size = zfile_ftell (f);
+       size = zfile_ftell32(f);
        buf = xmalloc (uae_u8, size);
        zfile_fseek (f, 0, SEEK_SET);
        zfile_fread (buf, size, 1, f);
index 09f5a9045b6bc740d52b5904eb6199e5afd4b27d..f3ffc00f1b1e713769c835989ac76c106ae5beee 100644 (file)
@@ -506,7 +506,7 @@ static int selectfont(Bit16u style)
        int lx = GetDeviceCaps (memHDC, LOGPIXELSX);
        int rounds = 0;
        while (rounds < 2) {
-               curFont = CreateFont (thisFontVertPoints * dpiY / ly + 0.5, thisFontHorizPoints * dpiX / lx + 0.5,
+               curFont = CreateFont ((int)(thisFontVertPoints * dpiY / ly + 0.5), (int)(thisFontHorizPoints * dpiX / lx + 0.5),
                        0, 0,
                        FW_NORMAL,
                        (style & STYLE_ITALICS) ? TRUE : FALSE,
@@ -1029,7 +1029,7 @@ static void initPrinter(void)
 
        // Default tabs => Each eight characters
        for (i = 0; i < 32; i++)
-               horiztabs[i] = i * 8 * (1.0 / (Real64)cpi);
+               horiztabs[i] = i * 8.0f * (1.0f / (Real64)cpi);
        numHorizTabs = 32;
 
        numVertTabs = 255;
@@ -1492,7 +1492,7 @@ static int processCommandChar(Bit8u ch)
                        }
                        break;
                case 0x21: // Master select (ESC !)
-                       cpi = params[0] & 0x01 ? 12:10;
+                       cpi = (params[0] & 0x01 ? 12:10) + 0.0f;
 
                        // Reset first seven bits
                        style &= 0xFF80;
@@ -2275,7 +2275,7 @@ static void printSingleChar(Bit8u ch, int doprint)
        else
        {
                if (hmi < 0)
-                       curX += 1.0/(Real64)actcpi;
+                       curX += 1.0f / (Real64)actcpi;
                else
                        curX += hmi;
        }
@@ -2294,7 +2294,7 @@ static void printSingleChar(Bit8u ch, int doprint)
                if (style & STYLE_STRIKETHROUGH)
                        lineY = PIXY + deltaY + ascender / 2;
                if (style & STYLE_OVERSCORE)
-                       lineY = PIXY + deltaY - otm->otmTextMetrics.tmDescent - ((score == SCORE_DOUBLE || score == SCORE_DOUBLEBROKEN) ? 5 : 0);
+                       lineY = (uae_u16)(PIXY + deltaY - otm->otmTextMetrics.tmDescent - ((score == SCORE_DOUBLE || score == SCORE_DOUBLEBROKEN) ? 5 : 0));
 
                drawLine(lineStart, xEnd, lineY, score == SCORE_SINGLEBROKEN || score == SCORE_DOUBLEBROKEN);
                if (score == SCORE_DOUBLE || score == SCORE_DOUBLEBROKEN)
index 649e1b00d336bce46e38d6d398dade4583297356..348871765b220ab785a686f037e200c3fe3ad263 100644 (file)
@@ -2018,7 +2018,7 @@ FDI *fdi2raw_header(struct zfile *f)
        fdi = fdi_malloc (FDI, 1);
        memset (fdi, 0, sizeof (FDI));
        fdi->file = f;
-       oldseek = zfile_ftell (fdi->file);
+       oldseek = zfile_ftell32(fdi->file);
        zfile_fseek (fdi->file, 0, SEEK_SET);
        zfile_fread (fdi->header, 2048, 1, fdi->file);
        zfile_fseek (fdi->file, oldseek, SEEK_SET);
index c094884f9a32bb6178f4783f718bd3ede73b8282..52a9ad2f412c000a7c2d363795a78275875e1c91 100644 (file)
@@ -1483,8 +1483,8 @@ struct hardfiledata *get_hardfile_data (int nr)
 
 static uae_u32 a_uniq, key_uniq;
 
-#define PUT_PCK_RES1(p,v) do { put_long_host((p)->packet_data + dp_Res1, (v)); } while (0)
-#define PUT_PCK_RES2(p,v) do { put_long_host((p)->packet_data + dp_Res2, (v)); } while (0)
+#define PUT_PCK_RES1(p,v) do { put_long_host((p)->packet_data + dp_Res1, ((uae_u32)v)); } while (0)
+#define PUT_PCK_RES2(p,v) do { put_long_host((p)->packet_data + dp_Res2, ((uae_u32)v)); } while (0)
 #define GET_PCK_TYPE(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Type)))
 #define GET_PCK_RES1(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Res1)))
 #define GET_PCK_RES2(p) ((uae_s32)(get_long_host((p)->packet_data + dp_Res2)))
@@ -1641,11 +1641,11 @@ void timeval_to_amiga (struct mytimeval *tv, int *days, int *mins, int *ticks, i
        t -= diff;
        if (t < 0)
                t = 0;
-       *days = t / msecs_per_day;
+       *days = (int)(t / msecs_per_day);
        t -= *days * msecs_per_day;
-       *mins = t / (60 * 1000);
+       *mins = (int)(t / (60 * 1000));
        t -= *mins * (60 * 1000);
-       *ticks = t / (1000 / tickcount);
+       *ticks = (int)(t / (1000 / tickcount));
 }
 
 void amiga_to_timeval (struct mytimeval *tv, int days, int mins, int ticks, int tickcount)
@@ -1754,7 +1754,7 @@ static unsigned int fs_read (struct fs_filehandle *fsf, void *b, unsigned int si
        else if (fsf->fstype == FS_DIRECTORY)
                return my_read (fsf->of, b, size);
        else if (fsf->fstype == FS_CDFS)
-               return isofs_read (fsf->isof, b, size);
+               return (unsigned int)isofs_read (fsf->isof, b, size);
        return 0;
 }
 static unsigned int fs_write (struct fs_filehandle *fsf, void *b, unsigned int size)
@@ -1775,7 +1775,7 @@ static uae_s64 fs_lseek64 (struct fs_filehandle *fsf, uae_s64 offset, int whence
                return isofs_lseek (fsf->isof, offset, whence);
        return -1;
 }
-static uae_s32 fs_lseek (struct fs_filehandle *fsf, uae_s32 offset, int whence)
+static uae_s32 fs_lseek (struct fs_filehandle *fsf, uae_s64 offset, int whence)
 {
        uae_s64 v = fs_lseek64 (fsf, offset, whence);
        if (v < 0 || v > 0x7fffffff)
@@ -3630,7 +3630,7 @@ static a_inode *find_aino(TrapContext* ctx, Unit *unit, uaecptr lock, const TCHA
        return a;
 }
 
-static uaecptr make_lock(TrapContext *ctx, Unit *unit, uae_u32 uniq, long mode)
+static uaecptr make_lock(TrapContext *ctx, Unit *unit, uae_u32 uniq, uae_u32 mode)
 {
        /* allocate lock from the list kept by the assembly code */
        uaecptr lock;
@@ -4227,7 +4227,7 @@ static void get_fileinfo(TrapContext *ctx, Unit *unit, dpacket *packet, uaecptr
 
        blocksize = (unit->volflags & MYVOLUMEINFO_CDFS) ? 2048 : 512;
        numblocks = (statbuf.size + blocksize - 1) / blocksize;
-       put_long_host(buf + 128, numblocks > MAXFILESIZE32 ? MAXFILESIZE32 : numblocks);
+       put_long_host(buf + 128, (uae_u32)(numblocks > MAXFILESIZE32 ? MAXFILESIZE32 : numblocks));
 
        if (longfilesize) {
                /* MorphOS 64-bit file length support */
@@ -4305,7 +4305,7 @@ static struct lockrecord *new_record (dpacket *packet, uae_u64 pos, uae_u64 len,
        lr->pos = pos;
        lr->len = len;
        lr->mode = mode;
-       lr->timeout = timeout * vblank_hz / 50;
+       lr->timeout = (uae_u32)(timeout * vblank_hz / 50);
        lr->msg = msg;
        return lr;
 }
@@ -4596,7 +4596,7 @@ static int exalldo(TrapContext *ctx, uaecptr exalldata, uae_u32 exalldatasize, u
        if (type >= 2)
                trap_put_long(ctx, exp + 8, entrytype);
        if (type >= 3)
-               trap_put_long(ctx, exp + 12, statbuf.size > MAXFILESIZE32 ? MAXFILESIZE32 : statbuf.size);
+               trap_put_long(ctx, exp + 12, (uae_u32)(statbuf.size > MAXFILESIZE32 ? MAXFILESIZE32 : statbuf.size));
        if (type >= 4)
                trap_put_long(ctx, exp + 16, flags);
        if (type >= 5) {
@@ -4606,7 +4606,7 @@ static int exalldo(TrapContext *ctx, uaecptr exalldata, uae_u32 exalldatasize, u
        }
        if (type >= 6) {
                trap_put_long(ctx, exp + 32, exp + size2);
-               trap_put_byte(ctx, exp + size2, strlen (comment));
+               trap_put_byte(ctx, exp + size2, (uae_u8)strlen(comment));
                for (i = 0; i <= strlen (comment); i++) {
                        trap_put_byte(ctx, exp + size2, comment[i]);
                        size2++;
@@ -5414,7 +5414,7 @@ static void       action_read(TrapContext *ctx, Unit *unit, dpacket *packet)
                filesize = key_filesize(k);
                cur = k->file_pos;
                if (size > filesize - cur)
-                       size = filesize - cur;
+                       size = (uae_u32)(filesize - cur);
 
                if (size == 0) {
                        PUT_PCK_RES1 (packet, 0);
@@ -7129,7 +7129,7 @@ static int filesys_iteration(UnitInfo *ui)
                { TRAPCMD_GET_LONG, { ui->self->locklist }, 2, 1 },
                { TRAPCMD_PUT_LONG },
                { TRAPCMD_PUT_LONG, { ui->self->locklist, morelocks }},
-               { ui->self->volume ? TRAPCMD_GET_BYTE : TRAPCMD_NOP, { ui->self->volume + 64 }},
+               { (uae_u16)(ui->self->volume ? TRAPCMD_GET_BYTE : TRAPCMD_NOP), { ui->self->volume + 64 }},
        };
        trap_multi(ctx, md, sizeof md / sizeof(struct trapmd));
 
@@ -8101,7 +8101,7 @@ static uae_u32 REGPARAM2 filesys_dev_remember (TrapContext *ctx)
                trap_put_bytes(ctx, fs, addr, fssize);
                // filesystem debugging, negative FSSIZE = debug mode.
                if (segtrack_mode & 2) {
-                       trap_put_long(ctx, parmpacket + PP_FSSIZE, -trap_get_long(ctx, parmpacket + PP_FSSIZE));
+                       trap_put_long(ctx, parmpacket + PP_FSSIZE, 0 - trap_get_long(ctx, parmpacket + PP_FSSIZE));
                }
        }
 
@@ -8144,7 +8144,7 @@ static int rdb_checksum (const uae_char *id, uae_u8 *p, int block)
                return 0;
        for (i = 0; i < blocksize; i++)
                sum += rl (p + i * 4);
-       sum = -sum;
+       sum = 0 - sum;
        if (sum) {
                TCHAR *s = au (id);
                write_log (_T("RDB: block %d ('%s') checksum error\n"), block, s);
@@ -8863,7 +8863,7 @@ static int dofakefilesys (TrapContext *ctx, UnitInfo *uip, uaecptr parmpacket, s
        }
 
        zfile_fseek (zf, 0, SEEK_END);
-       size = zfile_ftell (zf);
+       size = zfile_ftell32(zf);
        if (size > 0) {
                zfile_fseek (zf, 0, SEEK_SET);
                uip->rdb_filesysstore = xmalloc (uae_u8, size);
@@ -9061,7 +9061,7 @@ static uae_u32 REGPARAM2 filesys_dev_storeinfo (TrapContext *ctx)
                        }
                        memset(buf, 0, sizeof buf);
                        char *s = ua_fs(uip[unit_no].devname, -1);
-                       buf[36] = strlen(s);
+                       buf[36] = (uae_u8)strlen(s);
                        for (int i = 0; i < buf[36]; i++)
                                buf[37 + i] = s[i];
                        xfree(s);
@@ -9645,11 +9645,11 @@ static uae_u8 *restore_aino (UnitInfo *ui, Unit *u, uae_u8 *src)
 
        missing = 0;
        a = xcalloc (a_inode, 1);
-       a->uniq = restore_u64 ();
-       a->locked_children = restore_u32 ();
-       a->exnext_count = restore_u32 ();
-       a->shlock = restore_u32 ();
-       flags = restore_u32 ();
+       a->uniq = restore_u64to32();
+       a->locked_children = restore_u32();
+       a->exnext_count = restore_u32();
+       a->shlock = restore_u32();
+       flags = restore_u32();
        if (flags & 1)
                a->elock = 1;
        if (flags & 4)
@@ -9726,15 +9726,15 @@ static uae_u8 *restore_key (UnitInfo *ui, Unit *u, uae_u8 *src)
 
        missing = 0;
        k = xcalloc (Key, 1);
-       k->uniq = restore_u64 ();
-       k->file_pos = restore_u32 ();
-       k->createmode = restore_u32 ();
-       k->dosmode = restore_u32 ();
-       savedsize = restore_u32 ();
-       uniq = restore_u64 ();
-       p = restore_string ();
-       pos = restore_u64 ();
-       size = restore_u64 ();
+       k->uniq = restore_u64to32();
+       k->file_pos = restore_u32();
+       k->createmode = restore_u32();
+       k->dosmode = restore_u32();
+       savedsize = restore_u32();
+       uniq = restore_u64to32();
+       p = restore_string();
+       pos = restore_u64();
+       size = restore_u64();
        if (size) {
                savedsize = size;
                k->file_pos = pos;
@@ -9761,8 +9761,8 @@ static uae_u8 *restore_key (UnitInfo *ui, Unit *u, uae_u8 *src)
                                        uae_u8 *buf = xcalloc (uae_u8, 10000);
                                        uae_u64 sp = savedsize;
                                        while (sp) {
-                                               uae_u32 s = sp >= 10000 ? 10000 : sp;
-                                               fs_write (k->fd, buf, s);
+                                               uae_s64 s = sp >= 10000 ? 10000 : sp;
+                                               fs_write (k->fd, buf, (uae_u32)s);
                                                sp -= s;
                                        }
                                        xfree(buf);
@@ -9838,34 +9838,34 @@ static uae_u8 *restore_filesys_virtual (UnitInfo *ui, uae_u8 *src, int num)
        Unit *u = startup_create_unit(NULL, ui, num);
        int cnt;
 
-       u->dosbase = restore_u32 ();
-       u->volume = restore_u32 ();
-       u->port = restore_u32 ();
-       u->locklist = restore_u32 ();
-       u->dummy_message = restore_u32 ();
-       u->cmds_sent = restore_u64 ();
-       u->cmds_complete = restore_u64 ();
-       u->cmds_acked = restore_u64 ();
-       u->next_exkey = restore_u32 ();
-       u->total_locked_ainos = restore_u32 ();
+       u->dosbase = restore_u32();
+       u->volume = restore_u32();
+       u->port = restore_u32();
+       u->locklist = restore_u32();
+       u->dummy_message = restore_u32();
+       u->cmds_sent = restore_u64to32();
+       u->cmds_complete = restore_u64to32();
+       u->cmds_acked = restore_u64to32();
+       u->next_exkey = restore_u32();
+       u->total_locked_ainos = restore_u32();
        u->volflags = ui->volflags;
 
-       cnt = restore_u32 ();
+       cnt = restore_u32();
        write_log (_T("FS: restoring %d locks\n"), cnt);
        while (cnt-- > 0)
                src = restore_aino (ui, u, src);
 
-       cnt = restore_u32 ();
+       cnt = restore_u32();
        write_log (_T("FS: restoring %d open files\n"), cnt);
        while (cnt-- > 0)
                src = restore_key (ui, u, src);
 
-       cnt = restore_u32 ();
+       cnt = restore_u32();
        write_log (_T("FS: restoring %d notifications\n"), cnt);
        while (cnt-- > 0)
                src = restore_notify (ui, u, src);
 
-       cnt = restore_u32 ();
+       cnt = restore_u32();
        write_log (_T("FS: restoring %d exkeys\n"), cnt);
        while (cnt-- > 0)
                src = restore_exkey (ui, u, src);
@@ -10063,8 +10063,8 @@ uae_u8 *restore_filesys_common (uae_u8 *src)
        cd_unit_number = 0;
        filesys_prepare_reset2 ();
        filesys_reset2 ();
-       a_uniq = restore_u64 ();
-       key_uniq = restore_u64 ();
+       a_uniq = restore_u64to32();
+       key_uniq = restore_u64to32();
 
        xfree(new_filesys_root_path);
        xfree(new_filesys_fs_path);
index 75138a72038fa753fb43eaba8eb4e363c150e6e7..3dcc119962fbd6036c2758a1cd828afda9bb7dca 100644 (file)
@@ -203,7 +203,7 @@ void eeprom93xx_write(void *eepromp, int eecs, int eesk, int eedi)
        eeprom->eecs = eecs;
        eeprom->eesk = eesk;
        eeprom->eedo = eedo;
-       eeprom->address = address;
+       eeprom->address = (uae_u8)address;
        eeprom->command = command;
 }
 
@@ -221,7 +221,7 @@ uae_u8 eeprom93xx_read_byte(void *eepromp, int offset)
 {
        eeprom93xx_eeprom_t *eeprom = (eeprom93xx_eeprom_t*)eepromp;
        if (offset & 1)
-               return eeprom->contents[offset / 2];
+               return (uae_u8)eeprom->contents[offset / 2];
        else
                return eeprom->contents[offset / 2] >> 8;
 }
index ea58bc150aedafefb951a6b851647801650d4094..150788cf308ef8aa076d3bdcb1cfd9a9d7e5c5d2 100644 (file)
@@ -703,7 +703,7 @@ static void fp_from_pack(fpdata *fp, uae_u32 *wrd, int kfactor)
                        digit = significand % 10;
                        significand /= 10;
                        if (len == 0) {
-                               pack_int = digit;
+                               pack_int = (uae_u32)digit;
                        } else {
                                pack_frac |= digit << (64 - len * 4);
                        }
@@ -717,7 +717,7 @@ static void fp_from_pack(fpdata *fp, uae_u32 *wrd, int kfactor)
                        digit = exponent % 10;
                        exponent /= 10;
                        if (len == 0) {
-                               pack_exp4 = digit;
+                               pack_exp4 = (uae_u32)digit;
                        } else {
                                pack_exp |= digit << (12 - len * 4);
                        }
index 4eff721c461ab18a76e13ddf9325aa65e3ba704e..9c8456aa892e621067fd3bea330f9d668ec18558 100644 (file)
--- a/gayle.cpp
+++ b/gayle.cpp
@@ -1505,10 +1505,10 @@ static int initpcmcia (const TCHAR *path, int readonly, int type, int reset, str
 
                if (!pcmcia_disk->hfd.drive_empty) {
                        int extrasize = 0;
-                       pcmcia_common_size = pcmcia_disk->hfd.virtsize;
+                       pcmcia_common_size = (int)pcmcia_disk->hfd.virtsize;
                        if (pcmcia_disk->hfd.virtsize > 4 * 1024 * 1024) {
                                write_log (_T("PCMCIA SRAM: too large device, %llu bytes\n"), pcmcia_disk->hfd.virtsize);
-                               extrasize = pcmcia_disk->hfd.virtsize - 4 * 1024 * 1024;
+                               extrasize = (int)pcmcia_disk->hfd.virtsize - 4 * 1024 * 1024;
                                if (extrasize > 262144)
                                        extrasize = 262144;
                                extrasize &= ~511;
index b917a38f5d99f4f315c19c25b1a59c2d802cc9c2..0841b079f599688b096392d6e03928c2c56cc538 100644 (file)
@@ -1873,7 +1873,7 @@ uae_u8 vga_io_get(int board, int portnum)
        if (!gb->vgaio)
                return v;
        portnum -= 0x3b0;
-       v = gb->vgaio->read(&gb->vga, portnum, 1);
+       v = (uae_u8)gb->vgaio->read(&gb->vga, portnum, 1);
        v = bget_regtest(gb, portnum, v);
        return v;
 }
@@ -1891,7 +1891,7 @@ uae_u8 vga_ram_get(int board, int offset)
        if (!gb->vgalowram)
                return 0xff;
        offset -= 0xa0000;
-       return gb->vgalowram->read(&gb->vga, offset, 1);
+       return (uae_u8)gb->vgalowram->read(&gb->vga, offset, 1);
 }
 void vgalfb_ram_put(int board, int offset, uae_u8 v)
 {
@@ -1905,7 +1905,7 @@ uae_u8 vgalfb_ram_get(int board, int offset)
        struct rtggfxboard *gb = &rtggfxboards[board];
        if (!gb->vgaram)
                return 0xff;
-       return gb->vgaram->read(&gb->vga, offset, 1);
+       return (uae_u8)gb->vgaram->read(&gb->vga, offset, 1);
 }
 
 void *memory_region_get_ram_ptr(MemoryRegion *mr)
@@ -2035,22 +2035,22 @@ static uae_u32 gfxboard_lget_vram (struct rtggfxboard *gb, uaecptr addr, int bs)
 {
        uae_u32 v;
        if (!gb->vram_enabled) {
-               const MemoryRegionOps *bank = getvgabank (gb, &addr);
+               const MemoryRegionOps *bank = getvgabank(gb, &addr);
                if (bs < 0) { // WORD
-                       v  = bank->read (&gb->vga, addr + 1, 1) << 24;
-                       v |= bank->read (&gb->vga, addr + 0, 1) << 16;
-                       v |= bank->read (&gb->vga, addr + 3, 1) <<  8;
-                       v |= bank->read (&gb->vga, addr + 2, 1) <<  0;
+                       v  = ((uae_u8)bank->read(&gb->vga, addr + 1, 1)) << 24;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 0, 1)) << 16;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 3, 1)) <<  8;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 2, 1)) <<  0;
                } else if (bs > 0) { // LONG
-                       v  = bank->read (&gb->vga, addr + 3, 1) << 24;
-                       v |= bank->read (&gb->vga, addr + 2, 1) << 16;
-                       v |= bank->read (&gb->vga, addr + 1, 1) <<  8;
-                       v |= bank->read (&gb->vga, addr + 0, 1) <<  0;
+                       v  = ((uae_u8)bank->read(&gb->vga, addr + 3, 1)) << 24;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 2, 1)) << 16;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 1, 1)) <<  8;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 0, 1)) <<  0;
                } else {
-                       v  = bank->read (&gb->vga, addr + 0, 1) << 24;
-                       v |= bank->read (&gb->vga, addr + 1, 1) << 16;
-                       v |= bank->read (&gb->vga, addr + 2, 1) <<  8;
-                       v |= bank->read (&gb->vga, addr + 3, 1) <<  0;
+                       v  = ((uae_u8)bank->read(&gb->vga, addr + 0, 1)) << 24;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 1, 1)) << 16;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 2, 1)) <<  8;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 3, 1)) <<  0;
                }
        } else {
                uae_u8 *m = gb->vram + addr;
@@ -2060,7 +2060,7 @@ static uae_u32 gfxboard_lget_vram (struct rtggfxboard *gb, uaecptr addr, int bs)
                } else if (bs > 0) {
                        v = *((uae_u32*)m);
                } else {
-                       v = do_get_mem_long ((uae_u32*)m);
+                       v = do_get_mem_long((uae_u32*)m);
                }
        }
 #if MEMLOGR
@@ -2078,11 +2078,11 @@ static uae_u16 gfxboard_wget_vram (struct rtggfxboard *gb, uaecptr addr, int bs)
        if (!gb->vram_enabled) {
                const MemoryRegionOps *bank = getvgabank (gb, &addr);
                if (bs) {
-                       v  = bank->read (&gb->vga, addr + 0, 1) <<  0;
-                       v |= bank->read (&gb->vga, addr + 1, 1) <<  8;
+                       v  = ((uae_u8)bank->read(&gb->vga, addr + 0, 1)) <<  0;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 1, 1)) <<  8;
                } else {
-                       v  = bank->read (&gb->vga, addr + 0, 1) <<  8;
-                       v |= bank->read (&gb->vga, addr + 1, 1) <<  0;
+                       v  = ((uae_u8)bank->read(&gb->vga, addr + 0, 1)) <<  8;
+                       v |= ((uae_u8)bank->read(&gb->vga, addr + 1, 1)) <<  0;
                }
        } else {
                uae_u8 *m = gb->vram + addr;
@@ -2106,9 +2106,9 @@ static uae_u8 gfxboard_bget_vram (struct rtggfxboard *gb, uaecptr addr, int bs)
        if (!gb->vram_enabled) {
                const MemoryRegionOps *bank = getvgabank (gb, &addr);
                if (bs)
-                       v = bank->read (&gb->vga, addr ^ 1, 1);
+                       v = (uae_u8)bank->read(&gb->vga, addr ^ 1, 1);
                else
-                       v = bank->read (&gb->vga, addr + 0, 1);
+                       v = (uae_u8)bank->read(&gb->vga, addr + 0, 1);
        } else {
                if (bs)
                        v = gb->vram[addr ^ 1];
@@ -2184,11 +2184,11 @@ static void gfxboard_wput_vram (struct rtggfxboard *gb, uaecptr addr, uae_u16 w,
        if (!gb->vram_enabled) {
                const MemoryRegionOps *bank = getvgabank (gb, &addr);
                if (bs) {
-                       bank->write (&gb->vga, addr + 0, (w >> 0) & 0xff, 1);
-                       bank->write (&gb->vga, addr + 1, w >> 8, 1);
+                       bank->write(&gb->vga, addr + 0, (w >> 0) & 0xff, 1);
+                       bank->write(&gb->vga, addr + 1, w >> 8, 1);
                } else {
-                       bank->write (&gb->vga, addr + 0, w >> 8, 1);
-                       bank->write (&gb->vga, addr + 1, (w >> 0) & 0xff, 1);
+                       bank->write(&gb->vga, addr + 0, w >> 8, 1);
+                       bank->write(&gb->vga, addr + 1, (w >> 0) & 0xff, 1);
                }
        } else {
                uae_u8 *m = gb->vram + addr;
@@ -2217,9 +2217,9 @@ static void gfxboard_bput_vram (struct rtggfxboard *gb, uaecptr addr, uae_u8 b,
                special_mem |= S_WRITE;
 #endif
                if (bs)
-                       bank->write (&gb->vga, addr ^ 1, b, 1);
+                       bank->write(&gb->vga, addr ^ 1, b, 1);
                else
-                       bank->write (&gb->vga, addr, b, 1);
+                       bank->write(&gb->vga, addr, b, 1);
        } else {
                if (bs)
                        gb->vram[addr ^ 1] = b;
@@ -2946,7 +2946,7 @@ static uae_u32 REGPARAM2 gfxboard_lget_regs (uaecptr addr)
        uae_u32 v = 0xffffffff;
        addr = mungeaddr (gb, addr, false);
        if (addr)
-               v = gb->vgaio->read (&gb->vga, addr, 4);
+               v = (uae_u32)gb->vgaio->read (&gb->vga, addr, 4);
        return v;
 }
 static uae_u32 REGPARAM2 gfxboard_wget_regs (uaecptr addr)
@@ -2956,9 +2956,9 @@ static uae_u32 REGPARAM2 gfxboard_wget_regs (uaecptr addr)
        addr = mungeaddr (gb, addr, false);
        if (addr) {
                uae_u8 v1, v2;
-               v1  = gb->vgaio->read (&gb->vga, addr + 0, 1);
+               v1 = (uae_u8)gb->vgaio->read (&gb->vga, addr + 0, 1);
                v1 = bget_regtest (gb, addr + 0, v1);
-               v2 = gb->vgaio->read (&gb->vga, addr + 1, 1);
+               v2 = (uae_u8)gb->vgaio->read (&gb->vga, addr + 1, 1);
                v2 = bget_regtest (gb, addr + 1, v2);
                v = (v1 << 8) | v2;
        }
@@ -2975,7 +2975,7 @@ static uae_u32 REGPARAM2 gfxboard_bget_regs (uaecptr addr)
        }
        addr = mungeaddr (gb, addr, false);
        if (addr) {
-               v = gb->vgaio->read (&gb->vga, addr, 1);
+               v = (uae_u8)gb->vgaio->read (&gb->vga, addr, 1);
                v = bget_regtest (gb, addr, v);
 #if REGDEBUG
                write_log(_T("GFX VGA BYTE GET IO %04X = %02X PC=%08x\n"), addr & 65535, v & 0xff, M68K_GETPC);
@@ -3226,10 +3226,10 @@ static uae_u32 REGPARAM2 gfxboards_lget_regs (uaecptr addr)
                // memory mapped io
                if (addr >= gb->p4_mmiobase && addr < gb->p4_mmiobase + 0x8000) {
                        uae_u32 addr2 = addr - gb->p4_mmiobase;
-                       v  = gb->vgammio->read(&gb->vga, addr2 + 0, 1) << 24;
-                       v |= gb->vgammio->read(&gb->vga, addr2 + 1, 1) << 16;
-                       v |= gb->vgammio->read(&gb->vga, addr2 + 2, 1) <<  8;
-                       v |= gb->vgammio->read(&gb->vga, addr2 + 3, 1) <<  0;
+                       v  = ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 0, 1)) << 24;
+                       v |= ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 1, 1)) << 16;
+                       v |= ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 2, 1)) <<  8;
+                       v |= ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 3, 1)) <<  0;
 #if PICASSOIV_DEBUG_IO
                        write_log (_T("PicassoIV MMIO LGET %08x %08x\n"), addr, v);
 #endif
@@ -3270,8 +3270,8 @@ static uae_u32 REGPARAM2 gfxboards_wget_regs (uaecptr addr)
                // memory mapped io
                if (addr >= gb->p4_mmiobase && addr < gb->p4_mmiobase + 0x8000) {
                        uae_u32 addr2 = addr - gb->p4_mmiobase;
-                       v  = gb->vgammio->read(&gb->vga, addr2 + 0, 1) << 8;
-                       v |= gb->vgammio->read(&gb->vga, addr2 + 1, 1) << 0;
+                       v  = ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 0, 1)) << 8;
+                       v |= ((uae_u8)gb->vgammio->read(&gb->vga, addr2 + 1, 1)) << 0;
 #if PICASSOIV_DEBUG_IO
                        write_log (_T("PicassoIV MMIO WGET %08x %04x\n"), addr, v & 0xffff);
 #endif
@@ -3323,7 +3323,7 @@ static uae_u32 REGPARAM2 gfxboards_bget_regs (uaecptr addr)
                // memory mapped io
                if (addr >= gb->p4_mmiobase && addr < gb->p4_mmiobase + 0x8000) {
                        uae_u32 addr2 = addr - gb->p4_mmiobase;
-                       v = gb->vgammio->read(&gb->vga, addr2, 1);
+                       v = (uae_u8)gb->vgammio->read(&gb->vga, addr2, 1);
 #if PICASSOIV_DEBUG_IO
                        write_log (_T("PicassoIV MMIO BGET %08x %02x\n"), addr, v & 0xff);
 #endif
@@ -3360,8 +3360,8 @@ static uae_u32 REGPARAM2 gfxboards_bget_regs (uaecptr addr)
                        addr -= 0x10000;
                        uaecptr addr2 = mungeaddr (gb, addr, true);
                        if (addr2) {
-                               v = gb->vgaio->read (&gb->vga, addr2, 1);
-                               v = bget_regtest (gb, addr2, v);
+                               v = (uae_u8)gb->vgaio->read(&gb->vga, addr2, 1);
+                               v = bget_regtest(gb, addr2, v);
                                //write_log(_T("P4 VGA read %08X=%02X PC=%08x\n"), addr2, v, M68K_GETPC);
                        }
                        //write_log (_T("PicassoIV IO %08x %02x\n"), addr, v);
index 02624f4b3a899de54ebccf8c9e33d960bdc928d0..919dbbcb52ce0b34f4e3e314d56cad5f3286d863 100644 (file)
@@ -115,7 +115,7 @@ static uae_u32 doAlpha (int alpha, int bits, int shift)
 
 static float video_gamma (float value, float gamma, float bri, float con)
 {
-       double factor;
+       float factor;
        float ret;
 
        value += bri;
@@ -124,7 +124,7 @@ static float video_gamma (float value, float gamma, float bri, float con)
        if (value <= 0.0f)
                return 0.0f;
 
-       factor = pow(255.0f, 1.0f - gamma);
+       factor = (float)pow(255.0f, 1.0f - gamma);
        ret = (float)(factor * pow(value, gamma));
 
        if (ret < 0.0f)
@@ -149,7 +149,7 @@ static void video_calc_gammatable(int monid)
        } else {
                bri = ((float)(currprefs.gfx_luminance)) * (128.0f / 1000.0f);
                con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f;
-               gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f - 1.0;
+               gam = ((float)(1000 - currprefs.gfx_gamma)) / 1000.0f - 1.0f;
        }
 
        gams[0] = gam + ((float)(1000 - currprefs.gfx_gamma_ch[0])) / 1000.0f;
@@ -161,15 +161,15 @@ static void video_calc_gammatable(int monid)
 
        for (int i = 0; i < (256 * 3); i++) {
                for (int j = 0; j < 3; j++) {
-                       float val = i - 256;
+                       float val = i - 256.0f;
                        float v;
 
                        if (currprefs.gfx_threebitcolors == 2) {
                                val *= 2;
                        } else if (currprefs.gfx_threebitcolors == 3) {
-                               val = (val * 252.0) / 119.0;
+                               val = (float)((val * 252.0) / 119.0);
                        } else if (currprefs.gfx_threebitcolors == 1) {
-                               val = (val * 252.0) / 238.0;
+                               val = (float)((val * 252.0) / 238.0);
                        }
 
                        if (gfx_hdr || (currprefs.gfx_luminance == 0 && currprefs.gfx_contrast == 0 && currprefs.gfx_gamma == 0 &&
@@ -189,11 +189,11 @@ static void video_calc_gammatable(int monid)
        }
 }
 
-static uae_u32 limit256(int monid, double v)
+static uae_u32 limit256(int monid, float v)
 {
        struct amigadisplay *ad = &adisplays[monid];
        if (!gfx_hdr) {
-               v = v * (double)(currprefs.gf[ad->picasso_on].gfx_filter_contrast + 1000) / 1000.0 + currprefs.gf[ad->picasso_on].gfx_filter_luminance / 10.0;
+               v = v * (float)(currprefs.gf[ad->picasso_on].gfx_filter_contrast + 1000) / 1000.0f + currprefs.gf[ad->picasso_on].gfx_filter_luminance / 10.0f;
        }
        if (v < 0)
                v = 0;
@@ -201,11 +201,11 @@ static uae_u32 limit256(int monid, double v)
                v = 255;
        return (uae_u32)v;
 }
-static uae_s32 limit256rb(int monid, double v)
+static uae_s32 limit256rb(int monid, float v)
 {
        struct amigadisplay *ad = &adisplays[monid];
        if (!gfx_hdr) {
-               v *= (double)(currprefs.gf[ad->picasso_on].gfx_filter_saturation + 1000) / 1000.0;
+               v *= (float)(currprefs.gf[ad->picasso_on].gfx_filter_saturation + 1000) / 1000.0f;
        }
        if (v < -128)
                v = -128;
@@ -213,7 +213,7 @@ static uae_s32 limit256rb(int monid, double v)
                v = 127;
        return (uae_s32)v;
 }
-static double get_y(int r, int g, int b)
+static float get_y(int r, int g, int b)
 {
        return 0.2989f * r + 0.5866f * g + 0.1145f * b;
 }
index 57f9280eccadc6bdf10cda6fdc3f9dd3cf519d24..2389aee26c886777f002324a4adcb4da4d4beffa 100644 (file)
@@ -110,7 +110,7 @@ static void wl (uae_u8 *p, uae_u32 v)
 static void ww (uae_u8 *p, uae_u16 v)
 {
        p[0] = v >> 8;
-       p[1] = v;
+       p[1] = (uae_u8)v;
 }
 static int rl (uae_u8 *p)
 {
@@ -186,7 +186,7 @@ static void getchsgeometry2 (uae_u64 size, int *pcyl, int *phead, int *psectorsp
                // old-style head=1, spt=32 always mode
                head = 1;
                spt = 32;
-               cyl = total / (head * spt);
+               cyl = (int)(total / (head * spt));
 
        } else {
 
@@ -199,7 +199,7 @@ static void getchsgeometry2 (uae_u64 size, int *pcyl, int *phead, int *psectorsp
                        int maxhead = sptt[i] < 255 ? 16 : 255;
                        spt = sptt[i];
                        for (head = 4; head <= maxhead; head++) {
-                               cyl = total / (head * spt);
+                               cyl = (int)(total / (head * spt));
                                if (size <= 512 * 1024 * 1024) {
                                        if (cyl <= 1023)
                                                break;
@@ -294,7 +294,7 @@ void getchspgeometry (uae_u64 total, int *pcyl, int *phead, int *psectorspertrac
        if (idegeometry) {
                *phead = 16;
                *psectorspertrack = 63;
-               *pcyl = blocks / ((*psectorspertrack) * (*phead));
+               *pcyl = (int)(blocks / ((*psectorspertrack) * (*phead)));
                if (blocks > 16515072) {
                        /* >8G, CHS=16383/16/63 */
                        *pcyl = 16383;
@@ -331,7 +331,7 @@ static void rdb_crc (uae_u8 *p)
        blocksize = rl (p + 1 * 4);
        for (i = 0; i < blocksize; i++)
                sum += rl (p + i * 4);
-       sum = -sum;
+       sum = 0 - sum;
        pl (p, 2, sum);
 }
 
@@ -480,7 +480,7 @@ static void create_virtual_rdb (struct hardfiledata *hfd)
        pl(part, 6, -1);
        pl(part, 7, -1);
        pl(part, 8, 0); // devflags
-       part[9 * 4] = _tcslen (hfd->ci.devname);
+       part[9 * 4] = (uae_u8)_tcslen(hfd->ci.devname);
        ua_copy ((char*)part + 9 * 4 + 1, 30, hfd->ci.devname);
        denv = part + 128;
        pl(denv, 0, 16);
@@ -582,7 +582,7 @@ int hdf_hd_open (struct hd_hardfiledata *hfd)
                uae_u8 buf[512] = { 0 };
                hdf_read (&hfd->hfd, buf, 0, 512);
                if (buf[0] != 0 && memcmp (buf, _T("RDSK"), 4)) {
-                       ci->highcyl = (hfd->hfd.virtsize / ci->blocksize) / (ci->sectors * ci->surfaces);
+                       ci->highcyl = (int)((hfd->hfd.virtsize / ci->blocksize) / (ci->sectors * ci->surfaces));
                        ci->dostype = rl (buf);
                        create_virtual_rdb (&hfd->hfd);
                        while (ci->highcyl * ci->surfaces * ci->sectors > hfd->cyls_def * hfd->secspertrack_def * hfd->heads_def) {
@@ -810,7 +810,7 @@ static uae_u64 vhd_read (struct hardfiledata *hfd, void *v, uae_u64 offset, uae_
        if (len & 511)
                return read;
        while (len > 0) {
-               uae_u32 bamoffset = (offset / hfd->vhd_blocksize) * 4 + hfd->vhd_bamoffset;
+               uae_u32 bamoffset = (uae_u32)((offset / hfd->vhd_blocksize) * 4 + hfd->vhd_bamoffset);
                uae_u32 sectoroffset = gl (hfd->vhd_header + bamoffset);
                if (sectoroffset == 0xffffffff) {
                        memset (dataptr, 0, 512);
@@ -876,7 +876,7 @@ static int vhd_write_enlarge (struct hardfiledata *hfd, uae_u32 bamoffset)
        }
        // write new offset to BAM
        p = hfd->vhd_header + bamoffset;
-       block = hfd->vhd_footerblock / 512;
+       block = (uae_u32)(hfd->vhd_footerblock / 512);
        p[0] = block >> 24;
        p[1] = block >> 16;
        p[2] = block >>  8;
@@ -902,7 +902,7 @@ static uae_u64 vhd_write (struct hardfiledata *hfd, void *v, uae_u64 offset, uae
        if (len & 511)
                return written;
        while (len > 0) {
-               uae_u32 bamoffset = (offset / hfd->vhd_blocksize) * 4 + hfd->vhd_bamoffset;
+               uae_u32 bamoffset = (uae_u32)((offset / hfd->vhd_blocksize) * 4 + hfd->vhd_bamoffset);
                uae_u32 sectoroffset = gl (hfd->vhd_header + bamoffset);
                if (sectoroffset == 0xffffffff) {
                        if (!vhd_write_enlarge (hfd, bamoffset))
@@ -961,7 +961,7 @@ int vhd_create (const TCHAR *name, uae_u64 size, uae_u32 dostype)
                blocksize = 2 * 1024 * 1024;
        else
                blocksize = 512 * 1024;
-       batsize = (size + blocksize - 1) / blocksize;
+       batsize = (uae_u32)((size + blocksize - 1) / blocksize);
        batentrysize = batsize;
        batsize *= 4;
        batsize += 511;
@@ -984,22 +984,22 @@ int vhd_create (const TCHAR *name, uae_u64 size, uae_u32 dostype)
        b[0x10 + 6] = 2; // data offset
        // time stamp
        tm = time (NULL) - 946684800;
-       b[0x18] = tm >> 24;
-       b[0x19] = tm >> 16;
-       b[0x1a] = tm >>  8;
-       b[0x1b] = tm >>  0;
+       b[0x18] = (uae_u8)(tm >> 24);
+       b[0x19] = (uae_u8)(tm >> 16);
+       b[0x1a] = (uae_u8)(tm >>  8);
+       b[0x1b] = (uae_u8)(tm >>  0);
        strcpy ((char*)b + 0x1c, "vpc "); // creator application
        b[0x21] = 5; // creator version
        strcpy ((char*)b + 0x24, "Wi2k"); // creator host os
        // original and current size
-       b[0x28] = b[0x30] = size >> 56;
-       b[0x29] = b[0x31] = size >> 48;
-       b[0x2a] = b[0x32] = size >> 40;
-       b[0x2b] = b[0x33] = size >> 32;
-       b[0x2c] = b[0x34] = size >> 24;
-       b[0x2d] = b[0x35] = size >> 16;
-       b[0x2e] = b[0x36] = size >>  8;
-       b[0x2f] = b[0x37] = size >>  0;
+       b[0x28] = b[0x30] = (uae_u8)(size >> 56);
+       b[0x29] = b[0x31] = (uae_u8)(size >> 48);
+       b[0x2a] = b[0x32] = (uae_u8)(size >> 40);
+       b[0x2b] = b[0x33] = (uae_u8)(size >> 32);
+       b[0x2c] = b[0x34] = (uae_u8)(size >> 24);
+       b[0x2d] = b[0x35] = (uae_u8)(size >> 16);
+       b[0x2e] = b[0x36] = (uae_u8)(size >>  8);
+       b[0x2f] = b[0x37] = (uae_u8)(size >>  0);
        getchs2 (&hfd, &cyl, &cylsec, &head, &tracksec);
        // cylinders
        b[0x38] = cyl >> 8;
@@ -1087,20 +1087,23 @@ static int hdf_read2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, in
        int ret = 0, extra = 0;
        if (offset < hfd->virtual_size) {
                uae_s64 len2 = offset + len <= hfd->virtual_size ? len : hfd->virtual_size - offset;
+               if (len > INT_MAX) {
+                       return 0;
+               }
                if (!hfd->virtual_rdb)
                        return 0;
-               memcpy(buffer, hfd->virtual_rdb + offset, len2);
-               len -= len2;
+               memcpy(buffer, hfd->virtual_rdb + offset, (size_t)len2);
+               len -= (int)len2;
                if (len <= 0)
-                       return len2;
+                       return (int)len2;
                offset += len2;
                buffer = (uae_u8*)buffer + len2;
-               extra = len2;
+               extra = (int)len2;
        }
        offset -= hfd->virtual_size;
 
        if (hfd->hfd_type == HFD_VHD_DYNAMIC)
-               ret = vhd_read (hfd, buffer, offset, len);
+               ret = (int)vhd_read (hfd, buffer, offset, len);
        else if (hfd->hfd_type == HFD_VHD_FIXED)
                ret = hdf_read_target (hfd, buffer, offset + 512, len);
 #ifdef WITH_CHD
@@ -1139,21 +1142,26 @@ static int hdf_read2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, in
 
 static int hdf_write2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
 {
+       if (len > INT_MAX)
+               return 0;
        int ret = 0, extra = 0;
        // writes to virtual RDB are ignored
        if (offset < hfd->virtual_size) {
                uae_s64 len2 = offset + len <= hfd->virtual_size ? len : hfd->virtual_size - offset;
-               len -= len2;
+               if (len2 > INT_MAX) {
+                       return 0;
+               }
+               len -= (int)len2;
                if (len <= 0)
-                       return len2;
+                       return (int)len2;
                offset += len2;
                buffer = (uae_u8*)buffer + len2;
-               extra = len2;
+               extra = (int)len2;
        }
        offset -= hfd->virtual_size;
 
        if (hfd->hfd_type == HFD_VHD_DYNAMIC)
-               ret = vhd_write (hfd, buffer, offset, len);
+               ret = (int)vhd_write (hfd, buffer, offset, len);
        else if (hfd->hfd_type == HFD_VHD_FIXED)
                ret = hdf_write_target (hfd, buffer, offset + 512, len);
 #ifdef WITH_CHD
@@ -1290,28 +1298,30 @@ int hdf_write(struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
 
 static uae_u64 cmd_readx(struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 offset, uae_u64 len)
 {
+       if (!len || len > INT_MAX)
+               return 0;
        m68k_cancel_idle();
        gui_flicker_led (LED_HD, hfd->unitnum, 1);
-       return hdf_read (hfd, dataptr, offset, len);
+       return hdf_read (hfd, dataptr, offset, (int)len);
 }
 static uae_u64 cmd_read(TrapContext *ctx, struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offset, uae_u64 len)
 {
-       if (!len)
+       if (!len || len > INT_MAX)
                return 0;
        if (!ctx && real_address_allowed()) {
                addrbank *bank_data = &get_mem_bank (dataptr);
                if (!bank_data)
                        return 0;
-               if (bank_data->check(dataptr, len)) {
+               if (bank_data->check(dataptr, (uae_u32)len)) {
                        uae_u8 *buffer = bank_data->xlateaddr(dataptr);
-                       return cmd_readx(hfd, buffer, offset, len);
+                       return cmd_readx(hfd, buffer, offset, (uae_u32)len);
                }
        }
        int total = 0;
        while (len > 0) {
                uae_u8 buf[RTAREA_TRAP_DATA_EXTRA_SIZE];
                int max = RTAREA_TRAP_DATA_EXTRA_SIZE & ~511;
-               int size = len > max ? max : len;
+               int size = (int)(len > max ? max : len);
                if (cmd_readx(hfd, buf, offset, size) != size)
                        break;
                trap_put_bytes(ctx, buf, dataptr, size);
@@ -1324,20 +1334,22 @@ static uae_u64 cmd_read(TrapContext *ctx, struct hardfiledata *hfd, uaecptr data
 }
 static uae_u64 cmd_writex(struct hardfiledata *hfd, uae_u8 *dataptr, uae_u64 offset, uae_u64 len)
 {
+       if (!len || len > INT_MAX)
+               return 0;
        m68k_cancel_idle();
        gui_flicker_led (LED_HD, hfd->unitnum, 2);
-       return hdf_write (hfd, dataptr, offset, len);
+       return hdf_write (hfd, dataptr, offset, (uae_u32)len);
 }
 
 static uae_u64 cmd_write(TrapContext *ctx, struct hardfiledata *hfd, uaecptr dataptr, uae_u64 offset, uae_u64 len)
 {
-       if (!len)
+       if (!len || len > INT_MAX)
                return 0;
        if (!ctx && real_address_allowed()) {
                addrbank *bank_data = &get_mem_bank (dataptr);
                if (!bank_data)
                        return 0;
-               if (bank_data->check(dataptr, len)) {
+               if (bank_data->check(dataptr, (uae_u32)len)) {
                        uae_u8 *buffer = bank_data->xlateaddr(dataptr);
                        return cmd_writex(hfd, buffer, offset, len);
                }
@@ -1346,7 +1358,7 @@ static uae_u64 cmd_write(TrapContext *ctx, struct hardfiledata *hfd, uaecptr dat
        while (len > 0) {
                uae_u8 buf[RTAREA_TRAP_DATA_EXTRA_SIZE];
                int max = RTAREA_TRAP_DATA_EXTRA_SIZE & ~511;
-               int size = len > max ? max : len;
+               int size = (int)(len > max ? max : len);
                trap_get_bytes(ctx, buf, dataptr, size);
                if (cmd_writex(hfd, buf, offset, size) != size)
                        break;
@@ -1740,18 +1752,18 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
                break;
        case 0x0e: /* READ SECTOR BUFFER */
                len = hfd->ci.blocksize;
-               scsi_len = len;
-               memset(scsi_data, 0, len);
+               scsi_len = (int)len;
+               memset(scsi_data, 0, (size_t)len);
                if (len > sizeof(hfd->sector_buffer))
                        len = sizeof(hfd->sector_buffer);
-               memcpy(scsi_data, hfd->sector_buffer, len);
+               memcpy(scsi_data, hfd->sector_buffer, (size_t)len);
                break;
        case 0x0f: /* WRITE SECTOR BUFFER */
                len = hfd->ci.blocksize;
-               scsi_len = len;
+               scsi_len = (int)len;
                if (len > sizeof(hfd->sector_buffer))
                        len = sizeof(hfd->sector_buffer);
-               memcpy(hfd->sector_buffer, scsi_data, len);
+               memcpy(hfd->sector_buffer, scsi_data, (size_t)len);
                break;
        case 0x0a: /* WRITE (6) */
                if (nodisk (hfd))
@@ -1981,7 +1993,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
        case 0x25: /* READ CAPACITY */
                {
                        int pmi = cmdbuf[8] & 1;
-                       uae_u32 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[4] << 8) | cmdbuf[5];
+                       uae_u64 lba = (cmdbuf[2] << 24) | (cmdbuf[3] << 16) | (cmdbuf[4] << 8) | cmdbuf[5];
                        uae_u64 blocks;
                        int cyl, head, tracksec;
                        if (nodisk (hfd))
@@ -2067,7 +2079,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua
                                        goto checkfail;
                                uae_u8 *vb = xmalloc(uae_u8, hfd->ci.blocksize);
                                while (len > 0) {
-                                       int readlen = cmd_readx (hfd, vb, offset, hfd->ci.blocksize);
+                                       uae_u64 readlen = cmd_readx (hfd, vb, offset, hfd->ci.blocksize);
                                        if (readlen != hfd->ci.blocksize || memcmp (vb, scsi_data, hfd->ci.blocksize)) {
                                                xfree (vb);
                                                goto miscompare;
diff --git a/ide.cpp b/ide.cpp
index d95db8facbf32ebe5659cc5760812b11472acaf9..6edbdac07f14ac3ceefc5ad19266b88127c10987 100644 (file)
--- a/ide.cpp
+++ b/ide.cpp
@@ -243,7 +243,7 @@ static void sl(uae_u8 *d, int o)
        d[o + 0] = d[o + 2];
        d[o + 1] = d[o + 3];
        d[o + 2] = t >> 8;
-       d[o + 3] = t;
+       d[o + 3] = (uae_u8)t;
 }
 static void ql(uae_u8 *d, int o)
 {
@@ -253,7 +253,7 @@ static void ql(uae_u8 *d, int o)
        d[o + 0] = d[o + 6];
        d[o + 1] = d[o + 7];
        d[o + 6] = t >> 8;
-       d[o + 7] = t;
+       d[o + 7] = (uae_u8)t;
 }
 
 void ata_byteswapidentity(uae_u8 *d)
@@ -535,7 +535,7 @@ static void ide_identity_buffer(struct ide_hdf *ide)
                pw(ide, 55, ide->hdhfd.heads);
                pw(ide, 56, ide->hdhfd.secspertrack);
                uae_u64 totalsecs = (uae_u64)ide->hdhfd.cyls * ide->hdhfd.heads * ide->hdhfd.secspertrack;
-               pl(ide, 57, totalsecs);
+               pl(ide, 57, (uae_u32)totalsecs);
                pw(ide, 59, ide->max_multiple_mode ? (0x100 | ide->max_multiple_mode >> (ide->blocksize / 512 - 1)) : 0); /* Multiple mode supported */
                pw(ide, 62, 0x0f);
                pw(ide, 63, 0x0f);
@@ -543,7 +543,7 @@ static void ide_identity_buffer(struct ide_hdf *ide)
                        totalsecs = ide->blocksize ? ide->hdhfd.size / ide->blocksize : 0;
                        if (totalsecs > 0x0fffffff)
                                totalsecs = 0x0fffffff;
-                       pl(ide, 60, totalsecs);
+                       pl(ide, 60, (uae_u32)totalsecs);
                        if (ide->ata_level > 0) {
                                pw(ide, 64, ide->ata_level ? 0x03 : 0x00); /* PIO3 and PIO4 */
                                pw(ide, 65, 120); /* MDMA2 supported */
@@ -655,7 +655,7 @@ static void ide_initialize_drive_parameters (struct ide_hdf *ide)
                if (ide->hdhfd.hfd.ci.pcyls)
                        ide->hdhfd.cyls = ide->hdhfd.hfd.ci.pcyls;
                else
-                       ide->hdhfd.cyls = (ide->hdhfd.size / ide->blocksize) / ((uae_u64)ide->hdhfd.secspertrack * ide->hdhfd.heads);
+                       ide->hdhfd.cyls = (int)((ide->hdhfd.size / ide->blocksize) / ((uae_u64)ide->hdhfd.secspertrack * ide->hdhfd.heads));
                if (ide->hdhfd.heads * ide->hdhfd.cyls * ide->hdhfd.secspertrack > 16515072 || ide->lba48) {
                        if (ide->hdhfd.hfd.ci.pcyls)
                                ide->hdhfd.cyls = ide->hdhfd.hfd.ci.pcyls;
@@ -990,7 +990,7 @@ static void do_process_rw_command (struct ide_hdf *ide)
        if (IDE_LOG > 1)
                write_log(_T("IDE%d off=%d, nsec=%d (%d) %s\n"), ide->num, (uae_u32)lba, nsec, ide->multiple_mode, getidemode(ide));
        if (nsec > ide->max_lba - lba) {
-               nsec = ide->max_lba - lba;
+               nsec = (unsigned int)(ide->max_lba - lba);
                if (IDE_LOG > 1)
                        write_log (_T("IDE%d nsec changed to %d\n"), ide->num, nsec);
        }
@@ -1113,7 +1113,7 @@ static void ide_write_sectors (struct ide_hdf *ide, int flags)
        if (IDE_LOG > 0)
                write_log (_T("IDE%d write off=%d, sec=%d (%d) %s\n"), ide->num, (uae_u32)lba, nsec, ide->multiple_mode, getidemode(ide));
        if (nsec > ide->max_lba - lba)
-               nsec = ide->max_lba - lba;
+               nsec = (unsigned int)(ide->max_lba - lba);
        if (nsec <= 0) {
                ide_data_ready (ide);
                ide_fail_err (ide, IDE_ERR_IDNF);
@@ -1341,14 +1341,14 @@ static void ide_put_data_2(struct ide_hdf *ide, uae_u16 v, int bussize)
                        ide->secbuf[ide->packet_data_offset + ide->data_offset + 1] = v & 0xff;
                        ide->secbuf[ide->packet_data_offset + ide->data_offset + 0] = v >> 8;
                } else {
-                       ide->secbuf[(ide->packet_data_offset + ide->data_offset) ^ 1] = v;
+                       ide->secbuf[(ide->packet_data_offset + ide->data_offset) ^ 1] = (uae_u8)v;
                }
        } else {
                if (bussize) {
                        ide->secbuf[ide->buffer_offset + ide->data_offset + 1] = v & 0xff;
                        ide->secbuf[ide->buffer_offset + ide->data_offset + 0] = v >> 8;
                } else {
-                       ide->secbuf[(ide->buffer_offset + ide->data_offset)] = v;
+                       ide->secbuf[(ide->buffer_offset + ide->data_offset)] = (uae_u8)v;
                }
        }
        ide->data_offset += inc;
index 6ae66e8f4f3d1aec211a12a1d3c50ae79611c8c7..45ada0cfa039c20c73aa263ed95a42dbea555492 100644 (file)
@@ -849,7 +849,7 @@ static uae_u32 ide_read_byte(struct ide_board *board, uaecptr addr)
                } else if (board->configured) {
                        int regnum = get_adide_reg(addr, board);
                        v = get_ide_reg(board, regnum);
-                       v = adide_decode_word(v);
+                       v = (uae_u8)adide_decode_word(v);
                }
 
        } else if (board->type == MTEC_IDE) {
@@ -990,7 +990,7 @@ static uae_u32 ide_read_byte(struct ide_board *board, uaecptr addr)
                        int regnum = get_adide_reg(addr, board);
                        if (regnum >= 0) {
                                v = get_ide_reg(board, regnum);
-                               v = adide_decode_word(v);
+                               v = (uae_u8)adide_decode_word(v);
                        }
                }
 
@@ -1527,7 +1527,7 @@ static void ide_write_byte(struct ide_board *board, uaecptr addr, uae_u8 v)
 
                        if (board->configured) {
                                int regnum = get_adide_reg(addr, board);
-                               v = adide_encode_word(v);
+                               v = (uae_u8)adide_encode_word(v);
                                put_ide_reg(board, regnum, v);
                        }
 
@@ -1624,7 +1624,7 @@ static void ide_write_byte(struct ide_board *board, uaecptr addr, uae_u8 v)
 
                        if (board->configured) {
                                int regnum = get_adide_reg(addr, board);
-                               v = adide_encode_word(v);
+                               v = (uae_u8)adide_encode_word(v);
                                put_ide_reg(board, regnum, v);
                        }
 
@@ -1668,7 +1668,7 @@ static void ide_write_word(struct ide_board *board, uaecptr addr, uae_u16 v)
                                        put_ide_reg_multi(board, IDE_DATA, v, portnum, 1);
                        } else {
                                ide_write_byte(board, addr, v >> 8);
-                               ide_write_byte(board, addr + 1, v);
+                               ide_write_byte(board, addr + 1, (uae_u8)v);
                        }
 
                } else if (board->type == ALF_IDE || board->type == TANDEM_IDE) {
@@ -1691,11 +1691,11 @@ static void ide_write_word(struct ide_board *board, uaecptr addr, uae_u16 v)
                                        put_ide_reg(board, IDE_DATA, v);
                                } else {
                                        ide_write_byte(board, addr, v >> 8);
-                                       ide_write_byte(board, addr + 1, v);
+                                       ide_write_byte(board, addr + 1, (uae_u8)v);
                                }
                        } else {
                                ide_write_byte(board, addr, v >> 8);
-                               ide_write_byte(board, addr + 1, v);
+                               ide_write_byte(board, addr + 1, (uae_u8)v);
                        }
                
                } else if (board->type == MASOBOSHI_IDE) {
@@ -1705,7 +1705,7 @@ static void ide_write_word(struct ide_board *board, uaecptr addr, uae_u16 v)
                                put_ide_reg(board, IDE_DATA, v);
                        } else {
                                ide_write_byte(board, addr, v >> 8);
-                               ide_write_byte(board, addr + 1, v);
+                               ide_write_byte(board, addr + 1, (uae_u8)v);
                        }
 #if DEBUG_IDE_MASOBOSHI
                        write_log(_T("MASOBOSHI IO WORD WRITE %08x %04x %08x\n"), addr, v, M68K_GETPC);
@@ -1717,14 +1717,14 @@ static void ide_write_word(struct ide_board *board, uaecptr addr, uae_u16 v)
                                put_ide_reg(board, IDE_DATA, v);
                        } else {
                                ide_write_byte(board, addr, v >> 8);
-                               ide_write_byte(board, addr + 1, v);
+                               ide_write_byte(board, addr + 1, (uae_u8)v);
                        }
 
                } else if (board->type == APOLLO_IDE) {
 
                        if ((addr & 0xc000) == 0x4000) {
                                apollo_scsi_bput(addr, v >> 8, board->userdata);
-                               apollo_scsi_bput(addr + 1, v, board->userdata);
+                               apollo_scsi_bput(addr + 1, (uae_u8)v, board->userdata);
                        } else if (addr < 0x4000) {
                                int regnum = get_apollo_reg(addr, board);
                                if (regnum == IDE_DATA) {
@@ -2209,7 +2209,7 @@ static bool apollo_init(struct autoconfig_info *aci, bool cpuboard)
                ide->mask = 131072 - 1;
                struct zfile *z = read_device_from_romconfig(aci->rc, ROMTYPE_APOLLO);
                if (z) {
-                       int len = zfile_size(z);
+                       int len = zfile_size32(z);
                        // skip 68060 $f0 ROM block
                        if (len >= 65536)
                                zfile_fseek(z, 32768, SEEK_SET);
@@ -2982,15 +2982,15 @@ void dotto_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig
 
 static const uae_u8 dev_autoconfig[16] = { 0xd1, 1, 0x00, 0x00, 0x77, 0x77, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 };
 
-bool dev_hd_init(struct autoconfig_infoaci)
+bool dev_hd_init(struct autoconfig_info *aci)
 {
        bool ac = true;
-       const struct expansionromtypeert = get_device_expansion_rom(ROMTYPE_DEVHD);
+       const struct expansionromtype *ert = get_device_expansion_rom(ROMTYPE_DEVHD);
        ide_add_reset();
 
-       uae_u8 *rom = xcalloc(uae_u8, 65536);
-       load_rom_rc(aci->rc, ROMTYPE_DEVHD, 32768, 0, rom, 65536, LOADROM_EVENONLY_ODDONE);
-       memcpy(rom + 0x8000, rom, 0x8000);
+       uae_u8 *rom = xcalloc(uae_u8, 262144);
+       load_rom_rc(aci->rc, ROMTYPE_DEVHD, 131072, 0, rom, 262144, LOADROM_EVENONLY_ODDONE);
+       memmove(rom + 0x8000, rom, 262144 - 0x8000);
 
        if (!ac) {
                // fake
index f0038910fbc49e6ee607943aadf8d21b5b5ec6f7..ab5459039274dfcf5ba8165a8d4ad2f9b23c7d32 100644 (file)
@@ -262,7 +262,7 @@ const struct customData custd[] =
        { _T("BPL7PTL"),  0xdff0FA, CD_WO | CD_AGA | CD_DMA_PTR }, /* Bit plane pointer 7 (low 15 bits) */
        { _T("BPL8PTH"),  0xdff0FC, CD_WO | CD_AGA | CD_DMA_PTR }, /* Bit plane pointer 8 (high 5 bits) */
        { _T("BPL8PTL"),  0xdff0FE, CD_WO | CD_AGA | CD_DMA_PTR }, /* Bit plane pointer 8 (low 15 bits) */
-       { _T("BPLCON0"),  0xdff100, CD_WO, { ~0x00f1, ~0x00b0, ~0x0080 } }, /* Bit plane control reg (misc control bits) */
+       { _T("BPLCON0"),  0xdff100, CD_WO, { (uae_u16)~0x00f1,  (uae_u16)~0x00b0,  (uae_u16)~0x0080}}, /* Bit plane control reg (misc control bits) */
        { _T("BPLCON1"),  0xdff102, CD_WO }, /* Bit plane control reg (scroll val PF1,PF2) */
        { _T("BPLCON2"),  0xdff104, CD_WO, { 0x007f, 0x01ff, 0x7fff } }, /* Bit plane control reg (priority control) */
        { _T("BPLCON3"),  0xdff106, CD_WO | CD_ECS_DENISE, { 0x003f, 0x003f, 0xffff } }, /* Bit plane control reg (enhanced features) */
index 8b149a0e293afb0b4fd5b1fd4e08e61241cc90b0..cdb98ce0b4a10d19320ecfb795a6c2333aa48ed5 100644 (file)
@@ -31,8 +31,8 @@ void update_audio (void);
 void audio_evhandler (void);
 void audio_hsync (void);
 void audio_update_adkmasks (void);
-void update_sound (double clk);
-void update_cda_sound (double clk);
+void update_sound (float clk);
+void update_cda_sound (float clk);
 void led_filter_audio (void);
 void set_audio (void);
 int audio_activate (void);
index f04d226dc77481a7c9b57ebc3ccfbee7fca5af48..da61c6cb8c1ee8a6c0abd4552d017668615ada04 100644 (file)
@@ -9,7 +9,7 @@ extern void cd32_fmv_state(int state);
 extern void cd32_fmv_new_image(int, int, int, uae_u8*);
 extern void cd32_fmv_genlock(struct vidbuffer*, struct vidbuffer*);
 extern void cd32_fmv_new_border_color(uae_u32);
-extern void cd32_fmv_set_sync(double svpos, double adjust);
+extern void cd32_fmv_set_sync(float svpos, float adjust);
 
 extern int cd32_fmv_active;
 
index 670009557f7962c3a595ca54c5b072e8c0cf9d2c..6885e1646b2035ae34905d1c899028d0d6795985 100644 (file)
@@ -58,7 +58,7 @@ STATIC_INLINE void do_cycles_ce020_internal(int clocks)
                return;
        }
        int cycs = clocks * cpucycleunit;
-       int diff = regs.ce020endcycle - regs.ce020startcycle;
+       int diff = (int)(regs.ce020endcycle - regs.ce020startcycle);
        if (diff > 0) {
                if (diff >= cycs) {
                        regs.ce020startcycle += cycs;
index bc96a4e9055251b5b3f70f4cfde18457b1c10e09..0df38e310825aad8e9a12146968a26b5d31bb5f8 100644 (file)
@@ -9,8 +9,8 @@ void devices_hsync(void);
 void devices_rethink(void);
 void devices_rethink_all(void func(void));
 void devices_syncchange(void);
-void devices_update_sound(double clk, double syncadjust);
-void devices_update_sync(double svpos, double syncadjust);
+void devices_update_sound(float clk, float syncadjust);
+void devices_update_sync(float svpos, float syncadjust);
 void do_leave_program(void);
 void virtualdevice_init(void);
 void virtualdevice_free(void);
index 472e198a80872aca0f2eac1536b064a25243410c..fc2814ec699b654d09e2724fa2a01493191491b2 100644 (file)
@@ -12,7 +12,7 @@
 #include "uae/types.h"
 
 typedef enum {
-       DRV_NONE = -1, DRV_35_DD = 0, DRV_35_HD, DRV_525_SD, DRV_35_DD_ESCOM, DRV_PC_525_ONLY_40, DRV_PC_35_ONLY_80, DRV_PC_525_40_80, DRV_525_DD, DRV_FB,
+       DRV_NONE = -1, DRV_35_DD = 0, DRV_35_HD, DRV_525_SD, DRV_35_DD_ESCOM, DRV_PC_525_ONLY_40, DRV_PC_35_ONLY_80, DRV_PC_525_40_80, DRV_525_DD, DRV_FB
 } drive_type;
 
 #define HISTORY_FLOPPY 0
index 032d48dcee2a924edc37931fd055398c10e66af2..dbe21ff758eaed9f709b61726dc5afcbddec55e0 100644 (file)
@@ -17,7 +17,7 @@ struct m68k_exception {
 #define SAVE_EXCEPTION
 #define RESTORE_EXCEPTION
 #define TRY(var) try
-#define CATCH(var) catch(m68k_exception var)
+#define CATCH(var) catch([[maybe_unused]] m68k_exception var)
 #define THROW(n) throw m68k_exception(n)
 #define THROW_AGAIN(var) throw
 #define ENDTRY
@@ -40,7 +40,7 @@ jmp_buf* __poptry(void);
 void __pushtry(jmp_buf *j);
 int __is_catched(void);
 
-typedef  int m68k_exception;
+typedef int m68k_exception;
 
 #endif
 
index b29adb05b0d6c686a658881f79d2e4a1eb8bd4b6..869bf3b4e7b7f991150d27355d1fb81fcd67be04 100644 (file)
@@ -321,7 +321,7 @@ struct chipset_refresh
        int ntsc;
        int vsync;
        int framelength;
-       double rate;
+       float rate;
        TCHAR label[16];
        TCHAR commands[256];
        TCHAR filterprofile[64];
@@ -589,7 +589,7 @@ struct uae_prefs {
 
        bool immediate_blits;
        int waiting_blits;
-       double blitter_speed_throttle;
+       float blitter_speed_throttle;
        unsigned int chipset_mask;
        bool chipset_hr;
        bool keyboard_connected;
@@ -604,7 +604,7 @@ struct uae_prefs {
        TCHAR genlock_video_file[MAX_DPATH];
        int monitoremu;
        int monitoremu_mon;
-       double chipset_refreshrate;
+       float chipset_refreshrate;
        struct chipset_refresh cr[MAX_CHIPSET_REFRESH + 2];
        int cr_selected;
        int collision_level;
@@ -730,8 +730,8 @@ struct uae_prefs {
        struct multipath path_cd;
 
        int m68k_speed;
-       double m68k_speed_throttle;
-       double x86_speed_throttle;
+       float m68k_speed_throttle;
+       float x86_speed_throttle;
        int cpu_model;
        int mmu_model;
        bool mmu_ec;
index 66d989d9368de2b0f76ecf8adf30a816a4a79bde..dae8a4f98d1428e3f8b5c3c65f66b1a629e4bbe4 100644 (file)
@@ -55,6 +55,7 @@ extern TCHAR *restore_path_full_func(uae_u8 **);
 #define save_u8(x) save_u8_func (&dst, (x))
 
 #define restore_u64() restore_u64_func (&src)
+#define restore_u64to32() (uae_u32)restore_u64_func (&src)
 #define restore_u32() restore_u32_func (&src)
 #define restore_u16() restore_u16_func (&src)
 #define restore_u8() restore_u8_func (&src)
index d65b013a012a5ecfb9cb1fe107a8e70215351e4a..05595e311751af2747bd9d3763660938ac982099 100644 (file)
@@ -6,7 +6,7 @@
 bool toccata_init(struct autoconfig_info *aci);
 bool prelude_init(struct autoconfig_info *aci);
 bool prelude1200_init(struct autoconfig_info *aci);
-void update_sndboard_sound(double);
+void update_sndboard_sound(float);
 void sndboard_ext_volume(void);
 
 bool uaesndboard_init_z2(struct autoconfig_info *aci);
index cacf7a1bac68a342231ee7e70f945a289caad8f4..208388f1d641f3c066742d74d8fe506be2205b3f 100644 (file)
@@ -8,7 +8,7 @@ bool a2286_init(struct autoconfig_info *aci);
 bool a2386_init(struct autoconfig_info *aci);
 bool isa_expansion_init(struct autoconfig_info *aci);
 void x86_bridge_sync_change(void);
-void x86_update_sound(double);
+void x86_update_sound(float);
 void x86_mouse(int port, int x, int y, int z, int b);
 
 #define X86_STATE_INACTIVE 0
index 0d97583b6b2b9de3d126357e2be9b45c34f87910..f9d6db6d15a232d3e4f6e7e2bc045a109d8984c6 100644 (file)
@@ -40,52 +40,54 @@ struct fs_filehandle
 
 typedef int (*zfile_callback)(struct zfile*, void*);
 
-extern struct zfile *zfile_fopen (const TCHAR *, const TCHAR *, int mask);
-extern struct zfile *zfile_fopen (const TCHAR *, const TCHAR *);
-extern struct zfile *zfile_fopen (const TCHAR *, const TCHAR *, int mask, int index);
-extern struct zfile *zfile_fopen_empty (struct zfile*, const TCHAR *name, uae_u64 size);
-extern struct zfile *zfile_fopen_empty (struct zfile*, const TCHAR *name);
-extern struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, const uae_u8 *data);
-extern struct zfile *zfile_fopen_load_zfile (struct zfile *f);
-extern uae_u8 *zfile_load_data (const TCHAR *name, const uae_u8 *data,int datalen, int *outlen);
+extern struct zfile *zfile_fopen(const TCHAR *, const TCHAR *, int mask);
+extern struct zfile *zfile_fopen(const TCHAR *, const TCHAR *);
+extern struct zfile *zfile_fopen(const TCHAR *, const TCHAR *, int mask, int index);
+extern struct zfile *zfile_fopen_empty(struct zfile*, const TCHAR *name, uae_u64 size);
+extern struct zfile *zfile_fopen_empty(struct zfile*, const TCHAR *name);
+extern struct zfile *zfile_fopen_data(const TCHAR *name, uae_u64 size, const uae_u8 *data);
+extern struct zfile *zfile_fopen_load_zfile(struct zfile *f);
+extern uae_u8 *zfile_load_data(const TCHAR *name, const uae_u8 *data,int datalen, int *outlen);
 extern uae_u8 *zfile_load_file(const TCHAR *name, int *outlen);
-extern struct zfile *zfile_fopen_parent (struct zfile*, const TCHAR*, uae_u64 offset, uae_u64 size);
+extern struct zfile *zfile_fopen_parent(struct zfile*, const TCHAR*, uae_u64 offset, uae_u64 size);
 extern uae_u8 *zfile_get_data_pointer(struct zfile *z, int *len);
 
 extern int zfile_exists (const TCHAR *name);
-extern void zfile_fclose (struct zfile *);
+extern void zfile_fclose (struct zfile *z);
 extern uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode);
-extern uae_s64 zfile_ftell (struct zfile *z);
-extern uae_s64 zfile_size (struct zfile *z);
-extern size_t zfile_fread  (void *b, size_t l1, size_t l2, struct zfile *z);
-extern size_t zfile_fwrite  (const void *b, size_t l1, size_t l2, struct zfile *z);
-extern TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z);
-extern char *zfile_fgetsa (char *s, int size, struct zfile *z);
-extern size_t zfile_fputs (struct zfile *z, const TCHAR *s);
-extern int zfile_getc (struct zfile *z);
-extern int zfile_putc (int c, struct zfile *z);
-extern int zfile_ferror (struct zfile *z);
-extern uae_u8 *zfile_getdata (struct zfile *z, uae_s64 offset, int len, int *outlen);
-extern void zfile_exit (void);
-extern int execute_command (TCHAR *);
-extern int zfile_iscompressed (struct zfile *z);
-extern int zfile_zcompress (struct zfile *dst, void *src, int size);
-extern int zfile_zuncompress (void *dst, int dstsize, struct zfile *src, int srcsize);
-extern int zfile_gettype (struct zfile *z);
-extern int zfile_zopen (const TCHAR *name, zfile_callback zc, void *user);
-extern TCHAR *zfile_getname (struct zfile *f);
-extern TCHAR *zfile_getoriginalname (struct zfile *f);
-extern TCHAR *zfile_getfilename (struct zfile *f);
-extern uae_u32 zfile_crc32 (struct zfile *f);
-extern struct zfile *zfile_dup (struct zfile *f);
-extern struct zfile *zfile_gunzip (struct zfile *z);
-extern int zfile_is_diskimage (const TCHAR *name);
-extern int iszip (struct zfile *z);
-extern int zfile_convertimage (const TCHAR *src, const TCHAR *dst);
-extern struct zfile *zuncompress (struct znode*, struct zfile *z, int dodefault, int mask, int *retcode, int index);
-extern void zfile_seterror (const TCHAR *format, ...);
-extern TCHAR *zfile_geterror (void);
-extern int zfile_truncate (struct zfile *z, uae_s64 size);
+extern uae_s64 zfile_ftell(struct zfile *z);
+extern uae_s32 zfile_ftell32(struct zfile *z);
+extern uae_s64 zfile_size(struct zfile *z);
+extern uae_s32 zfile_size32(struct zfile *z);
+extern size_t zfile_fread(void *b, size_t l1, size_t l2, struct zfile *z);
+extern size_t zfile_fwrite(const void *b, size_t l1, size_t l2, struct zfile *z);
+extern TCHAR *zfile_fgets(TCHAR *s, int size, struct zfile *z);
+extern char *zfile_fgetsa(char *s, int size, struct zfile *z);
+extern size_t zfile_fputs(struct zfile *z, const TCHAR *s);
+extern int zfile_getc(struct zfile *z);
+extern int zfile_putc(int c, struct zfile *z);
+extern int zfile_ferror(struct zfile *z);
+extern uae_u8 *zfile_getdata(struct zfile *z, uae_s64 offset, int len, int *outlen);
+extern void zfile_exit(void);
+extern int execute_command(TCHAR *);
+extern int zfile_iscompressed(struct zfile *z);
+extern int zfile_zcompress(struct zfile *dst, void *src, int size);
+extern int zfile_zuncompress(void *dst, int dstsize, struct zfile *src, int srcsize);
+extern int zfile_gettype(struct zfile *z);
+extern int zfile_zopen(const TCHAR *name, zfile_callback zc, void *user);
+extern TCHAR *zfile_getname(struct zfile *f);
+extern TCHAR *zfile_getoriginalname(struct zfile *f);
+extern TCHAR *zfile_getfilename(struct zfile *f);
+extern uae_u32 zfile_crc32(struct zfile *f);
+extern struct zfile *zfile_dup(struct zfile *f);
+extern struct zfile *zfile_gunzip(struct zfile *z);
+extern int zfile_is_diskimage(const TCHAR *name);
+extern int iszip(struct zfile *z);
+extern int zfile_convertimage(const TCHAR *src, const TCHAR *dst);
+extern struct zfile *zuncompress(struct znode*, struct zfile *z, int dodefault, int mask, int *retcode, int index);
+extern void zfile_seterror(const TCHAR *format, ...);
+extern TCHAR *zfile_geterror(void);
+extern int zfile_truncate(struct zfile *z, uae_s64 size);
 
 #define ZFD_NONE 0
 #define ZFD_ARCHIVE 1 //zip/lha..
index a1a02845ad82bbae641a180404b95ef216ab8aad..179b07fbc3698dbdcc379c307501401058f33322 100644 (file)
@@ -4558,7 +4558,7 @@ static bool inputdevice_handle_inputcode2(int monid, int code, int state, const
                        if (cr) {
                                int dir = code == AKS_INCREASEREFRESHRATE ? 5 : -5;
                                if (cr->rate == 0)
-                                       cr->rate = currprefs.ntscmode ? 60 : 50;
+                                       cr->rate = currprefs.ntscmode ? 60.0f : 50.0f;
                                cr->locked = true;
                                cr->rate += dir;
                                if (cr->rate < 10)
index c58a7608f115866e8a9f9ba9b08fd228ff2dca6f..3a1263e3d91a05439ae9f30d7214b448a513caa0 100644 (file)
@@ -49,7 +49,7 @@ static int replaypos;
 static int lasthsync, endhsync;
 static TCHAR inprec_path[MAX_DPATH];
 static uae_u32 seed;
-static uae_u32 lastcycle;
+static frame_time_t lastcycle;
 static uae_u32 cycleoffset;
 
 static uae_u32 pcs[16];
@@ -93,6 +93,13 @@ void inprec_ru32 (uae_u32 v)
        inprec_ru16 ((uae_u16)(v >> 16));
        inprec_ru16 ((uae_u16)v);
 }
+void inprec_ru64(uae_u64 v)
+{
+       if (!input_record || !inprec_zf)
+               return;
+       inprec_ru32((uae_u32)(v >> 32));
+       inprec_ru32((uae_u32)v);
+}
 static void inprec_rstr (const TCHAR *src)
 {
        if (!input_record || !inprec_zf)
@@ -120,7 +127,7 @@ static bool inprec_rstart (uae_u8 type)
        inprec_ru16 (0xffff);
        inprec_ru32 (hsync_counter);
        inprec_ru8 (current_hpos ());
-       inprec_ru32 (lastcycle);
+       inprec_ru64 (lastcycle);
        return true;
 }
 
@@ -158,7 +165,7 @@ static int inprec_pstart (uae_u8 type)
        uae_u8 *p = inprec_p;
        uae_u32 hc = hsync_counter;
        uae_u8 hpos = current_hpos ();
-       uae_u32 cycles = get_cycles ();
+       frame_time_t cycles = get_cycles ();
        static uae_u8 *lastp;
        uae_u32 hc_orig, hc2_orig;
        int mvp = current_maxvpos ();
@@ -193,7 +200,7 @@ static int inprec_pstart (uae_u8 type)
                uae_u32 type2 = p[0];
                uae_u32 hc2 = (p[3] << 24) | (p[4] << 16) | (p[5] << 8) | p[6];
                uae_u32 hpos2 = p[7];
-               uae_u32 cycles2 = (p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11];
+               frame_time_t cycles2 = (p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11];
 
                if (p >= inprec_buffer + inprec_size)
                        break;
@@ -232,7 +239,7 @@ static int inprec_pstart (uae_u8 type)
                                                write_log (_T("%08x (%08x) "), pcs[i], pcs2[i]);
                                        write_log (_T("\n"));
                                }
-                               cycleoffset = cycles - cycles2;
+                               cycleoffset = (uae_u32)(cycles - cycles2);
 #if ENABLE_DEBUGGER == 0
                                gui_message (_T("INPREC OFFSET=%d\n"), (int)cycleoffset / CYCLE_UNIT);
 #else
@@ -300,6 +307,12 @@ static uae_u32 inprec_pu32 (void)
        v |= inprec_pu16 ();
        return v;
 }
+static uae_u64 inprec_pu64(void)
+{
+       uae_u64 v = (uae_u64)inprec_pu32() << 32;
+       v |= inprec_pu32();
+       return v;
+}
 static int inprec_pstr (TCHAR *dst)
 {
        char tmp[MAX_DPATH];
@@ -363,7 +376,7 @@ int inprec_open (const TCHAR *fname, const TCHAR *statefilename)
        if (input_play) {
                uae_u32 id;
                zfile_fseek (inprec_zf, 0, SEEK_END);
-               inprec_size = zfile_ftell (inprec_zf);
+               inprec_size = zfile_ftell32(inprec_zf);
                zfile_fseek (inprec_zf, 0, SEEK_SET);
                inprec_buffer = inprec_p = xmalloc (uae_u8, inprec_size);
                zfile_fread (inprec_buffer, inprec_size, 1, inprec_zf);
@@ -447,7 +460,7 @@ int inprec_open (const TCHAR *fname, const TCHAR *statefilename)
                inprec_ru32 (hsync_counter);
                inprec_ru32 (0); // extra header size
                flush ();
-               header_end2 = header_end = zfile_ftell (inprec_zf);
+               header_end2 = header_end = zfile_ftell32(inprec_zf);
        } else {
                input_record = input_play = 0;
                return 0;
@@ -606,7 +619,7 @@ void inprec_recorddebug_cpu (int mode)
 #if INPUTRECORD_DEBUG > 0
        if (inprec_rstart (INPREC_DEBUG2)) {
                inprec_ru32 (m68k_getpc ());
-               inprec_ru32 (get_cycles () | mode);
+               inprec_ru64 (get_cycles () | mode);
                inprec_rend ();
        }
 #endif
@@ -618,8 +631,8 @@ void inprec_playdebug_cpu (int mode)
        if (inprec_pstart (INPREC_DEBUG2)) {
                uae_u32 pc1 = m68k_getpc ();
                uae_u32 pc2 = inprec_pu32 ();
-               uae_u32 v1 = get_cycles () | mode;
-               uae_u32 v2 = inprec_pu32 ();
+               uae_u64 v1 = get_cycles () | mode;
+               uae_u64 v2 = inprec_pu64 ();
                if (pc1 != pc2) {
                        if (warned > 0) {
                                warned--;
@@ -738,7 +751,7 @@ int inprec_getposition (void)
        if (input_play == INPREC_PLAY_RERECORD) {
                pos = inprec_p - inprec_buffer;
        } else if (input_record) {
-               pos = zfile_ftell (inprec_zf);
+               pos = zfile_ftell32(inprec_zf);
        }
        write_log (_T("INPREC: getpos=%d cycles=%08X\n"), pos, lastcycle);
        if (pos < 0) {
@@ -783,7 +796,7 @@ void inprec_setposition (int offset, int replaycounter)
        }
        zfile_fseek (inprec_zf, 0, SEEK_SET);
        xfree (inprec_buffer);
-       inprec_size = zfile_size (inprec_zf);
+       inprec_size = zfile_size32(inprec_zf);
        inprec_buffer = xmalloc (uae_u8, inprec_size);
        zfile_fread (inprec_buffer, inprec_size, 1, inprec_zf);
        inprec_p = inprec_plastptr = inprec_buffer + offset;
@@ -844,7 +857,7 @@ static int savedisk (const TCHAR *path, const TCHAR *file, uae_u8 *data, uae_u8
                        _tcscat (tmp, filename);
                        struct zfile *zfd = zfile_fopen (tmp, _T("wb"));
                        if (zfd) {
-                               int size = zfile_size (zf);
+                               int size = zfile_size32(zf);
                                uae_u8 *data = zfile_getdata (zf, 0, size, NULL);
                                zfile_fwrite (data, size, 1, zfd);
                                zfile_fclose (zfd);
@@ -882,7 +895,7 @@ void inprec_save (const TCHAR *filename, const TCHAR *statefilename)
                getfilepart (fn, MAX_DPATH, statefilename);
                char *s = uutf8 (fn);
                zfile_fwrite (s, strlen (s) + 1, 1, zf);
-               int len = zfile_size (inprec_zf) -  header_end2;
+               int len = zfile_size32(inprec_zf) -  header_end2;
                data = zfile_getdata (inprec_zf, header_end2, len, NULL);
                uae_u8 *p = data;
                uae_u8 *end = data + len;
index 09177b7066b39c818bbe3efa68950b5c29910a92..d4811f54e65a36f9948bc0bd436b19a024f131ec 100644 (file)
--- a/isofs.cpp
+++ b/isofs.cpp
@@ -1572,7 +1572,7 @@ static int isofs_get_blocks(struct inode *inode, uae_u32 iblock, struct buffer_h
 
        offset = 0;
        firstext = ei->i_first_extent;
-       sect_size = ei->i_section_size >> ISOFS_BUFFER_BITS(inode);
+       sect_size = (unsigned int)(ei->i_section_size >> ISOFS_BUFFER_BITS(inode));
        nextblk = ei->i_next_section_block;
        nextoff = ei->i_next_section_offset;
        section = 0;
@@ -1604,7 +1604,7 @@ static int isofs_get_blocks(struct inode *inode, uae_u32 iblock, struct buffer_h
                                goto abort;
                        }
                        firstext  = ISOFS_I(ninode)->i_first_extent;
-                       sect_size = ISOFS_I(ninode)->i_section_size >> ISOFS_BUFFER_BITS(ninode);
+                       sect_size = (unsigned int)(ISOFS_I(ninode)->i_section_size >> ISOFS_BUFFER_BITS(ninode));
                        nextblk   = ISOFS_I(ninode)->i_next_section_block;
                        nextoff   = ISOFS_I(ninode)->i_next_section_offset;
                        iput(ninode);
@@ -2185,7 +2185,7 @@ static struct inode *isofs_find_entry(struct inode *dir, char *tmpname, TCHAR *t
                 * respectively, is set
                 */
                match = 0;
-               if (dlen > 0 && (!sbi->s_hide || (!(de->flags[-sbi->s_high_sierra] & 1))) && (sbi->s_showassoc || (!(de->flags[-sbi->s_high_sierra] & 4)))) {
+               if (dlen > 0 && (!sbi->s_hide || (!(de->flags[0-sbi->s_high_sierra] & 1))) && (sbi->s_showassoc || (!(de->flags[0-sbi->s_high_sierra] & 4)))) {
                        if (jname)
                                match = _tcsicmp(jname, nameu) == 0;
                        else
@@ -2317,7 +2317,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, char *tmpnam
                        inode_number = isofs_get_ino(block_saved, offset_saved, bufbits);
                }
 
-               if (de->flags[-sbi->s_high_sierra] & 0x80) {
+               if (de->flags[0-sbi->s_high_sierra] & 0x80) {
                        first_de = 0;
                        filp->f_pos += de_len;
                        continue;
@@ -2342,7 +2342,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, char *tmpnam
                 * Do not report hidden files if so instructed, or associated
                 * files unless instructed to do so
                 */
-               if ((sbi->s_hide && (de->flags[-sbi->s_high_sierra] & 1)) || (!sbi->s_showassoc && (de->flags[-sbi->s_high_sierra] & 4))) {
+               if ((sbi->s_hide && (de->flags[0-sbi->s_high_sierra] & 1)) || (!sbi->s_showassoc && (de->flags[0-sbi->s_high_sierra] & 4))) {
                        filp->f_pos += de_len;
                        continue;
                }
@@ -2622,7 +2622,7 @@ void isofs_closefile(struct cd_openfile_s *of)
 uae_s64 isofs_lseek(struct cd_openfile_s *of, uae_s64 offset, int mode)
 {
        struct inode *inode = of->inode;
-       int ret = -1;
+       uae_s64 ret = -1;
        switch (mode)
        {
        case SEEK_SET:
@@ -2664,11 +2664,11 @@ uae_s64 isofs_read(struct cd_openfile_s *of, void *bp, unsigned int size)
        uae_u8 *b = (uae_u8*)bp;
 
        if (size + of->seek > inode->i_size)
-               size = inode->i_size - of->seek;
+               size = (unsigned int)(inode->i_size - of->seek);
 
        // first partial sector
        if (offset & bufmask) {
-               bh = isofs_bread(inode, offset / bufsize);
+               bh = isofs_bread(inode, (uae_u32)(offset / bufsize));
                if (!bh)
                        return 0;
                read = size < (bufsize - (offset & bufmask)) ? size : (bufsize - (offset & bufmask));
@@ -2682,7 +2682,7 @@ uae_s64 isofs_read(struct cd_openfile_s *of, void *bp, unsigned int size)
        }
        // complete sector(s)
        while (size >= bufsize) {
-               bh = isofs_bread(inode, offset / bufsize);
+               bh = isofs_bread(inode, (uae_u32)(offset / bufsize));
                if (!bh)
                        return totalread;
                read = size < bufsize ? size : bufsize;
@@ -2696,7 +2696,7 @@ uae_s64 isofs_read(struct cd_openfile_s *of, void *bp, unsigned int size)
        }
        // and finally last partial sector
        if (size > 0) {
-               bh = isofs_bread(inode, offset / bufsize);
+               bh = isofs_bread(inode, (uae_u32)(offset / bufsize));
                if (!bh)
                        return totalread;
                read = size;
index 51964aa8bb629d4bc435f2cf5443affaf3646155..1ac271a834e02f516d625af1d040a6d3d6ef9524 100644 (file)
@@ -138,7 +138,7 @@ static uaecptr makeaddr(UINT32 a, int *bank)
 
 static uae_u8 get_a2410_control(struct a2410_struct *data)
 {
-       uae_u8 v = data->a2410_control;
+       uae_u8 v = (uae_u8)data->a2410_control;
        v &= ~(0x10 | 0x40 | 0x80);
        v |= 0x20;
        if (v & 0x08) // SBR
@@ -152,7 +152,7 @@ static uae_u8 get_a2410_control(struct a2410_struct *data)
 
 UINT32 total_cycles(void)
 {
-       return get_cycles() / CYCLE_UNIT;
+       return (UINT32)(get_cycles() / CYCLE_UNIT);
 }
 
 void m_to_shiftreg_cb(address_space space, offs_t offset, UINT16 *shiftreg)
@@ -481,7 +481,7 @@ void address_space::write_word(UINT32 a, UINT16 b)
                break;
                case A2410_BANK_RAMDAC:
                //write_log(_T("RAMDAC WRITE %08x = %04x IDX=%d/%d PC=%08x\n"), aa, b, a2410_palette_index / 4, a2410_palette_index & 3, M68K_GETPC);
-               write_ramdac(data, addr, b);
+               write_ramdac(data, addr, (uae_u8)b);
                break;
                case A2410_BANK_CONTROL:
                write_log(_T("CONTROL WRITE %08x = %04x PC=%08x\n"), aa, b, M68K_GETPC);
index ea7152d64e94f633fd951329e274c4e46c56c7cd..74af4547328e687bc9238819ecd2d8b09bee06da 100644 (file)
@@ -1468,10 +1468,10 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
 
        if (size < 0) {
                zfile_fseek (f, 0, SEEK_END);
-               size = zfile_ftell (f) & ~0x3ff;
+               size = zfile_ftell32(f) & ~0x3ff;
                zfile_fseek (f, 0, SEEK_SET);
        }
-       oldpos = zfile_ftell (f);
+       oldpos = zfile_ftell32(f);
        i = zfile_fread (buffer, 1, sizeof(buffer), f);
        if (i < sizeof(buffer))
                return 0;
@@ -1578,7 +1578,7 @@ static bool load_extendedkickstart (const TCHAR *romextfile, int type)
                return false;
        }
        zfile_fseek (f, 0, SEEK_END);
-       size = zfile_ftell (f);
+       size = zfile_ftell32(f);
        extendedkickmem_bank.reserved_size = ROM_SIZE_512;
        off = 0;
        if (type == 0) {
@@ -1831,11 +1831,11 @@ static int load_kickstart (void)
                        (tmp[0] == 0x7f && tmp[1] == 'E' && tmp[2] == 'L' && tmp[3] == 'F')) {
                        struct zfile *zf = read_executable_rom(f, ROM_SIZE_512, 3);
                        if (zf) {
-                               int size = zfile_size(zf);
+                               int size = zfile_size32(zf);
                                zfile_fclose(f);
                                f = zf;
                                if (size > ROM_SIZE_512) {
-                                       maxsize = zfile_size(zf);
+                                       maxsize = zfile_size32(zf);
                                        singlebigrom = true;
                                        extendedkickmem2a_bank.reserved_size = 524288;
                                        extendedkickmem2a_bank.mask = extendedkickmem2a_bank.allocated_size - 1;
@@ -1857,7 +1857,7 @@ static int load_kickstart (void)
 
                if (!singlebigrom) {
                        zfile_fseek(f, 0, SEEK_END);
-                       filesize = zfile_ftell(f);
+                       filesize = zfile_ftell32(f);
                        zfile_fseek(f, 0, SEEK_SET);
                        if (!singlebigrom) {
                                if (filesize == 1760 * 512) {
index a16cc3bc6588b2bf2bdaae241272ed99dc62a968..bd9a0768f1d5bad84d529e40c2c497e078aec2c6 100644 (file)
@@ -482,7 +482,7 @@ static int masoboshi_dma_read(void *opaque, uint8_t *buf, int len)
                        *buf++ = v >> 8;
                        len--;
                        if (len > 0) {
-                               *buf++ = v;
+                               *buf++ = (uint8_t)v;
                                len--;
                        }
                        ncr->dma_ptr += 2;
@@ -537,7 +537,7 @@ static int trifecta_dma_read(void *opaque, uint8_t *buf, int len)
                        *buf++ = v >> 8;
                        len--;
                        if (len > 0) {
-                               *buf++ = v;
+                               *buf++ = (uint8_t)v;
                                len--;
                        }
                        ncr->dma_ptr += 2;
@@ -583,7 +583,7 @@ static int fastlane_dma_read(void *opaque, uint8_t *buf, int len)
                *buf++ = v >> 8;
                len--;
                if (len > 0) {
-                       *buf++ = v;
+                       *buf++ = (uint8_t)v;
                        len--;
                }
                ncr->dma_ptr += 2;
@@ -626,7 +626,7 @@ static int cyberstorm_mk1_mk2_dma_read(void *opaque, uint8_t *buf, int len)
                *buf++ = v >> 8;
                len--;
                if (len > 0) {
-                       *buf++ = v;
+                       *buf++ = (uint8_t)v;
                        len--;
                }
                ncr->dma_ptr += 2;
@@ -669,7 +669,7 @@ static int blizzard_dma_read(void *opaque, uint8_t *buf, int len)
                *buf++ = v >> 8;
                len--;
                if (len > 0) {
-                       *buf++ = v;
+                       *buf++ = (uint8_t)v;
                        len--;
                }
                ncr->dma_ptr++;
@@ -1452,7 +1452,7 @@ static uae_u32 ncr9x_io_bget3(struct ncr9x_state *ncr, uaecptr addr, int *reg)
        } else if (ISCPUBOARD(BOARD_BLIZZARD, BOARD_BLIZZARD_SUB_1230III)) {
                addr &= 0xffff;
                if (addr >= 0x10 && addr < 0x20) {
-                       v = fas408_read_fifo(ncr->devobject.lsistate);
+                       v = (uae_u8)fas408_read_fifo(ncr->devobject.lsistate);
                        return v;
                }
                if (addr >= 0x20) {
@@ -1578,7 +1578,7 @@ static uae_u32 ncr9x_io_bget3(struct ncr9x_state *ncr, uaecptr addr, int *reg)
                return v;
        addr >>= reg_shift;
        addr &= IO_MASK;
-       v = esp_reg_read(ncr->devobject.lsistate, (addr));
+       v = (uae_u8)esp_reg_read(ncr->devobject.lsistate, (addr));
        *reg = addr;
        return v;
 }
index 333a6fde7fac72d038a50a5549a85c1116c83707..d72aed2461ee565dad2ce864a3e0925941d34bb4 100644 (file)
@@ -504,13 +504,13 @@ static uae_u32 ncr_io_bget(struct ncr_state *ncr, uaecptr addr)
        if (addr >= CYBERSTORM_SCSI_RAM_OFFSET && ncr->ramsize)
                return cyberstorm_scsi_ram_get(addr);
        addr &= IO_MASK;
-       return lsi_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
+       return (uae_u32)lsi_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
 }
 
 static uae_u32 ncr710_io_bget(struct ncr_state *ncr, uaecptr addr)
 {
        addr &= IO_MASK;
-       return lsi710_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
+       return (uae_u32)lsi710_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
 }
 
 uae_u32 cpuboard_ncr710_io_bget(uaecptr addr)
@@ -522,7 +522,7 @@ uae_u32 cpuboard_ncr720_io_bget(uaecptr addr)
 {
        struct ncr_state *ncr = ncr_cpuboard;
        addr &= IO_MASK;
-       return lsi_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
+       return (uae_u32)lsi_mmio_read(ncr->devobject.lsistate, beswap(addr), 1);
 }
 
 static bool isncrboard(struct ncr_state *ncr, struct ncr_state **ncrb)
index 8150e15bfc3113c1ce5ef9669c218d5bc4a1911e..7eaf1aaa19a9a0f6101e4956b7c684b38ee795c1 100644 (file)
@@ -413,7 +413,7 @@ int ahi_open_sound (void)
 
 static void *bswap_buffer = NULL;
 static uae_u32 bswap_buffer_size = 0;
-static double syncdivisor;
+static float syncdivisor;
 
 #define FAKE_HANDLE_WINLAUNCH 0xfffffffe
 
@@ -794,7 +794,7 @@ uae_u32 REGPARAM2 ahi_demux (TrapContext *context)
                        }
 #endif
                        xfree (dllname);
-                       syncdivisor = (3580000.0 * CYCLE_UNIT) / (double)syncbase;
+                       syncdivisor = (3580000.0f * CYCLE_UNIT) / (float)syncbase;
                        return (uae_u32)h;
                }
 
@@ -829,7 +829,7 @@ uae_u32 REGPARAM2 ahi_demux (TrapContext *context)
                                        }
                                }
 #if defined(X86_MSVC_ASSEMBLY)
-                               unsigned long rate1;
+                               frame_time_t rate1;
                                double v;
                                rate1 = read_processor_time ();
                                ret = emulib_ExecuteNativeCode2 (context);
index 60a5211edff578d50949594bb0eaa7ece55d8acb..6cd8c2b3ffb573596e0860a17390b72b3b9ecaad 100644 (file)
@@ -380,7 +380,7 @@ struct DSAHI {
        struct dssample *sample;
        struct dschannel *channel;
        int playing, recording;
-       evt evttime;
+       evt_t evttime;
        uae_u32 signalchannelmask;
 
        ALCdevice *al_dev, *al_recorddev;
@@ -524,13 +524,13 @@ static void setevent (struct DSAHI *dsahip)
        uae_u32 freq = get_long (audioctrl + ahiac_PlayerFreq);
        double f;
        uae_u32 cycles;
-       evt t;
+       evt_t t;
 
        f = ((double)(freq >> 16)) + ((double)(freq & 0xffff)) / 65536.0;
        if (f < 1)
                return;
-       cycles = maxhpos * maxvpos_nom * vblank_hz;
-       t = (evt)(cycles / f);
+       cycles = (uae_u32)(maxhpos * maxvpos_nom * vblank_hz);
+       t = (evt_t)(cycles / f);
        if (dsahip->evttime == t)
                return;
        write_log (_T("AHI: playerfunc freq = %.2fHz\n"), f);
@@ -726,7 +726,7 @@ static void ds_setvolume (struct DSAHI *dsahip, struct dschannel *dc)
 {
        if (dc->al_source != -1) {
                if (abs (dc->cs.volume) != abs (dc->csnext.volume)) {
-                       float vol = ((float)(abs (dc->csnext.volume))) / 65536.0;
+                       float vol = ((float)(abs (dc->csnext.volume))) / 65536.0f;
                        alClear ();
                        alSourcef (dc->al_source, AL_GAIN, vol);
                        alError (_T("AHI: SetVolume(%d,%d)"), dc->num, vol);
index f4870171cf4c31b4a8927b33656de4abedc2eb63..33e6c50c22a0ddb59cd38e4843894aa749434aa3 100644 (file)
@@ -109,7 +109,7 @@ static int FirstAudio;
 static bool audio_validated;
 static DWORD dwAudioInputRemaining;
 static unsigned int StreamSizeAudio; // audio write position
-static double StreamSizeAudioExpected, StreamSizeAudioGot;
+static float StreamSizeAudioExpected, StreamSizeAudioGot;
 static PAVISTREAM AVIAudioStream = NULL; // compressed stream pointer
 static HACMSTREAM has = NULL; // stream handle that can be used to perform conversions
 static ACMSTREAMHEADER ash;
@@ -816,7 +816,7 @@ typedef short          HWORD;
 typedef unsigned short UHWORD;
 typedef int            LWORD;
 typedef unsigned int   ULWORD;
-static int resampleFast(double factor, HWORD *in, HWORD *out, int inCount, int outCount, int nChans);
+static int resampleFast(float factor, HWORD *in, HWORD *out, int inCount, int outCount, int nChans);
 
 static uae_u8 *hack_resample(uae_u8 *srcbuffer, int gotSize, int wantedSize)
 {
@@ -827,7 +827,7 @@ static uae_u8 *hack_resample(uae_u8 *srcbuffer, int gotSize, int wantedSize)
        int gotSamples = gotSize / bytesperframe;
        int wantedSamples = wantedSize / bytesperframe;
 
-       double factor = (double)wantedSamples / gotSamples;
+       float factor = (float)wantedSamples / gotSamples;
        outbuf = xmalloc(uae_u8, wantedSize + bytesperframe);
        resampleFast(factor, (HWORD*)srcbuffer, (HWORD*)outbuf, gotSamples, wantedSamples, ch);
        return outbuf;
@@ -1815,14 +1815,14 @@ bool frame_drawn(int monid)
                        bytesperframe = wfxSrc.Format.nChannels * 2;
                        StreamSizeAudioGot += avi_sndbuffered / bytesperframe;
                        unsigned int lastexpected = (unsigned int)StreamSizeAudioExpected;
-                       StreamSizeAudioExpected += ((double)wfxSrc.Format.nSamplesPerSec) / fps_in_use;
+                       StreamSizeAudioExpected += ((float)wfxSrc.Format.nSamplesPerSec) / fps_in_use;
                        if (avioutput_video) {
-                               int idiff = StreamSizeAudioGot - StreamSizeAudioExpected;
+                               int idiff = (int)(StreamSizeAudioGot - StreamSizeAudioExpected);
                                if ((timeframes % 5) == 0)
                                        write_log(_T("%.1f %.1f %d\n"), StreamSizeAudioExpected, StreamSizeAudioGot, idiff);
                                if (idiff) {
                                        StreamSizeAudioGot = StreamSizeAudioExpected;
-                                       AVIOuput_AVIWriteAudio(avi_sndbuffer, avi_sndbuffered, (StreamSizeAudioExpected - lastexpected) * bytesperframe);
+                                       AVIOuput_AVIWriteAudio(avi_sndbuffer, avi_sndbuffered, (int)(StreamSizeAudioExpected - lastexpected) * bytesperframe);
                                } else {
                                        AVIOuput_AVIWriteAudio(avi_sndbuffer, avi_sndbuffered, 0);
                                }
@@ -1883,18 +1883,18 @@ STATIC_INLINE HWORD WordToHword(LWORD v, int scl)
        return out;
 }
 
-static int SrcLinear(HWORD X[], HWORD Y[], double factor, ULWORD *Time, UHWORD Nx)
+static int SrcLinear(HWORD X[], HWORD Y[], float factor, ULWORD *Time, UHWORD Nx)
 {
        HWORD iconst;
        HWORD *Xp, *Ystart;
        LWORD v, x1, x2;
 
-       double dt;                  /* Step through input signal */
+       float dt;                  /* Step through input signal */
        ULWORD dtb;                  /* Fixed-point version of Dt */
        ULWORD endTime;              /* When Time reaches EndTime, return to user */
 
-       dt = 1.0 / factor;            /* Output sampling period */
-       dtb = dt*(1 << Np) + 0.5;     /* Fixed-point representation */
+       dt = 1.0f / factor;            /* Output sampling period */
+       dtb = (ULWORD)(dt*(1 << Np) + 0.5);     /* Fixed-point representation */
 
        Ystart = Y;
        endTime = *Time + (1 << Np)*(LWORD)Nx;
@@ -1916,7 +1916,7 @@ static int SrcLinear(HWORD X[], HWORD Y[], double factor, ULWORD *Time, UHWORD N
 #define OBUFFSIZE 8192                         /* Output buffer size */
 
 static int resampleFast(  /* number of output samples returned */
-       double factor,              /* factor = Sndout/Sndin */
+       float factor,              /* factor = Sndout/Sndin */
        HWORD *in,                   /* input and output file descriptors */
        HWORD *out,
        int inCount,                /* number of input samples to convert */
index cf5ba97030c9ef587c6ca9dcced8283a7fafeda2..05d849e6db92249099f68f9ac8addfbc680d09cb 100644 (file)
@@ -137,12 +137,12 @@ int caps_loadimage (struct zfile *zf, int drv, int *num_tracks)
        struct CapsDateTimeExt *cdt;
        int type;
 
-       if (!caps_init ())
+       if (!caps_init())
                return 0;
-       caps_unloadimage (drv);
-       zfile_fseek (zf, 0, SEEK_END);
-       len = zfile_ftell (zf);
-       zfile_fseek (zf, 0, SEEK_SET);
+       caps_unloadimage(drv);
+       zfile_fseek(zf, 0, SEEK_END);
+       len = zfile_ftell32(zf);
+       zfile_fseek(zf, 0, SEEK_SET);
        if (len <= 0)
                return 0;
        buf = xmalloc (uae_u8, len);
index 86e5ec15ab53019f94d8bfa6521202a5b8dbac98..d681fedf6f39ccdf11d1a556d721a098210bd071 100644 (file)
@@ -439,7 +439,7 @@ static bool cdda_play2(struct cda_play *ciw, int *outpos)
 
                        if (*outpos < 0) {
                                _ftime(&tb2);
-                               int diff = (tb2.time * (uae_s64)1000 + tb2.millitm) - (tb1.time * (uae_s64)1000 + tb1.millitm);
+                               int diff = (int)((tb2.time * (uae_s64)1000 + tb2.millitm) - (tb1.time * (uae_s64)1000 + tb1.millitm));
                                diff -= ciw->cdda_delay;
                                if (idleframes >= 0 && diff < 0 && ciw->cdda_play > 0)
                                        sleep_millis(-diff);
index b4515a2046aa680d2ef057580ff8f928e5f85774..8115bdf824916eab1e5db2bfdc7995edb88a2c14 100644 (file)
@@ -1548,7 +1548,7 @@ static BOOL CALLBACK childenumproc (HWND hwnd, LPARAM lParam)
        adjust = height_adjust / count;
        remainder = height_adjust % count;
        if (randidx < 0) {
-               srand(time(NULL));
+               srand((unsigned int)time(NULL));
                randidx = rand() % count;
        }
        while (id3y[j] >= 0) {
index 9421a5da03bbb1bbc0283c8bcdd3f56772256388..94ea25edc1a5a6651c447810cd75c4a3b78c3123 100644 (file)
@@ -1806,7 +1806,7 @@ static bool initialize_rawinput (void)
                                if (rdim->dwNumberOfButtons >= ID_BUTTON_TOTAL) {
                                        write_log (_T("bogus number of buttons, ignored\n"));
                                } else {
-                                       did->buttons_real = did->buttons = rdim->dwNumberOfButtons;
+                                       did->buttons_real = did->buttons = (uae_s16)rdim->dwNumberOfButtons;
                                        for (j = 0; j < did->buttons; j++) {
                                                did->buttonsort[j] = j;
                                                did->buttonmappings[j] = j;
@@ -2922,7 +2922,7 @@ static BOOL CALLBACK EnumObjectsCallback (const DIDEVICEOBJECTINSTANCE* pdidoi,
                else if (did->type == DID_MOUSE)
                        did->axissort[did->axles] = makesort_mouse (&pdidoi->guidType, &did->axismappings[did->axles]);
                for (i = 0; i < 2; i++) {
-                       did->axismappings[did->axles + i] = DIJOFS_POV(numpov);
+                       did->axismappings[did->axles + i] = (uae_s16)DIJOFS_POV(numpov);
                        _stprintf (tmp, _T("%s (%c)"), pdidoi->tszName, i ? 'Y' : 'X');
                        did->axisname[did->axles + i] = my_strdup (tmp);
                        did->axissort[did->axles + i] = did->axissort[did->axles];
index b47a336672bac805c603a9b1f5f5a142e06e52f5..ece5003ce74d3b31a1d06b4703870fa1b5391220 100644 (file)
@@ -1138,8 +1138,8 @@ static int psEffect_SetTextures (LPDIRECT3DTEXTURE9 lpSource, struct shaderdata
        }
        if (s->m_TargetDimsEffectHandle) {
                D3DXVECTOR4 fDimsTarget;
-               fDimsTarget.x = s->targettex_width;
-               fDimsTarget.y = s->targettex_height;
+               fDimsTarget.x = (FLOAT)s->targettex_width;
+               fDimsTarget.y = (FLOAT)s->targettex_height;
                fDimsTarget.z = 1;
                fDimsTarget.w = 1;
                hr = s->pEffect->SetVector(s->m_TargetDimsEffectHandle, &fDimsTarget);
@@ -1157,8 +1157,8 @@ static int psEffect_SetTextures (LPDIRECT3DTEXTURE9 lpSource, struct shaderdata
        }
        if (s->m_ScaleEffectHandle) {
                D3DXVECTOR4 fScale;
-               fScale.x = 1 << currprefs.gfx_resolution;
-               fScale.y = 1 << currprefs.gfx_vresolution;
+               fScale.x = (float)(1 << currprefs.gfx_resolution);
+               fScale.y = (float)(1 << currprefs.gfx_vresolution);
                fScale.w = fScale.z = 1;
                hr = s->pEffect->SetVector(s->m_ScaleEffectHandle, &fScale);
                if (FAILED(hr)) {
@@ -1167,7 +1167,7 @@ static int psEffect_SetTextures (LPDIRECT3DTEXTURE9 lpSource, struct shaderdata
                }
        }
        if (s->framecounterHandle)
-               s->pEffect->SetFloat(s->framecounterHandle, timeframes);
+               s->pEffect->SetFloat(s->framecounterHandle, (FLOAT)timeframes);
 
        return 1;
 }
@@ -1845,8 +1845,8 @@ static int createmask2texture (struct d3dstruct *d3d, const TCHAR *filename)
                goto end;
        }
 
-       d3d->mask2texture_w = img.width;
-       d3d->mask2texture_h = img.height;
+       d3d->mask2texture_w = (float)img.width;
+       d3d->mask2texture_h = (float)img.height;
        d3d->mask2texture = tx;
 
        hr = tx->LockRect(0, &locked, NULL, 0);
@@ -1859,17 +1859,17 @@ static int createmask2texture (struct d3dstruct *d3d, const TCHAR *filename)
        }
        tx->UnlockRect(0);
 
-       d3d->mask2rect.left = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, -1, 0);
-       d3d->mask2rect.right = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 1, 0);
-       d3d->mask2rect.top = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 0, -1);
-       d3d->mask2rect.bottom = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 0, 1);
+       d3d->mask2rect.left = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, -1, 0);
+       d3d->mask2rect.right = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 1, 0);
+       d3d->mask2rect.top = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 0, -1);
+       d3d->mask2rect.bottom = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 0, 1);
 
        if (d3d->mask2rect.left >= d3d->mask2texture_w / 2 || d3d->mask2rect.top >= d3d->mask2texture_h / 2 ||
                d3d->mask2rect.right <= d3d->mask2texture_w / 2 || d3d->mask2rect.bottom <= d3d->mask2texture_h / 2) {
                d3d->mask2rect.left = 0;
                d3d->mask2rect.top = 0;
-               d3d->mask2rect.right = d3d->mask2texture_w;
-               d3d->mask2rect.bottom = d3d->mask2texture_h;
+               d3d->mask2rect.right = (LONG)d3d->mask2texture_w;
+               d3d->mask2rect.bottom = (LONG)d3d->mask2texture_h;
        }
        d3d->mask2texture_multx = (float)d3d->window_w / d3d->mask2texture_w;
        d3d->mask2texture_multy = (float)d3d->window_h / d3d->mask2texture_h;
@@ -1877,8 +1877,8 @@ static int createmask2texture (struct d3dstruct *d3d, const TCHAR *filename)
 
        if (isfullscreen () > 0) {
                struct MultiDisplay *md = getdisplay(&currprefs, mon->monitor_id);
-               float deskw = md->rect.right - md->rect.left;
-               float deskh = md->rect.bottom - md->rect.top;
+               float deskw = (float)md->rect.right - md->rect.left;
+               float deskh = (float)md->rect.bottom - md->rect.top;
                //deskw = 800; deskh = 600;
                float dstratio = deskw / deskh;
                float srcratio = d3d->mask2texture_w / d3d->mask2texture_h;
@@ -1887,35 +1887,35 @@ static int createmask2texture (struct d3dstruct *d3d, const TCHAR *filename)
                d3d->mask2texture_multx = d3d->mask2texture_multy;
        }
 
-       d3d->mask2texture_wh = d3d->window_h;
+       d3d->mask2texture_wh = (float)d3d->window_h;
        d3d->mask2texture_ww = d3d->mask2texture_w * d3d->mask2texture_multx; 
 
        d3d->mask2texture_offsetw = (d3d->window_w - d3d->mask2texture_ww) / 2;
 
        if (d3d->mask2texture_offsetw > 0)
-               d3d->blanktexture = createtext (d3d, d3d->mask2texture_offsetw + 1, d3d->window_h, D3DFMT_X8R8G8B8);
+               d3d->blanktexture = createtext(d3d, (int)(d3d->mask2texture_offsetw + 1), d3d->window_h, D3DFMT_X8R8G8B8);
 
        xmult = d3d->mask2texture_multx;
        ymult = d3d->mask2texture_multy;
 
-       d3d->mask2rect.left *= xmult;
-       d3d->mask2rect.right *= xmult;
-       d3d->mask2rect.top *= ymult;
-       d3d->mask2rect.bottom *= ymult;
+       d3d->mask2rect.left *= (LONG)xmult;
+       d3d->mask2rect.right *= (LONG)xmult;
+       d3d->mask2rect.top *= (LONG)ymult;
+       d3d->mask2rect.bottom *= (LONG)ymult;
        d3d->mask2texture_wwx = d3d->mask2texture_w * xmult;
        if (d3d->mask2texture_wwx > d3d->window_w)
-               d3d->mask2texture_wwx = d3d->window_w;
+               d3d->mask2texture_wwx = (float)d3d->window_w;
        if (d3d->mask2texture_wwx < d3d->mask2rect.right - d3d->mask2rect.left)
-               d3d->mask2texture_wwx = d3d->mask2rect.right - d3d->mask2rect.left;
+               d3d->mask2texture_wwx = (float)d3d->mask2rect.right - d3d->mask2rect.left;
        if (d3d->mask2texture_wwx > d3d->mask2texture_ww)
                d3d->mask2texture_wwx = d3d->mask2texture_ww;
 
-       d3d->mask2texture_minusx = - ((d3d->window_w - d3d->mask2rect.right) + d3d->mask2rect.left);
+       d3d->mask2texture_minusx = (float)(-((d3d->window_w - d3d->mask2rect.right) + d3d->mask2rect.left));
        if (d3d->mask2texture_offsetw > 0)
                d3d->mask2texture_minusx += d3d->mask2texture_offsetw * xmult;
        
 
-       d3d->mask2texture_minusy = -(d3d->window_h - (d3d->mask2rect.bottom - d3d->mask2rect.top));
+       d3d->mask2texture_minusy = (float)(-(d3d->window_h - (d3d->mask2rect.bottom - d3d->mask2rect.top)));
 
        d3d->mask2texture_hhx = d3d->mask2texture_h * ymult;
 
@@ -2021,10 +2021,10 @@ static int createmasktexture (struct d3dstruct *d3d, const TCHAR *filename, stru
                        return 0;
                }
        }
-       size = zfile_size (zf);
-       buf = xmalloc (uae_u8, size);
-       zfile_fread (buf, size, 1, zf);
-       zfile_fclose (zf);
+       size = zfile_size32(zf);
+       buf = xmalloc(uae_u8, size);
+       zfile_fread(buf, size, 1, zf);
+       zfile_fclose(zf);
        hr = D3DXCreateTextureFromFileInMemoryEx (d3d->d3ddev, buf, size,
                 D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 1, D3DUSAGE_DYNAMIC, D3DFMT_X8R8G8B8,
                 D3DPOOL_DEFAULT, D3DX_FILTER_NONE, D3DX_FILTER_NONE, 0, &dinfo, NULL, &tx);
@@ -2122,8 +2122,8 @@ static bool xD3D_getscalerect(int monid, float *mx, float *my, float *sx, float
        if (!d3d->mask2texture)
                return false;
 
-       float mw = d3d->mask2rect.right - d3d->mask2rect.left;
-       float mh = d3d->mask2rect.bottom - d3d->mask2rect.top;
+       float mw = (float)d3d->mask2rect.right - d3d->mask2rect.left;
+       float mh = (float)d3d->mask2rect.bottom - d3d->mask2rect.top;
 
        float mxt = (float)mw / width;
        float myt = (float)mh / height;
@@ -2166,10 +2166,10 @@ static void setupscenecoords (struct d3dstruct *d3d, bool normalrender)
                zr2[monid] = zr;
        }
 
-       dw = dr.right - dr.left;
-       dh = dr.bottom - dr.top;
-       w = sr.right - sr.left;
-       h = sr.bottom - sr.top;
+       dw = (float)dr.right - dr.left;
+       dh = (float)dr.bottom - dr.top;
+       w = (float)sr.right - sr.left;
+       h = (float)sr.bottom - sr.top;
 
        d3d->fakesize.x = w;
        d3d->fakesize.y = h;
@@ -2183,14 +2183,14 @@ static void setupscenecoords (struct d3dstruct *d3d, bool normalrender)
 
        if (0 && d3d->mask2texture) {
 
-               float mw = d3d->mask2rect.right - d3d->mask2rect.left;
-               float mh = d3d->mask2rect.bottom - d3d->mask2rect.top;
+               float mw = (float)d3d->mask2rect.right - d3d->mask2rect.left;
+               float mh = (float)d3d->mask2rect.bottom - d3d->mask2rect.top;
 
                tx = -0.5f + dw * d3d->tin_w / mw / 2;
                ty = +0.5f + dh * d3d->tin_h / mh / 2;
 
-               float xshift = -zr.left;
-               float yshift = -zr.top;
+               float xshift = (float)-zr.left;
+               float yshift = (float)-zr.top;
 
                sw = dw * d3d->tin_w / vidinfo->outbuffer->inwidth2;
                sw *= mw / d3d->window_w;
@@ -2210,8 +2210,8 @@ static void setupscenecoords (struct d3dstruct *d3d, bool normalrender)
                tx = -0.5f + dw * d3d->tin_w / d3d->window_w / 2;
                ty = +0.5f + dh * d3d->tin_h / d3d->window_h / 2;
 
-               float xshift = - zr.left - sr.left; // - (tin_w - 2 * zr.left - w),
-               float yshift = + zr.top + sr.top - (d3d->tin_h - h);
+               float xshift = (float)(- zr.left - sr.left); // - (tin_w - 2 * zr.left - w),
+               float yshift = (float)(+ zr.top + sr.top - (d3d->tin_h - h));
        
                sw = dw * d3d->tin_w / d3d->window_w;
                sh = dh * d3d->tin_h / d3d->window_h;
@@ -2823,7 +2823,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w
                d3d->modeex.RefreshRate = d3d->dpp.FullScreen_RefreshRateInHz;
                if (vsync > 0) {
                        d3d->dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
-                       getvsyncrate(monid, d3d->dpp.FullScreen_RefreshRateInHz, &hzmult);
+                       getvsyncrate(monid, (float)d3d->dpp.FullScreen_RefreshRateInHz, &hzmult);
                        if (hzmult < 0) {
                                if (!ap.gfx_strobo) {
                                        if (d3dCaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO)
@@ -2840,7 +2840,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w
                if (mode.RefreshRate > 0) {
                        if (vsync > 0) {
                                d3d->dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
-                               getvsyncrate(monid, mode.RefreshRate, &hzmult);
+                               getvsyncrate(monid, (float)mode.RefreshRate, &hzmult);
                                if (hzmult < 0) {
                                        if (!ap.gfx_strobo) {
                                                if ((d3dCaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO) && isfullscreen() > 0)
@@ -2858,7 +2858,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w
 
        if (vsync < 0) {
                d3d->vsync2 = 0;
-               getvsyncrate(monid, isfullscreen() > 0 ? d3d->dpp.FullScreen_RefreshRateInHz : mode.RefreshRate, &hzmult);
+               getvsyncrate(monid, (float)(isfullscreen() > 0 ? d3d->dpp.FullScreen_RefreshRateInHz : mode.RefreshRate), &hzmult);
                if (hzmult > 0) {
                        d3d->vsync2 = 1;
                } else if (hzmult < 0) {
@@ -3510,7 +3510,7 @@ static void D3D_render2(struct d3dstruct *d3d, int mode)
                texelsize.z = 1; texelsize.w = 1;
                hr = postEffect->SetVector (d3d->postTexelSize, &texelsize);
                if (d3d->postFramecounterHandle)
-                       postEffect->SetFloat(d3d->postFramecounterHandle, timeframes);
+                       postEffect->SetFloat(d3d->postFramecounterHandle, (FLOAT)timeframes);
 
                if (masktexture) {
                        if (FAILED (hr = postEffect->SetTechnique (d3d->postTechnique)))
@@ -3543,8 +3543,8 @@ static void D3D_render2(struct d3dstruct *d3d, int mode)
                }
                if (s->m_TargetDimsEffectHandle) {
                        D3DXVECTOR4 fDimsTarget;
-                       fDimsTarget.x = s->targettex_width;
-                       fDimsTarget.y = s->targettex_height;
+                       fDimsTarget.x = (FLOAT)s->targettex_width;
+                       fDimsTarget.y = (FLOAT)s->targettex_height;
                        fDimsTarget.z = 1; fDimsTarget.w = 1;
                        hr = postEffect->SetVector(s->m_TargetDimsEffectHandle, &fDimsTarget);
                        if (FAILED(hr)) {
@@ -3625,9 +3625,9 @@ static void D3D_render2(struct d3dstruct *d3d, int mode)
                                MatrixScaling(&t, ((float)(d3d->window_w) / (d3d->tout_w + 2 * d3d->cursor_offset2_x)), ((float)(d3d->window_h) / (d3d->tout_h + 2 * d3d->cursor_offset2_y)), 0);
                        else
                                MatrixScaling(&t, 1.0f, 1.0f, 0);
-                       v.x = d3d->cursor_x + d3d->cursor_offset2_x;
-                       v.y = d3d->cursor_y + d3d->cursor_offset2_y;
-                       v.z = 0;
+                       v.x = (float)d3d->cursor_x + d3d->cursor_offset2_x;
+                       v.y = (float)d3d->cursor_y + d3d->cursor_offset2_y;
+                       v.z = 0.0f;
                        d3d->sprite->SetTransform(&t);
                        d3d->sprite->Draw(d3d->cursorsurfaced3d, NULL, NULL, &v, 0xffffffff);
                        MatrixScaling(&t, 1, 1, 0);
@@ -3664,19 +3664,19 @@ static void D3D_render2(struct d3dstruct *d3d, int mode)
 
                        v.x = 0;
                        if (d3d->filterd3d->gfx_filteroverlay_pos.x == -1)
-                               v.x = (d3d->window_w - (d3d->mask2texture_w * w)) / 2;
+                               v.x = (d3d->window_w - (d3d->mask2texture_w * w)) / 2.0f;
                        else if (d3d->filterd3d->gfx_filteroverlay_pos.x > -24000)
-                               v.x = d3d->filterd3d->gfx_filteroverlay_pos.x;
+                               v.x = (float)d3d->filterd3d->gfx_filteroverlay_pos.x;
                        else
-                               v.x = (d3d->window_w - (d3d->mask2texture_w * w)) / 2 + (-d3d->filterd3d->gfx_filteroverlay_pos.x - 30100) * d3d->window_w / 100.0;
+                               v.x = (d3d->window_w - (d3d->mask2texture_w * w)) / 2 + (-d3d->filterd3d->gfx_filteroverlay_pos.x - 30100) * d3d->window_w / 100.0f;
 
                        v.y = 0;
                        if (d3d->filterd3d->gfx_filteroverlay_pos.y == -1)
-                               v.y = (d3d->window_h - (d3d->mask2texture_h * h)) / 2;
+                               v.y = (d3d->window_h - (d3d->mask2texture_h * h)) / 2.0f;
                        else if (d3d->filterd3d->gfx_filteroverlay_pos.y > -24000)
-                               v.y = d3d->filterd3d->gfx_filteroverlay_pos.y;
+                               v.y = (float)d3d->filterd3d->gfx_filteroverlay_pos.y;
                        else
-                               v.y = (d3d->window_h - (d3d->mask2texture_h * h)) / 2 + (-d3d->filterd3d->gfx_filteroverlay_pos.y - 30100) * d3d->window_h / 100.0;
+                               v.y = (d3d->window_h - (d3d->mask2texture_h * h)) / 2 + (-d3d->filterd3d->gfx_filteroverlay_pos.y - 30100) * d3d->window_h / 100.0f;
 
                        v.x /= w;
                        v.y /= h;
@@ -3686,8 +3686,8 @@ static void D3D_render2(struct d3dstruct *d3d, int mode)
 
                        r.left = 0;
                        r.top = 0;
-                       r.right = d3d->mask2texture_w;
-                       r.bottom = d3d->mask2texture_h;
+                       r.right = (LONG)d3d->mask2texture_w;
+                       r.bottom = (LONG)d3d->mask2texture_h;
                        if (showoverlay) {
                                d3d->sprite->SetTransform(&t);
                                d3d->sprite->Draw(d3d->mask2texture, &r, NULL, &v, 0xffffffff);
@@ -3699,8 +3699,8 @@ static void D3D_render2(struct d3dstruct *d3d, int mode)
                                                if (!led && ledtypes[i] == LED_POWER && currprefs.power_led_dim)
                                                        spr = d3d->mask2textureled_power_dim;
                                                if (spr) {
-                                                       v.x = d3d->mask2texture_offsetw / w + d3d->mask2textureledoffsets[i * 2 + 0];
-                                                       v.y = d3d->mask2textureledoffsets[i * 2 + 1];
+                                                       v.x = (FLOAT)(d3d->mask2texture_offsetw / w + d3d->mask2textureledoffsets[i * 2 + 0]);
+                                                       v.y = (FLOAT)d3d->mask2textureledoffsets[i * 2 + 1];
                                                        v.z = 0;
                                                        d3d->sprite->Draw(spr, NULL, NULL, &v, 0xffffffff);
                                                        d3d->sprite->Flush();
@@ -3717,7 +3717,7 @@ static void D3D_render2(struct d3dstruct *d3d, int mode)
                                v.y = 0;
                                r.left = 0;
                                r.top = 0;
-                               r.right = d3d->mask2texture_offsetw + 1;
+                               r.right = (LONG)d3d->mask2texture_offsetw + 1;
                                r.bottom = d3d->window_h;
                                d3d->sprite->Draw (d3d->blanktexture, &r, NULL, &v, 0xffffffff);
                                if (d3d->window_w > d3d->mask2texture_offsetw + d3d->mask2texture_ww) {
@@ -3725,8 +3725,8 @@ static void D3D_render2(struct d3dstruct *d3d, int mode)
                                        v.y = 0;
                                        r.left = 0;
                                        r.top = 0;
-                                       r.right = d3d->window_w - (d3d->mask2texture_offsetw + d3d->mask2texture_ww) + 1;
-                                       r.bottom = d3d->window_h;
+                                       r.right = (LONG)(d3d->window_w - (d3d->mask2texture_offsetw + d3d->mask2texture_ww) + 1);
+                                       r.bottom = (LONG)d3d->window_h;
                                        d3d->sprite->Draw(d3d->blanktexture, &r, NULL, &v, 0xffffffff);
                                }
                        }
@@ -3735,17 +3735,17 @@ static void D3D_render2(struct d3dstruct *d3d, int mode)
                if (d3d->ledtexture && (((currprefs.leds_on_screen & STATUSLINE_RTG) && WIN32GFX_IsPicassoScreen(mon)) || ((currprefs.leds_on_screen & STATUSLINE_CHIPSET) && !WIN32GFX_IsPicassoScreen(mon)))) {
                        int slx, sly;
                        statusline_getpos(d3d - d3ddata, &slx, &sly, d3d->window_w, d3d->window_h);
-                       v.x = slx;
-                       v.y = sly;
-                       v.z = 0;
+                       v.x = (float)slx;
+                       v.y = (float)sly;
+                       v.z = 0.0f;
                        d3d->sprite->Draw(d3d->ledtexture, NULL, NULL, &v, 0xffffffff);
                }
                struct d3d9overlay *ov = d3d->extoverlays;
                while (ov) {
                        if (ov->tex) {
-                               v.x = ov->x;
-                               v.y = ov->y;
-                               v.z = 0;
+                               v.x = (float)ov->x;
+                               v.y = (float)ov->y;
+                               v.z = 0.0f;
                                d3d->sprite->Draw(ov->tex, NULL, NULL, &v, 0xffffffff);
                        }
                        ov = ov->next;
@@ -4060,11 +4060,11 @@ static float xD3D_getrefreshrate(int monid)
 
        waitfakemode (d3d);
        if (!isd3d (d3d))
-               return -1;
+               return -1.0f;
        hr = d3d->d3ddev->GetDisplayMode (0, &dmode);
        if (FAILED (hr))
-               return -1;
-       return dmode.RefreshRate;
+               return -1.0f;
+       return (float)dmode.RefreshRate;
 }
 
 static void xD3D_guimode(int monid, int guion)
index 9e08010fcfcf367a19382e6d9f9db94614bce6f4..9396b52cf04b72d6fff06273476cd95d46c273cc 100644 (file)
@@ -1038,7 +1038,7 @@ static bool psEffect_LoadEffect(struct d3d11struct *d3d, const TCHAR *shaderfile
                write_log(_T("Failed to open '%s'\n"), tmp);
                goto end;
        }
-       size = zfile_size(z);
+       size = zfile_size32(z);
        fx1 = xcalloc(char, size * 4);
        fx2 = xcalloc(char, size * 4);
        if (zfile_fread(fx1, 1, size, z) != size) {
@@ -1261,8 +1261,8 @@ static int psEffect_SetTextures(ID3D11Texture2D *lpSourceTex, ID3D11ShaderResour
        }
        if (s->m_TargetDimsEffectHandle) {
                D3DXVECTOR4 fDimsTarget;
-               fDimsTarget.x = s->targettex_width;
-               fDimsTarget.y = s->targettex_height;
+               fDimsTarget.x = (float)s->targettex_width;
+               fDimsTarget.y = (float)s->targettex_height;
                fDimsTarget.z = 1;
                fDimsTarget.w = 1;
                s->m_TargetDimsEffectHandle->SetFloatVector((float*)&fDimsTarget);
@@ -1272,8 +1272,8 @@ static int psEffect_SetTextures(ID3D11Texture2D *lpSourceTex, ID3D11ShaderResour
        }
        if (s->m_ScaleEffectHandle) {
                D3DXVECTOR4 fScale;
-               fScale.x = 1 << currprefs.gfx_resolution;
-               fScale.y = 1 << currprefs.gfx_vresolution;
+               fScale.x = (float)(1 << currprefs.gfx_resolution);
+               fScale.y = (float)(1 << currprefs.gfx_vresolution);
                fScale.w = fScale.z = 1;
                s->m_ScaleEffectHandle->SetFloatVector((float*)&fScale);
        }
@@ -1491,14 +1491,14 @@ static bool UpdateBuffers(struct d3d11struct *d3d)
        positionY = (sh - bh) / 2 + d3d->yoffset;
 
        // Calculate the screen coordinates of the left side of the bitmap.
-       left = (sw + 1) / -2;
+       left = (sw + 1.0f) / -2.0f;
        left += positionX;
 
        // Calculate the screen coordinates of the right side of the bitmap.
        right = left + bw;
 
        // Calculate the screen coordinates of the top of the bitmap.
-       top = (sh + 1) / 2;
+       top = (sh + 1.0f) / 2.0f;
        top -= positionY;
 
        // Calculate the screen coordinates of the bottom of the bitmap.
@@ -1549,10 +1549,10 @@ static void setupscenecoords(struct d3d11struct *d3d, bool normalrender)
        d3d->dr2 = dr;
        d3d->zr2 = zr;
 
-       float dw = dr.right - dr.left;
-       float dh = dr.bottom - dr.top;
-       float w = sr.right - sr.left;
-       float h = sr.bottom - sr.top;
+       float dw = (float)dr.right - dr.left;
+       float dh = (float)dr.bottom - dr.top;
+       float w = (float)sr.right - sr.left;
+       float h = (float)sr.bottom - sr.top;
 
        int tx = ((dr.right - dr.left) * d3d->m_bitmapWidth) / (d3d->m_screenWidth * 2);
        int ty = ((dr.bottom - dr.top) * d3d->m_bitmapHeight) / (d3d->m_screenHeight * 2);
@@ -1580,7 +1580,7 @@ static void setupscenecoords(struct d3d11struct *d3d, bool normalrender)
        UpdateBuffers(d3d);
 
        xD3DXMatrixOrthoOffCenterLH(&d3d->m_matProj_out, 0, w + 0.05f, 0, h + 0.05f, 0.0f, 1.0f);
-       xD3DXMatrixTranslation(&d3d->m_matView_out, tx, ty, 1.0f);
+       xD3DXMatrixTranslation(&d3d->m_matView_out, (float)tx, (float)ty, 1.0f);
        sw *= d3d->m_bitmapWidth;
        sh *= d3d->m_bitmapHeight;
        xD3DXMatrixScaling(&d3d->m_matWorld_out, sw + 0.5f / sw, sh + 0.5f / sh, 1.0f);
@@ -1608,8 +1608,8 @@ static void updateleds(struct d3d11struct *d3d)
                return;
 
        statusline_getpos(d3d - d3d11data, &osdx, &osdy, d3d->m_screenWidth, d3d->m_screenHeight);
-       d3d->osd.x = osdx;
-       d3d->osd.y = osdy;
+       d3d->osd.x = (float)osdx;
+       d3d->osd.y = (float)osdy;
 
        hr = d3d->m_deviceContext->Map(d3d->osd.texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
        if (FAILED(hr)) {
@@ -2601,8 +2601,8 @@ static int createmask2texture(struct d3d11struct *d3d, const TCHAR *filename)
                write_log(_T("Overlay texture '%s' load failed.\n"), filename);
                goto end;
        }
-       d3d->mask2texture_w = img.width;
-       d3d->mask2texture_h = img.height;
+       d3d->mask2texture_w = (float)img.width;
+       d3d->mask2texture_h = (float)img.height;
        if (!allocsprite(d3d, &d3d->mask2texture, img.width, img.height, true))
                goto end;
 
@@ -2623,19 +2623,19 @@ static int createmask2texture(struct d3d11struct *d3d, const TCHAR *filename)
 
        d3d->mask2rect.left = 0;
        d3d->mask2rect.top = 0;
-       d3d->mask2rect.right = d3d->mask2texture_w;
-       d3d->mask2rect.bottom = d3d->mask2texture_h;
+       d3d->mask2rect.right = (LONG)d3d->mask2texture_w;
+       d3d->mask2rect.bottom = (LONG)d3d->mask2texture_h;
 
-       d3d->mask2rect.left = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, -1, 0);
-       d3d->mask2rect.right = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 1, 0);
-       d3d->mask2rect.top = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 0, -1);
-       d3d->mask2rect.bottom = findedge(&img, d3d->mask2texture_w, d3d->mask2texture_h, 0, 1);
+       d3d->mask2rect.left = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, -1, 0);
+       d3d->mask2rect.right = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 1, 0);
+       d3d->mask2rect.top = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 0, -1);
+       d3d->mask2rect.bottom = findedge(&img, (int)d3d->mask2texture_w, (int)d3d->mask2texture_h, 0, 1);
        if (d3d->mask2rect.left >= d3d->mask2texture_w / 2 || d3d->mask2rect.top >= d3d->mask2texture_h / 2 ||
                d3d->mask2rect.right <= d3d->mask2texture_w / 2 || d3d->mask2rect.bottom <= d3d->mask2texture_h / 2) {
                d3d->mask2rect.left = 0;
                d3d->mask2rect.top = 0;
-               d3d->mask2rect.right = d3d->mask2texture_w;
-               d3d->mask2rect.bottom = d3d->mask2texture_h;
+               d3d->mask2rect.right = (LONG)d3d->mask2texture_w;
+               d3d->mask2rect.bottom = (LONG)d3d->mask2texture_h;
        }
        d3d->mask2texture_multx = (float)d3d->m_screenWidth / d3d->mask2texture_w;
        d3d->mask2texture_multy = (float)d3d->m_screenHeight / d3d->mask2texture_h;
@@ -2643,8 +2643,8 @@ static int createmask2texture(struct d3d11struct *d3d, const TCHAR *filename)
 
        if (isfs(d3d) > 0) {
                struct MultiDisplay *md = getdisplay(&currprefs, mon->monitor_id);
-               float deskw = md->rect.right - md->rect.left;
-               float deskh = md->rect.bottom - md->rect.top;
+               float deskw = (float)md->rect.right - md->rect.left;
+               float deskh = (float)md->rect.bottom - md->rect.top;
                //deskw = 800; deskh = 600;
                float dstratio = deskw / deskh;
                float srcratio = d3d->mask2texture_w / d3d->mask2texture_h;
@@ -2653,35 +2653,35 @@ static int createmask2texture(struct d3d11struct *d3d, const TCHAR *filename)
                d3d->mask2texture_multx = d3d->mask2texture_multy;
        }
 
-       d3d->mask2texture_wh = d3d->m_screenHeight;
-       d3d->mask2texture_ww = d3d->mask2texture_w * d3d->mask2texture_multx;
+       d3d->mask2texture_wh = (float)d3d->m_screenHeight;
+       d3d->mask2texture_ww = (float)d3d->mask2texture_w * d3d->mask2texture_multx;
 
        d3d->mask2texture_offsetw = (d3d->m_screenWidth - d3d->mask2texture_ww) / 2;
 
        if (d3d->mask2texture_offsetw > 0) {
-               allocsprite(d3d, &d3d->blanksprite, d3d->mask2texture_offsetw + 1, d3d->m_screenHeight, false);
+               allocsprite(d3d, &d3d->blanksprite, (int)d3d->mask2texture_offsetw + 1, d3d->m_screenHeight, false);
        }
 
        xmult = d3d->mask2texture_multx;
        ymult = d3d->mask2texture_multy;
 
-       d3d->mask2rect.left *= xmult;
-       d3d->mask2rect.right *= xmult;
-       d3d->mask2rect.top *= ymult;
-       d3d->mask2rect.bottom *= ymult;
+       d3d->mask2rect.left *= (int)xmult;
+       d3d->mask2rect.right *= (int)xmult;
+       d3d->mask2rect.top *= (int)ymult;
+       d3d->mask2rect.bottom *= (int)ymult;
        d3d->mask2texture_wwx = d3d->mask2texture_w * xmult;
        if (d3d->mask2texture_wwx > d3d->m_screenWidth)
-               d3d->mask2texture_wwx = d3d->m_screenWidth;
+               d3d->mask2texture_wwx = (float)d3d->m_screenWidth;
        if (d3d->mask2texture_wwx < d3d->mask2rect.right - d3d->mask2rect.left)
-               d3d->mask2texture_wwx = d3d->mask2rect.right - d3d->mask2rect.left;
+               d3d->mask2texture_wwx = (float)d3d->mask2rect.right - d3d->mask2rect.left;
        if (d3d->mask2texture_wwx > d3d->mask2texture_ww)
                d3d->mask2texture_wwx = d3d->mask2texture_ww;
 
-       d3d->mask2texture_minusx = -((d3d->m_screenWidth - d3d->mask2rect.right) + d3d->mask2rect.left);
+       d3d->mask2texture_minusx = (float)(-((d3d->m_screenWidth - d3d->mask2rect.right) + d3d->mask2rect.left));
        if (d3d->mask2texture_offsetw > 0)
                d3d->mask2texture_minusx += d3d->mask2texture_offsetw * xmult;
 
-       d3d->mask2texture_minusy = -(d3d->m_screenHeight - (d3d->mask2rect.bottom - d3d->mask2rect.top));
+       d3d->mask2texture_minusy = (float)(-(d3d->m_screenHeight - (d3d->mask2rect.bottom - d3d->mask2rect.top)));
 
        d3d->mask2texture_hhx = d3d->mask2texture_h * ymult;
 
@@ -3396,7 +3396,6 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t
        ComPtr<IDXGIFactory5> factory5;
        IDXGIAdapter1 *adapter;
        IDXGIOutput *adapterOutput;
-       IDXGIOutput2 *adapterOutput2;
        DXGI_ADAPTER_DESC1 adesc;
        DXGI_OUTPUT_DESC odesc;
        unsigned int numModes;
@@ -3645,7 +3644,7 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t
                                d3d->fsSwapChainDesc.RefreshRate.Denominator = m->RefreshRate.Denominator;
                                d3d->fsSwapChainDesc.RefreshRate.Numerator = m->RefreshRate.Numerator;
                                if (!currprefs.gfx_variable_sync) {
-                                       *freq = nfreq;
+                                       *freq = (int)nfreq;
                                }
                        }
                }
@@ -3811,7 +3810,7 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t
        if (!monid && isvsync()) {
                int vsync = isvsync();
                int hzmult = 0;
-               getvsyncrate(monid, *freq, &hzmult);
+               getvsyncrate(monid, (float)*freq, &hzmult);
                if (hzmult < 0 && !currprefs.gfx_variable_sync && apm->gfx_vsyncmode == 0) {
                        if (!apm->gfx_strobo) {
                                d3d->vblankintervals = 2;
@@ -3825,7 +3824,7 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t
                                d3d->blackscreen = true;
                        d3d->vblankintervals = 1;
                        int hzmult;
-                       getvsyncrate(monid, hz, &hzmult);
+                       getvsyncrate(monid, (float)hz, &hzmult);
                        if (hzmult < 0) {
                                d3d->vblankintervals = 1 + (-hzmult) - (d3d->blackscreen ? 1 : 0);
                        }
@@ -4129,8 +4128,8 @@ static void setpsbuffer(struct d3d11struct *d3d, ID3D11Buffer *psbuffer)
                return;
        }
 
-       float bri = ((float)(currprefs.gfx_luminance)) * (1.0f / 2000.0f) + 1.0;
-       float con = ((float)(currprefs.gfx_contrast + 2000)) / 2000.0f;
+       float bri = (currprefs.gfx_luminance) * (1.0f / 2000.0f) + 1.0f;
+       float con = (currprefs.gfx_contrast + 2000.0f) / 2000.0f;
 
        // Get a pointer to the data in the constant buffer.
        dataPtr = (PSBufferType *)mappedResource.pData;
@@ -4241,9 +4240,9 @@ static void RenderSprite(struct d3d11struct *d3d, struct d3d11sprite *spr)
        if (!spr->enabled)
                return;
        
-       left = (d3d->m_screenWidth + 1) / -2;
+       left = (d3d->m_screenWidth + 1.0f) / -2.0f;
        left += spr->x;
-       top = (d3d->m_screenHeight + 1) / 2;
+       top = (d3d->m_screenHeight + 1.0f) / 2.0f;
        top -= spr->y;
 
        if (spr->outwidth) {
@@ -4287,8 +4286,8 @@ static void RenderSprite(struct d3d11struct *d3d, struct d3d11sprite *spr)
 
 static void setspritescaling(struct d3d11sprite *spr, float w, float h)
 {
-       spr->outwidth = (int)(w * spr->width + 0.5);
-       spr->outheight = (int)(h * spr->height + 0.5);
+       spr->outwidth = w * spr->width + 0.5f;
+       spr->outheight = h * spr->height + 0.5f;
 }
 
 static void renderoverlay(struct d3d11struct *d3d)
@@ -5203,8 +5202,8 @@ static bool xD3D_setcursor(int monid, int x, int y, int width, int height, bool
        if (width && height) {
                d3d->cursor_offset2_x = d3d->cursor_offset_x * d3d->m_screenWidth / width;
                d3d->cursor_offset2_y = d3d->cursor_offset_y * d3d->m_screenHeight / height;
-               d3d->cursor_x = x * d3d->m_screenWidth / width;
-               d3d->cursor_y = y * d3d->m_screenHeight / height;
+               d3d->cursor_x = (float)x * d3d->m_screenWidth / width;
+               d3d->cursor_y = (float)y * d3d->m_screenHeight / height;
        } else {
                d3d->cursor_x = d3d->cursor_y = 0;
                d3d->cursor_offset2_x = d3d->cursor_offset2_y = 0;
@@ -5212,13 +5211,13 @@ static bool xD3D_setcursor(int monid, int x, int y, int width, int height, bool
 
        //write_log(_T("%.1fx%.1f %dx%d\n"), d3d->cursor_x, d3d->cursor_y, d3d->cursor_offset2_x, d3d->cursor_offset2_y);
 
-       float multx = 1.0;
-       float multy = 1.0;
+       float multx = 1.0f;
+       float multy = 1.0f;
        if (d3d->cursor_scale) {
                multx = ((float)(d3d->m_screenWidth) / ((d3d->m_bitmapWidth * d3d->dmult) + 2 * d3d->cursor_offset2_x));
                multy = ((float)(d3d->m_screenHeight) / ((d3d->m_bitmapHeight * d3d->dmult) + 2 * d3d->cursor_offset2_y));
        }
-       setspritescaling(&d3d->hwsprite, 1.0 / multx, 1.0 / multy);
+       setspritescaling(&d3d->hwsprite, 1.0f / multx, 1.0f / multy);
 
        d3d->hwsprite.x = d3d->cursor_x * multx + d3d->cursor_offset2_x * multx;
        d3d->hwsprite.y = d3d->cursor_y * multy + d3d->cursor_offset2_y * multy;
@@ -5258,8 +5257,8 @@ static bool xD3D11_getscalerect(int monid, float *mx, float *my, float *sx, floa
        if (!d3d->mask2texture.enabled)
                return false;
 
-       float mw = d3d->mask2rect.right - d3d->mask2rect.left;
-       float mh = d3d->mask2rect.bottom - d3d->mask2rect.top;
+       float mw = (float)(d3d->mask2rect.right - d3d->mask2rect.left);
+       float mh = (float)(d3d->mask2rect.bottom - d3d->mask2rect.top);
 
        float mxt = (float)mw / width;
        float myt = (float)mh / height;
@@ -5313,8 +5312,8 @@ static bool xD3D11_extoverlay(struct extoverlay *ext)
                return false;
 
        if (!ext->data && s && (ext->width == 0 || ext->height == 0)) {
-               s->x = ext->xpos;
-               s->y = ext->ypos;
+               s->x = (float)ext->xpos;
+               s->y = (float)ext->ypos;
                return true;
        }
 
@@ -5361,8 +5360,8 @@ static bool xD3D11_extoverlay(struct extoverlay *ext)
        }
 
        s->enabled = true;
-       s->x = ext->xpos;
-       s->y = ext->ypos;
+       s->x = (float)ext->xpos;
+       s->y = (float)ext->ypos;
 
        hr = d3d->m_deviceContext->Map(s->texture, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
        if (SUCCEEDED(hr)) {
index 10d1c2e1566286af0552e9296ecb31cd696230d3..742328b5e1a25473dd92c56104d079980d753f53 100644 (file)
@@ -47,7 +47,7 @@ static int CmdSeek (HANDLE h_, BYTE cyl_)
 static int CmdSpecify (HANDLE h_, BYTE srt_, BYTE hut_, BYTE hlt_, BYTE nd_)
 {
        DWORD dwRet;
-       FD_SPECIFY_PARAMS sp = { (srt_ << 4) | (hut_ & 0x0f), (hlt_ << 1) | (nd_ & 1) };
+       FD_SPECIFY_PARAMS sp = { (BYTE)((srt_ << 4) | (hut_ & 0x0f)), (BYTE)((hlt_ << 1) | (nd_ & 1)) };
        if (h == INVALID_HANDLE_VALUE)
                return 0;
        return !!DeviceIoControl(h_, IOCTL_FDCMD_SPECIFY, &sp, sizeof(sp), NULL, 0, &dwRet, NULL);
index f8f3ff9b6d37a43d575dd4bc5cedb6daa0331248..10e2ddbeeffde60c6eff2ecce742dd9c20006297 100644 (file)
@@ -426,7 +426,7 @@ HRESULT DirectDraw_SetDisplayMode (int width, int height, int bits, int freq)
                dxdata.depth == bits && dxdata.freq == freq)
                return DD_OK;
 
-       getvsyncrate(0, freq, &dxdata.vblank_skip);
+       getvsyncrate(0, (float)freq, &dxdata.vblank_skip);
        dxdata.vblank_skip_cnt = 0;
        ddrval = IDirectDraw7_SetDisplayMode (dxdata.maindd, width, height, bits, freq, 0);
        if (FAILED (ddrval)) {
@@ -1330,7 +1330,7 @@ bool DD_getvblankpos (int *vpos)
        return true;
 }
 
-void DD_vblank_reset (double freq)
+void DD_vblank_reset(float freq)
 {
        getvsyncrate(0, freq, &dxdata.vblank_skip);
        dxdata.vblank_skip_cnt = 0;
index 8099168bbfd5e0c773b12a9c546ef18459b6dbce..038ec2ba03541b3c752385ef5139302f8fe13e6a 100644 (file)
@@ -195,7 +195,7 @@ int DirectDraw_BlitRect (LPDIRECTDRAWSURFACE7 dst, RECT *dstrect, LPDIRECTDRAWSU
 void DirectDraw_Fill (RECT *rect, uae_u32 color);
 void DirectDraw_FillPrimary (void);
 bool DD_getvblankpos (int *vpos);
-void DD_vblank_reset (double freq);
+void DD_vblank_reset (float freq);
 
 void dx_check (void);
 int dx_islost (void);
index 6b5b62936cbb8888fc7f2fe19c5bec487f708fee..afdfbf1091559f8b3047337ca2b7007e541b6ef3 100644 (file)
@@ -277,11 +277,11 @@ static void tochs(uae_u8 *data, uae_s64 offset, int *cp, int *hp, int *sp)
        s = (data[6 * 2 + 0] << 8) | (data[6 * 2 + 1] << 0);
        if (offset >= 0) {
                offset /= 512;
-               c = offset / (h * s);
+               c = (int)(offset / (h * s));
                offset -= c * h * s;
-               h = offset / s;
+               h = (int)(offset / s);
                offset -= h * s;
-               s = offset + 1;
+               s = (int)offset + 1;
        }
        *cp = c;
        *hp = h;
@@ -2844,8 +2844,8 @@ static bool getstorageinfo(uae_driveinfo *udi, STORAGE_DEVICE_NUMBER sdnp)
        SetupDiDestroyDeviceInfoList(hIntDevInfo);
        if (vpm[0] == 0xffffffff || vpm[1] == 0xffffffff)
                return false;
-       udi->usb_vid = vpm[0];
-       udi->usb_pid = vpm[1];
+       udi->usb_vid = (uae_u16)vpm[0];
+       udi->usb_pid = (uae_u16)vpm[1];
        return true;
 }
 
@@ -3720,7 +3720,7 @@ int harddrive_to_hdf (HWND hDlg, struct uae_prefs *p, int idx)
                } else {
                        get = COPY_CACHE_SIZE;
                        if (sizecnt + get > size)
-                               get = size - sizecnt;
+                               get = (DWORD)(size - sizecnt);
                        if (!ReadFile(h, cache, get, &got, NULL)) {
                                progressdialogreturn = 4;
                                break;
@@ -3732,7 +3732,7 @@ int harddrive_to_hdf (HWND hDlg, struct uae_prefs *p, int idx)
                }
                if (got > 0) {
                        if (written + got > size)
-                               got = size - written;
+                               got = (DWORD)(size - written);
                        if (!WriteFile (hdst, cache, got, &gotdst, NULL))  {
                                progressdialogreturn = 5;
                                break;
index 583ac28f80dbe2b9f527f9485b997593925829c1..5b1ea0d4e84e094026136cd732015073a81e5f6c 100644 (file)
@@ -51,8 +51,8 @@
                         IS_BORDER(R),IS_BORDER(T),IS_BORDER(RT), \
                         texture+((x+(border%16)*HQ2X_RESOLUTION+y*16*HQ2X_RESOLUTION+(border&~15)*HQ2X_RESOLUTION*HQ2X_RESOLUTION)*4))
 
-static double sign(double a) {
-    return (a < 0?-1:1);
+static float sign(float a) {
+    return (a < 0.0f ? -1.0f : 1.0f);
 }
 
 /*
@@ -60,15 +60,15 @@ static double sign(double a) {
  cordinate system. It is mathematically exact, and well-tested for xcenter > 0 and ycenter > 0 (it's only
  used that way). It should be correct for other cases as well, but well... famous last words :)
 */
-static double intersect_any(double xcenter, double ycenter, double xsize, double ysize, double yoffset, double gradient) {
-    double g = fabs(gradient)*xsize/ysize;
-    double o = -((yoffset-ycenter) + gradient*xcenter)/ysize*sign(ycenter)*sign(yoffset)-g*0.5+0.5;
-    double yl = o, yr = o+g, xb = -o/g, xt = (1-o)/g;
-    double area = 1.0;
+static float intersect_any(float xcenter, float ycenter, float xsize, float ysize, float yoffset, float gradient) {
+    float g = (float)fabs(gradient)*xsize/ysize;
+    float o = -((yoffset-ycenter) + gradient*xcenter)/ysize*sign(ycenter)*sign(yoffset)-g*0.5f+0.5f;
+    float yl = o, yr = o+g, xb = -o/g, xt = (1-o)/g;
+    float area = 1.0;
 
     if (yl >= 1.0) xt = xb = area = 0.0;
     else if (yl > 0.0) {
-        area = 1.0-yl;
+        area = 1.0f-yl;
         xb = 0.0;
     }
     else if (yr <= 0.0) yl = yr = area = 1.0;
@@ -87,53 +87,53 @@ static double intersect_any(double xcenter, double ycenter, double xsize, double
     return area;
 }
 
-static double intersect_h(double xcenter, double ycenter, double xsize, double ysize) {
-    return fmax(0.0,fmin(1.0,(.55-fabs(xcenter)+xsize/2.0)/xsize));
+static float intersect_h(float xcenter, float ycenter, float xsize, float ysize) {
+    return (float)fmax(0.0f,fmin(1.0f,(0.55f-fabs(xcenter)+xsize/2.0f)/xsize));
 }
 
-static double intersect_any_h(double xcenter, double ycenter, double xsize, double ysize, double yoffset, double gradient) {
-    double hinside = intersect_h(xcenter,ycenter,xsize,ysize);
+static float intersect_any_h(float xcenter, float ycenter, float xsize, float ysize, float yoffset, float gradient) {
+    float hinside = intersect_h(xcenter,ycenter,xsize,ysize);
     return hinside*hinside*intersect_any(xcenter,ycenter,xsize,ysize,yoffset,gradient);
 }
 
-static double intersect_v(double xcenter, double ycenter, double xsize, double ysize) {
-    return fmax(0.0,fmin(1.0,(.55-fabs(ycenter)+ysize/2.0)/ysize));
+static float intersect_v(float xcenter, float ycenter, float xsize, float ysize) {
+    return (float)fmax(0.0f,fmin(1.0f,(0.55f-fabs(ycenter)+ysize/2.0f)/ysize));
 }
 
-static double intersect_any_v(double xcenter, double ycenter, double xsize, double ysize, double yoffset, double gradient) {
-    double vinside = intersect_v(xcenter,ycenter,xsize,ysize);
+static float intersect_any_v(float xcenter, float ycenter, float xsize, float ysize, float yoffset, float gradient) {
+    float vinside = intersect_v(xcenter,ycenter,xsize,ysize);
     return vinside*vinside*intersect_any(xcenter,ycenter,xsize,ysize,yoffset,gradient);
 }
 
-static double intersect_hv(double xcenter, double ycenter, double xsize, double ysize) {
-    double hinside = intersect_h(xcenter,ycenter,xsize,ysize);
-    double vinside = intersect_v(xcenter,ycenter,xsize,ysize);
+static float intersect_hv(float xcenter, float ycenter, float xsize, float ysize) {
+    float hinside = intersect_h(xcenter,ycenter,xsize,ysize);
+    float vinside = intersect_v(xcenter,ycenter,xsize,ysize);
     return (1-hinside)*(1-vinside)+hinside*vinside;
 }
 
 /* FIXME: not sure if this is correct, but it is rare enough and most likely near enough. fixes welcome :) */
-static double intersect_any_hv(double xcenter, double ycenter, double xsize, double ysize, double yoffset, double gradient) {
-    double hvinside = intersect_hv(xcenter,ycenter,xsize,ysize);
+static float intersect_any_hv(float xcenter, float ycenter, float xsize, float ysize, float yoffset, float gradient) {
+    float hvinside = intersect_hv(xcenter,ycenter,xsize,ysize);
     return hvinside*hvinside*intersect_any(xcenter,ycenter,xsize,ysize,yoffset,gradient);
 }
 
-static double intersect_hvd(double xcenter, double ycenter, double xsize, double ysize) {
+static float intersect_hvd(float xcenter, float ycenter, float xsize, float ysize) {
     return intersect_h(xcenter,ycenter,xsize,ysize)*intersect_v(xcenter,ycenter,xsize,ysize);
 }
 
-static void setinterp(double xcenter, double ycenter, double percentage_inside, int i1, int i2, int i3, int o1, int o2, int o3, unsigned char *factors) {
-    double d0, d1, d2, d3, percentage_outside, totaldistance_i, totaldistance_o;
-    xcenter = fabs(xcenter);
-    ycenter = fabs(ycenter);
+static void setinterp(float xcenter, float ycenter, float percentage_inside, int i1, int i2, int i3, int o1, int o2, int o3, unsigned char *factors) {
+    float d0, d1, d2, d3, percentage_outside, totaldistance_i, totaldistance_o;
+    xcenter = (float)fabs(xcenter);
+    ycenter = (float)fabs(ycenter);
     d0 = (1-xcenter)*(1-ycenter);
     d1 = xcenter*(1-ycenter);
     d2 = (1-xcenter)*ycenter;
     d3 = xcenter*ycenter;
     if (i1 && i2) i3 = 0;
     if (o1 && o2) o3 = 0;
-    percentage_outside = 1.0-percentage_inside;
+    percentage_outside = 1.0f-percentage_inside;
     totaldistance_i = d0+i1*d1+i2*d2+i3*d3;
-    totaldistance_o = o1*d1+o2*d2+o3*d3+1e-12; /* +1e-12: prevent division by zero */
+    totaldistance_o = o1*d1+o2*d2+o3*d3+1e-12f; /* +1e-12: prevent division by zero */
 
     factors[1] = (unsigned char)(((d1/totaldistance_i*percentage_inside*i1)+(d1/totaldistance_o*percentage_outside*o1))*255+.5);
     factors[2] = (unsigned char)(((d2/totaldistance_i*percentage_inside*i2)+(d2/totaldistance_o*percentage_outside*o2))*255+.5);
@@ -152,18 +152,18 @@ static int swap_bits(int num, int bit1, int bit2) {
 // outwidth, outheight == width, height
 void BuildHq2xLookupTexture(int outWidth, int outHeight, int rwidth, int rheight, unsigned char* texture)
 {
-    double xsize, ysize;
+    float xsize, ysize;
     int border, y, x;
     unsigned char table[4096] = HQ2X_D3D_TABLE_DATA;
 
-    xsize = (double)rwidth / (double)outWidth;
-    ysize = (double)rheight / (double)outHeight;
+    xsize = (float)rwidth / (float)outWidth;
+    ysize = (float)rheight / (float)outHeight;
 
     for (border = 0; border < 4096; border++) {
        for (y = 0; y < HQ2X_RESOLUTION; y++) {
             for (x = 0; x < HQ2X_RESOLUTION; x++) {
-                double xcenter = fabs((((double)x)+0.5) / (double)(HQ2X_RESOLUTION)-0.5)/0.958;
-                double ycenter = fabs((((double)y)+0.5) / (double)(HQ2X_RESOLUTION)-0.5)/0.958;
+                float xcenter = (float)(fabs((((float)x)+0.5f) / (float)(HQ2X_RESOLUTION)-0.5f)/0.958f);
+                float ycenter = (float)(fabs((((float)y)+0.5f) / (float)(HQ2X_RESOLUTION)-0.5f)/0.958f);
                 int sx = (x < HQ2X_RESOLUTION/2?-1:1);
                 int sy = (y < HQ2X_RESOLUTION/2?-1:1);
                 int b = (sy > 0?(sx > 0?border:hmirror(border)):(sx > 0?vmirror(border):vmirror(hmirror(border))));
@@ -182,8 +182,8 @@ void BuildHq2xLookupTexture(int outWidth, int outHeight, int rwidth, int rheight
                         SETINTERP(1.0);
                     }
                 } else {
-                    double yoff = (table[b]&4?1:-1)*(((table[b] >> 3) & 3) + 1)/4.0;
-                    double grad = (table[b]&32?1:-1)*(((table[b] >> 6) & 3) + 1)/2.0;
+                    float yoff = (float)((table[b]&4?1:-1)*(((table[b] >> 3) & 3) + 1.0f)/4.0f);
+                    float grad = (float)((table[b]&32?1:-1)*(((table[b] >> 6) & 3) + 1.0f)/2.0f);
                     if (table[b] & H) {
                         if (table[b] & V) {
                             SETINTERP(intersect_any_hv(xcenter,ycenter,xsize,ysize,yoff,grad));
index 7c2ed2e9d45755a4f1dffb8895aa912885db50e6..545b06ffbc7465b8a9a99db63cbbb78b8c2885b6 100644 (file)
@@ -197,7 +197,7 @@ bool preinit_shm (void)
        if (size64 < 8 * 1024 * 1024)
                size64 = 8 * 1024 * 1024;
        if ((uae_u64)max_allowed_mman * 1024 * 1024 > size64)
-               max_allowed_mman = size64 / (1024 * 1024);
+               max_allowed_mman = (uae_u32)(size64 / (1024 * 1024));
 
        uae_u32 natmem_size = (max_allowed_mman + 1) * 1024 * 1024;
        if (natmem_size < 17 * 1024 * 1024)
index 8a128fca4dc8ac9547ed5833b247490b84037cb6..251f97d25bb483bb041ef1de1a4f6a9792e26cd1 100644 (file)
@@ -69,7 +69,7 @@ static int get_header(struct zfile *zf, struct mpegaudio_header *head, bool keep
                        return 0;
                }
                if (head->firstframe < 0)
-                       head->firstframe = zfile_ftell(zf);
+                       head->firstframe = zfile_ftell32(zf);
 
                head->ver = (header[1] >> 3) & 3;
                if (head->ver == 1) {
@@ -407,7 +407,7 @@ uae_u32 mp3decoder::getsize (struct zfile *zf)
                }
                if (sameframes == 0 && frames > 100) {
                        // assume this is CBR MP3
-                       size = mh.samplerate * 2 * (mh.isstereo ? 2 : 1) * ((zfile_size(zf) - firstframe) / ((mh.samplerate / 8 * mh.bitrate) / mh.freq));
+                       size = mh.samplerate * 2 * (mh.isstereo ? 2 : 1) * ((zfile_size32(zf) - firstframe) / ((mh.samplerate / 8 * mh.bitrate) / mh.freq));
                        break;
                }
        }
index 1af32a0eb337273f9143037c61ec8abb741d7911..765d41c608db746a9f64974d63d8ac863296d312 100644 (file)
@@ -688,7 +688,7 @@ static void fixup_size (struct uae_prefs *prefs)
                int hres = prefs->gfx_resolution;
                if (prefs->gf[0].gfx_filter) {
                        if (prefs->gf[0].gfx_filter_horiz_zoom_mult)
-                               hres += prefs->gf[0].gfx_filter_horiz_zoom_mult - 1;
+                               hres += (int)prefs->gf[0].gfx_filter_horiz_zoom_mult - 1;
                        hres += uaefilters[prefs->gf[0].gfx_filter].intmul - 1;
                }
                if (hres > max_horiz_dbl)
@@ -700,7 +700,7 @@ static void fixup_size (struct uae_prefs *prefs)
                int vres = prefs->gfx_vresolution;
                if (prefs->gf[0].gfx_filter) {
                        if (prefs->gf[0].gfx_filter_vert_zoom_mult)
-                               vres += prefs->gf[0].gfx_filter_vert_zoom_mult - 1;
+                               vres += (int)prefs->gf[0].gfx_filter_vert_zoom_mult - 1;
                        vres += uaefilters[prefs->gf[0].gfx_filter].intmul - 1;
                }
                if (vres > max_vert_dbl)
@@ -748,7 +748,7 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p, bool g
        int full = 0;
        int hres, vres;
        int totalhdbl = -1, totalvdbl = -1;
-       int hmult, vmult;
+       float hmult, vmult;
        bool half;
        bool rtg;
 
@@ -963,13 +963,13 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
 
                        hres = hdbl;
                        if (hres > max_horiz_dbl) {
-                               hmult = 1 << (hres - max_horiz_dbl);
+                               hmult = (float)(1 << (hres - max_horiz_dbl));
                                hres = max_horiz_dbl;
                        }
 
                        vres = vdbl;
                        if (vres > max_vert_dbl) {
-                               vmult = 1 << (vres - max_vert_dbl);
+                               vmult = (float)(1 << (vres - max_vert_dbl));
                                vres = max_vert_dbl;
                        }
                }
@@ -1032,7 +1032,7 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                        m = 4;
                }
        }
-       p->rtg_horiz_zoom_mult = p->rtg_vert_zoom_mult = m;
+       p->rtg_horiz_zoom_mult = p->rtg_vert_zoom_mult = (float)m;
 
        if (WIN32GFX_IsPicassoScreen(mon)) {
 
@@ -1053,8 +1053,8 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                gm->gfx_size_win.width = vidinfo->width * m;
                gm->gfx_size_win.height = vidinfo->height * m;
 
-               hmult = m;
-               vmult = m;
+               hmult = (float)m;
+               vmult = (float)m;
 
        } else {
 
index e92f1f3b2009ece133317ea89616cacd0f888a82..0e09b049d3d9653b72f168d1adda64334be79137 100644 (file)
@@ -92,8 +92,8 @@ static _inline uae_u32 INTERPOLATE(uae_u32 A, uae_u32 B) {
 }
 
 static _inline uae_u32 Q_INTERPOLATE(uae_u32 A, uae_u32 B, uae_u32 C, uae_u32 D) {
-       register uae_u32 x = ((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2);
-       register uae_u32 y = ((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2;
+       uae_u32 x = ((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2);
+       uae_u32 y = ((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2;
 
        y &= qlowpixelMask;
        return x + y;
@@ -148,7 +148,7 @@ void Super2xSaI_16(const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u
                        } else if (color5 == color3 && color2 != color6) {
                                product2b = product1b = color5;
                        } else if (color5 == color3 && color2 == color6) {
-                               register int r = 0;
+                               int r = 0;
 
                                r += GetResult(color6, color5, color1, colorA1);
                                r += GetResult(color6, color5, color4, colorB1);
@@ -255,7 +255,7 @@ void Super2xSaI_32(const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u
                        } else if (color5 == color3 && color2 != color6) {
                                product2b = product1b = color5;
                        } else if (color5 == color3 && color2 == color6) {
-                               register int r = 0;
+                               int r = 0;
 
                                r += GetResult(color6, color5, color1, colorA1);
                                r += GetResult(color6, color5, color4, colorB1);
@@ -396,7 +396,7 @@ void SuperEagle_16(const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u
                                }
                                else    //if (color2 != color6)
                                {
-                                       register int r = 0;
+                                       int r = 0;
 
                                        r += GetResult(color6, color5, color1, colorA1);
                                        r += GetResult(color6, color5, color4, colorB1);
@@ -514,7 +514,7 @@ void SuperEagle_32(const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u
                                }
                                else    //if (color2 != color6)
                                {
-                                       register int r = 0;
+                                       int r = 0;
 
                                        r += GetResult(color6, color5, color1, colorA1);
                                        r += GetResult(color6, color5, color4, colorB1);
@@ -559,7 +559,7 @@ void _2xSaI_16(const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u32 d
 
                for (i = 0; i < width; ++i) {
 
-                       register uae_u32 colorA, colorB;
+                       uae_u32 colorA, colorB;
                        uae_u32 colorC, colorD,
                                colorE, colorF, colorG, colorH, colorI, colorJ, colorK, colorL, colorM, colorN, colorO, colorP;
                        uae_u32 product, product1, product2;
@@ -625,7 +625,7 @@ void _2xSaI_16(const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u32 d
                                        product1 = colorA;
                                        product2 = colorA;
                                } else {
-                                       register int r = 0;
+                                       int r = 0;
 
                                        product1 = INTERPOLATE(colorA, colorC);
                                        product = INTERPOLATE(colorA, colorB);
@@ -693,7 +693,7 @@ void _2xSaI_32(const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u32 d
 
                for (i = 0; i < width; ++i) {
 
-                       register uae_u32 colorA, colorB;
+                       uae_u32 colorA, colorB;
                        uae_u32 colorC, colorD,
                                colorE, colorF, colorG, colorH, colorI, colorJ, colorK, colorL, colorM, colorN, colorO, colorP;
                        uae_u32 product, product1, product2;
@@ -759,7 +759,7 @@ void _2xSaI_32(const uae_u8 *srcPtr, uae_u32 srcPitch, uae_u8 *dstPtr, uae_u32 d
                                        product1 = colorA;
                                        product2 = colorA;
                                } else {
-                                       register int r = 0;
+                                       int r = 0;
 
                                        product1 = INTERPOLATE(colorA, colorC);
                                        product = INTERPOLATE(colorA, colorB);
index 84c77ac11f7209c7526cdd3acf0af45b2d1a1952..de98320c3f230fa77385aa8d028ce595dfb9498e 100644 (file)
@@ -176,7 +176,7 @@ static int serial_period_hsyncs, serial_period_hsync_counter;
 static int ninebit;
 static int lastbitcycle_active_hsyncs;
 static bool gotlogwrite;
-static unsigned int lastbitcycle;
+static evt_t lastbitcycle;
 static int serial_recv_previous, serial_send_previous;
 static int serdatr_last_got;
 int serdev;
@@ -594,7 +594,7 @@ static void serdatcopy(void)
                per = ((serper & 0x7fff) + 1) * (bits - 1);
                if (lastbitcycle_active_hsyncs) {
                        // if last bit still transmitting, add remaining time.
-                       int extraper = lastbitcycle - get_cycles();
+                       int extraper = (int)(lastbitcycle - get_cycles());
                        if (extraper > 0)
                                per += extraper / CYCLE_UNIT;
                }
@@ -1034,6 +1034,7 @@ static void enet_service (int serveronly)
                                switch (evt.type)
                                {
                                        default:
+                                       case 0:
                                        write_log (_T("ENET_CLIENT: %d\n"), evt.type);
                                        break;
                                }
index a8b457a36f61e52308a4f2d5d733003d5b736df3..66d2bf766b34b002173c5747492a402e3f55ba69 100644 (file)
@@ -132,8 +132,8 @@ struct sound_dp
        int xextrasamples;
 #endif
 
-       double avg_correct;
-       double cnt_correct;
+       float avg_correct;
+       float cnt_correct;
 };
 
 #define SND_STATUSCNT 10
@@ -183,16 +183,16 @@ float sound_sync_multiplier = 1.0;
 float scaled_sample_evtime_orig;
 extern float sampler_evtime;
 
-void update_sound (double clk)
+void update_sound (float clk)
 {
        if (!have_sound)
                return;
-       scaled_sample_evtime_orig = clk * CYCLE_UNIT * sound_sync_multiplier / sdp->obtainedfreq;
+       scaled_sample_evtime_orig = clk * (float)CYCLE_UNIT * sound_sync_multiplier / sdp->obtainedfreq;
        scaled_sample_evtime = scaled_sample_evtime_orig;
        sampler_evtime = clk * CYCLE_UNIT * sound_sync_multiplier;
 }
 
-extern int vsynctimebase_orig;
+extern frame_time_t vsynctimebase_orig;
 
 #ifndef AVIOUTPUT
 static int avioutput_audio;
@@ -201,7 +201,7 @@ static int avioutput_audio;
 #define ADJUST_LIMIT 6
 #define ADJUST_LIMIT2 1
 
-void sound_setadjust (double v)
+void sound_setadjust (float v)
 {
        float mult;
 
@@ -210,23 +210,23 @@ void sound_setadjust (double v)
        if (v > ADJUST_LIMIT)
                v = ADJUST_LIMIT;
 
-       mult = (1000.0 + v);
+       mult = (1000.0f + v);
        if (avioutput_audio && avioutput_enabled && avioutput_nosoundsync)
-               mult = 1000.0;
+               mult = 1000.0f;
        if (isvsync_chipset () || (avioutput_audio && avioutput_enabled && !currprefs.cachesize)) {
                vsynctimebase = vsynctimebase_orig;
-               scaled_sample_evtime = scaled_sample_evtime_orig * mult / 1000.0;
+               scaled_sample_evtime = scaled_sample_evtime_orig * mult / 1000.0f;
        } else if (currprefs.cachesize || currprefs.m68k_speed != 0) {
-               vsynctimebase = (int)(((double)vsynctimebase_orig) * mult / 1000.0);
+               vsynctimebase = (int)(vsynctimebase_orig * mult / 1000.0f);
                scaled_sample_evtime = scaled_sample_evtime_orig;
        } else {
-               vsynctimebase = (int)(((double)vsynctimebase_orig) * mult / 1000.0);
+               vsynctimebase = (int)(vsynctimebase_orig * mult / 1000.0f);
                scaled_sample_evtime = scaled_sample_evtime_orig;
        }
 }
 
 
-static void docorrection (struct sound_dp *s, int sndbuf, double sync, int granulaty)
+static void docorrection (struct sound_dp *s, int sndbuf, float sync, int granulaty)
 {
        static int tfprev;
 
@@ -237,11 +237,11 @@ static void docorrection (struct sound_dp *s, int sndbuf, double sync, int granu
                granulaty = 10;
 
        if (tfprev != timeframes) {
-               double skipmode, avgskipmode;
-               double avg = s->avg_correct / s->cnt_correct;
+               float skipmode, avgskipmode;
+               float avg = s->avg_correct / s->cnt_correct;
 
-               skipmode = sync / 100.0;
-               avgskipmode = avg / (10000.0 / granulaty);
+               skipmode = sync / 100.0f;
+               avgskipmode = avg / (10000.0f / granulaty);
 
                if ((0 || sound_debug) && (tfprev % 10) == 0) {
                        write_log (_T("%+05d S=%7.1f AVG=%7.1f (IMM=%7.1f + AVG=%7.1f = %7.1f)\n"), sndbuf, sync, avg, skipmode, avgskipmode, skipmode + avgskipmode);
@@ -259,12 +259,12 @@ static void docorrection (struct sound_dp *s, int sndbuf, double sync, int granu
 }
 
 
-static double sync_sound (double m)
+static float sync_sound (float m)
 {
-       double skipmode;
+       float skipmode;
        if (isvsync ()) {
 
-               skipmode = pow (m < 0 ? -m : m, EXPVS) / 2;
+               skipmode = (float)pow(m < 0 ? -m : m, EXPVS) / 2.0f;
                if (m < 0)
                        skipmode = -skipmode;
                if (skipmode < -ADJUST_VSSIZE)
@@ -274,7 +274,7 @@ static double sync_sound (double m)
 
        } else if (1) {
 
-               skipmode = pow (m < 0 ? -m : m, EXP) / 2;
+               skipmode = (float)pow(m < 0 ? -m : m, EXP) / 2.0f;
                if (m < 0)
                        skipmode = -skipmode;
                if (skipmode < -ADJUST_SIZE)
@@ -496,18 +496,6 @@ static int restore_ds (struct sound_data *sd, DWORD hr)
        return 1;
 }
 
-static LARGE_INTEGER qpfc, qpf;
-static void storeqpf (void)
-{
-       QueryPerformanceCounter (&qpfc);
-}
-static double getqpf (void)
-{
-       LARGE_INTEGER qpfc2;
-       QueryPerformanceCounter (&qpfc2);
-       return (qpfc2.QuadPart - qpfc.QuadPart) / (qpf.QuadPart / 1000.0);
-}
-
 static void close_audio_ds (struct sound_data *sd)
 {
        struct sound_dp *s = sd->data;
@@ -533,9 +521,9 @@ void set_volume_sound_device (struct sound_data *sd, int volume, int mute)
        struct sound_dp *s = sd->data;
        HRESULT hr;
        if (sd->devicetype == SOUND_DEVICE_AL) {
-               float vol = 0.0;
-               if (volume < 100 && !mute)
-                       vol = (100 - volume) / 100.0;
+               float vol = 0.0f;
+               if (volume < 100.0f && !mute)
+                       vol = (100.0f - volume) / 100.0f;
                alSourcef (s->al_Source, AL_GAIN, vol);
        } else if (sd->devicetype == SOUND_DEVICE_DS) {
                LONG vol = DSBVOLUME_MIN;
@@ -571,7 +559,7 @@ void set_volume_sound_device (struct sound_data *sd, int volume, int mute)
                if (FAILED (hr))
                        write_log (_T("AudioVolume->SetMasterVolume(1.0) failed: %08Xs\n"), hr);
                if (volume < 100 && !mute) {
-                       sd->softvolume = (100 - volume) * 32768 / 100.0;
+                       sd->softvolume = (int)((100.0f - volume) * 32768.0f / 100.0f);
                        if (sd->softvolume >= 32768)
                                sd->softvolume = -1;
                }
@@ -821,7 +809,7 @@ fixfreq:
                                continue;
                        }
                        if (freq != di->defaultSampleRate && err == paInvalidSampleRate && !defaultrate) {
-                               freq = di->defaultSampleRate;
+                               freq = (int)di->defaultSampleRate;
                                sd->freq = freq;
                                defaultrate = 1;
                                continue;
@@ -2201,7 +2189,7 @@ static void finish_sound_buffer_al (struct sound_data *sd, uae_u16 *sndbuffer)
                alcheck (sd, 7);
                v -= s->al_offset;
 
-               docorrection (s, 100 * v / sd->sndbufsize, v / sd->samplesize, 100);
+               docorrection (s, (int)(100.0f * v / sd->sndbufsize), v / (float)sd->samplesize, 100);
 
 #if 0
                gui_data.sndbuf = 100 * v / sd->sndbufsize;
@@ -2331,7 +2319,7 @@ static void finish_sound_buffer_wasapi_push(struct sound_data *sd, uae_u16 *sndb
                oldpadding = numFramesPadding;
        }
 
-       docorrection (s, (s->wasapigoodsize - avail) * 1000 / s->wasapigoodsize, s->wasapigoodsize - avail, 100);
+       docorrection (s, (s->wasapigoodsize - avail) * 1000 / s->wasapigoodsize, (float)(s->wasapigoodsize - avail), 100);
 
        hr = s->pRenderClient->GetBuffer (sd->sndbufframes, &pData);
        wasapi_check_state(sd, hr);
@@ -2560,17 +2548,17 @@ static void finish_sound_buffer_ds (struct sound_data *sd, uae_u16 *sndbuffer)
        s->lpDSBsecondary->Unlock (b1, s1, b2, s2);
 
        if (sd == sdp) {
-               double vdiff, m, skipmode;
+               float vdiff, m, skipmode;
 
-               vdiff = (diff - s->snd_writeoffset) / sd->samplesize;
-               m = 100.0 * vdiff / (s->max_sndbufsize / sd->samplesize);
+               vdiff = (diff - s->snd_writeoffset) / (float)sd->samplesize;
+               m = 100.0f * vdiff / (s->max_sndbufsize / sd->samplesize);
                skipmode = sync_sound (m);
 
                if (tfprev != timeframes) {
-                       gui_data.sndbuf = vdiff * 1000 / (s->snd_maxoffset - s->snd_writeoffset);
+                       gui_data.sndbuf = (int)(vdiff * 1000.0f / (s->snd_maxoffset - s->snd_writeoffset));
                        s->avg_correct += vdiff;
                        s->cnt_correct++;
-                       double adj = (s->avg_correct / s->cnt_correct) / 50.0;
+                       float adj = (s->avg_correct / s->cnt_correct) / 50.0f;
                        if ((0 || sound_debug) && !(tfprev % 10))
                                write_log (_T("%d,%d,%d,%d d%5d vd%5.0f s%+02.1f %.0f %+02.1f\n"),
                                sd->sndbufsize / sd->samplesize, s->snd_configsize / sd->samplesize, s->max_sndbufsize / sd->samplesize,
@@ -2580,7 +2568,7 @@ static void finish_sound_buffer_ds (struct sound_data *sd, uae_u16 *sndbuffer)
                                skipmode = ADJUST_LIMIT2;
                        if (skipmode < -ADJUST_LIMIT2)
                                skipmode = -ADJUST_LIMIT2;
-                       sound_setadjust (skipmode + adj);
+                       sound_setadjust(skipmode + adj);
                }
        }
 
@@ -2676,7 +2664,7 @@ bool audio_is_event_frame_possible(int ms)
                int bufsize = (uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer;
                bufsize /= sdp->samplesize;
                int todo = s->bufferFrameCount - bufsize;
-               int samplesperframe = sdp->obtainedfreq / vblank_hz;
+               int samplesperframe = (int)(sdp->obtainedfreq / vblank_hz);
                return samplesperframe >= todo - samplesperframe;
        }
        return false;
@@ -3239,7 +3227,7 @@ static int setget_master_volume_vista (int setvolume, int *volume, int *mute)
                                float vol;
                                if (SUCCEEDED (endpointVolume->GetMasterVolumeLevelScalar (&vol))) {
                                        ok++;
-                                       *volume = vol * 65535.0;
+                                       *volume = (int)(vol * 65535.0f);
                                }
                                if (SUCCEEDED (endpointVolume->GetMute (mute))) {
                                        ok++;
index a72f7d6ced9f17cc12d2336fef8c8c7a30a43d22..8ea3c36f45400472fd36f3fd7c4627648cceeac9 100644 (file)
@@ -21,10 +21,8 @@ extern void resume_sound (void);
 extern void pause_sound (void);
 extern void reset_sound (void);
 extern bool sound_paused (void);
-extern void sound_setadjust (double);
+extern void sound_setadjust (float);
 extern int enumerate_sound_devices (void);
-extern int drivesound_init (void);
-extern void drivesound_free (void);
 extern void sound_mute (int);
 extern void sound_volume (int);
 extern void set_volume (int, int);
index f2f8bdcda278a1cdff14d6ca777aafc3f68e4452..16bab06d7d9d9dbea218446bdd79b0fe3d9dc358 100644 (file)
@@ -360,7 +360,7 @@ void setvolumevideograb(int volume)
 {
        if (!audio)
                return;
-       long vol = log10((float)volume / 100.0) * 4000.0;
+       long vol = (long)(log10((float)volume / 100.0) * 4000.0);
        audio->put_Volume(vol);
 }
 
index 4a5a2d2fb90bba320e272fb34651f0189a21f58e..f8ce4d65f9a0f5fac0dac1245aea49d461ca8512 100644 (file)
@@ -386,7 +386,7 @@ int target_get_display_scanline(int displayindex)
 {
        if (!scanlinecalibrating && calculated_scanline) {
                static int lastline;
-               float diff = read_processor_time() - wait_vblank_timestamp;
+               float diff = (float)(read_processor_time() - wait_vblank_timestamp);
                if (diff < 0)
                        return -1;
                int sl = (int)(diff * (vsync_activeheight + (vsync_totalheight - vsync_activeheight) / 10) * vsync_vblank / syncbase);
@@ -546,11 +546,11 @@ static void display_param_init(struct AmigaMonitor *mon)
        vsync_hblank = 0;
        get_display_vblank_params(-1, &vsync_activeheight, &vsync_totalheight, &vsync_vblank, &vsync_hblank);
        if (vsync_vblank <= 0)
-               vsync_vblank = mon->currentmode.freq;
+               vsync_vblank = (float)mon->currentmode.freq;
        // GPU scaled mode?
        if (vsync_activeheight > mon->currentmode.current_height) {
                float m = (float)vsync_activeheight / mon->currentmode.current_height;
-               vsync_hblank = (int)(vsync_hblank / m + 0.5);
+               vsync_hblank = vsync_hblank / m + 0.5f;
                vsync_activeheight = mon->currentmode.current_height;
        }
 
@@ -630,8 +630,8 @@ void getgfxoffset(int monid, float *dxp, float *dyp, float *mxp, float *myp)
 
        *dxp = dx;
        *dyp = dy;
-       *mxp = 1.0 / mx;
-       *myp = 1.0 / my;
+       *mxp = 1.0f / mx;
+       *myp = 1.0f / my;
 }
 
 void DX_Fill(struct AmigaMonitor *mon, int dstx, int dsty, int width, int height, uae_u32 color)
@@ -3360,7 +3360,7 @@ static void createstatuswindow(struct AmigaMonitor *mon)
        wi.cbSize = sizeof wi;
        GetWindowInfo(mon->hMainWnd, &wi);
        extra = wi.rcClient.top - wi.rcWindow.top;
-       scale = getdpiforwindow(mon->hStatusWnd) / 96.0;
+       scale = getdpiforwindow(mon->hStatusWnd) / 96.0f;
        drive_width = (int)(24 * scale);
        hd_width = (int)(24 * scale);
        cd_width = (int)(24 * scale);
index 8b711d1b55b25adce1fba2f8111c99429434cfd9..260d64b66961268e60e78c41c855baac362e9244 100644 (file)
@@ -1559,9 +1559,9 @@ static struct romdata *scan_single_rom_2 (struct zfile *f)
        int cl = 0, size;
        struct romdata *rd = 0;
 
-       zfile_fseek (f, 0, SEEK_END);
-       size = zfile_ftell (f);
-       zfile_fseek (f, 0, SEEK_SET);
+       zfile_fseek(f, 0, SEEK_END);
+       size = zfile_ftell32(f);
+       zfile_fseek(f, 0, SEEK_SET);
        if (size > 524288 * 2)  {/* don't skip KICK disks or 1M ROMs */
                write_log (_T("'%s': too big %d, ignored\n"), zfile_getname(f), size);
                return 0;
@@ -3194,7 +3194,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs
                                if (rb->start_address) {
                                        struct zfile *zf = zfile_fopen(rb->lf.loadfile, _T("rb"));
                                        if (zf) {
-                                               rb->end_address = rb->start_address + zfile_size(zf);
+                                               rb->end_address = rb->start_address + zfile_size32(zf);
                                                rb->end_address = ((rb->end_address + 65535) & ~65535) - 1;
                                                rb->size = rb->end_address - rb->start_address + 1;
                                                zfile_fclose(zf);
@@ -8656,26 +8656,26 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
                if (msg == WM_HSCROLL) {
                        i = SendDlgItemMessage (hDlg, IDC_FRAMERATE2, TBM_GETPOS, 0, 0);
                        if (i != (int)cr->rate)
-                               cr->rate = (double)i;
+                               cr->rate = (float)i;
                        updaterate = true;
                } else if (LOWORD (wParam) == IDC_RATE2TEXT && HIWORD (wParam) == EN_KILLFOCUS) {
                        if (GetDlgItemText(hDlg, IDC_RATE2TEXT, tmp, sizeof tmp / sizeof (TCHAR))) {
-                               cr->rate = _tstof (tmp);
+                               cr->rate = (float)_tstof(tmp);
                                updaterate = true;
                                updateslider = true;
                        }
                }
        } else if (i == CHIPSET_REFRESH_PAL) {
-               cr->rate = 50.0;
+               cr->rate = 50.0f;
        } else if (i == CHIPSET_REFRESH_NTSC) {
-               cr->rate = 60.0;
+               cr->rate = 60.0f;
        }
        if (cr->rate > 0 && cr->rate < 1) {
-               cr->rate = currprefs.ntscmode ? 60.0 : 50.0;
+               cr->rate = currprefs.ntscmode ? 60.0f : 50.0f;
                updaterate = true;
        }
        if (cr->rate > 300) {
-               cr->rate = currprefs.ntscmode ? 60.0 : 50.0;
+               cr->rate = currprefs.ntscmode ? 60.0f : 50.0f;
                updaterate = true;
        }
        if (updaterate) {
@@ -11870,9 +11870,9 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA
                                        case IDC_AUTOCONFIG_PRODUCT:
                                        if (fastram_select_ramboard) {
                                                GetDlgItemText(hDlg, IDC_AUTOCONFIG_MANUFACTURER, tmp, sizeof tmp / sizeof(TCHAR));
-                                               fastram_select_ramboard->manufacturer = _tstol(tmp);
+                                               fastram_select_ramboard->manufacturer = (uae_u16)_tstol(tmp);
                                                GetDlgItemText(hDlg, IDC_AUTOCONFIG_PRODUCT, tmp, sizeof tmp / sizeof(TCHAR));
-                                               fastram_select_ramboard->product = _tstol(tmp);
+                                               fastram_select_ramboard->product = (uae_u8)_tstol(tmp);
                                                setfastram_selectmenu(hDlg, 1);
                                        }
                                        break;
@@ -12989,12 +12989,12 @@ static void enable_for_cpudlg (HWND hDlg)
        SendDlgItemMessage(hDlg, IDC_SPEED_x86, TBM_SETPAGESIZE, 0, 10);
 }
 
-static double getcpufreq (int m)
+static float getcpufreq (int m)
 {
-       double f;
+       float f;
 
-       f = workprefs.ntscmode ? 28636360.0 : 28375160.0;
-       return f * (m >> 8) / 8.0;
+       f = workprefs.ntscmode ? 28636360.0f : 28375160.0f;
+       return f * (m >> 8) / 8.0f;
 }
 
 static void values_to_cpudlg(HWND hDlg, WPARAM wParam)
@@ -13070,10 +13070,10 @@ static void values_from_cpudlg(HWND hDlg, WPARAM wParam)
        workprefs.int_no_unimplemented = ischecked (hDlg, IDC_CPU_UNIMPLEMENTED) ? 0 : 1;
        workprefs.address_space_24 = ischecked (hDlg, IDC_COMPATIBLE24) ? 1 : 0;
        workprefs.m68k_speed = ischecked (hDlg, IDC_CS_HOST) ? -1 : 0;
-       workprefs.m68k_speed_throttle = SendMessage (GetDlgItem (hDlg, IDC_SPEED), TBM_GETPOS, 0, 0) * 100;
+       workprefs.m68k_speed_throttle = (float)SendMessage (GetDlgItem (hDlg, IDC_SPEED), TBM_GETPOS, 0, 0) * 100;
        if (workprefs.m68k_speed_throttle > 0 && workprefs.m68k_speed < 0)
                workprefs.m68k_speed_throttle = 0;
-       workprefs.x86_speed_throttle = SendMessage(GetDlgItem(hDlg, IDC_SPEED_x86), TBM_GETPOS, 0, 0) * 100;
+       workprefs.x86_speed_throttle = (float)SendMessage(GetDlgItem(hDlg, IDC_SPEED_x86), TBM_GETPOS, 0, 0) * 100;
        idx = SendDlgItemMessage(hDlg, IDC_FPU_MODE, CB_GETCURSEL, 0, 0);
        if (idx == 0)
                workprefs.fpu_mode = 0;
@@ -14558,13 +14558,13 @@ static void updatehdfinfo(HWND hDlg, bool force, bool defaults, bool realdrive)
        int heads = phys ? current_hfdlg.ci.pheads : current_hfdlg.ci.surfaces;
        int secs = phys ? current_hfdlg.ci.psecs : current_hfdlg.ci.sectors;
        if (!cyls && current_hfdlg.ci.blocksize && secs && heads) {
-               cyls = bsize / ((uae_u64)current_hfdlg.ci.blocksize * secs * heads);
+               cyls = (uae_u32)(bsize / ((uae_u64)current_hfdlg.ci.blocksize * secs * heads));
        }
        blocks = cyls * (secs * heads);
        if (!blocks && current_hfdlg.ci.blocksize)
-               blocks = bsize / current_hfdlg.ci.blocksize;
+               blocks = (uae_u32)(bsize / current_hfdlg.ci.blocksize);
        if (current_hfdlg.ci.max_lba)
-               blocks = current_hfdlg.ci.max_lba;
+               blocks = (uae_u32)current_hfdlg.ci.max_lba;
 
        for (i = 0; i < sizeof (idtmp) / sizeof (TCHAR) - 1; i++) {
                TCHAR c = id[i];
@@ -14825,7 +14825,7 @@ static void set_phys_cyls(HWND hDlg)
 {
        if (ischecked(hDlg, IDC_HDF_PHYSGEOMETRY)) {
                int v = (current_hfdlg.ci.pheads * current_hfdlg.ci.psecs * current_hfdlg.ci.blocksize);
-               current_hfdlg.ci.pcyls = v ? current_hfdlg.size / v : 0;
+               current_hfdlg.ci.pcyls = (int)(v ? current_hfdlg.size / v : 0);
                current_hfdlg.ci.physical_geometry = true;
                SetDlgItemInt (hDlg, IDC_RESERVED, current_hfdlg.ci.pcyls, FALSE);
        }
@@ -20067,20 +20067,20 @@ static void values_to_hw3ddlg (HWND hDlg, bool initdialog)
 
        float ho, vo, hz, vz;
        if (workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_MANUAL) {
-               hz = workprefs.gfx_xcenter_size;
-               vz = workprefs.gfx_ycenter_size;
-               ho = workprefs.gfx_xcenter_pos;
-               vo = workprefs.gfx_ycenter_pos;
+               hz = (float)workprefs.gfx_xcenter_size;
+               vz = (float)workprefs.gfx_ycenter_size;
+               ho = (float)workprefs.gfx_xcenter_pos;
+               vo = (float)workprefs.gfx_ycenter_pos;
        } else if (workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_OVERSCAN_BLANK) {
-               hz = workprefs.gf[filter_nativertg].gfx_filter_left_border;
-               vz = workprefs.gf[filter_nativertg].gfx_filter_right_border;
-               ho = workprefs.gf[filter_nativertg].gfx_filter_top_border;
-               vo = workprefs.gf[filter_nativertg].gfx_filter_bottom_border;
+               hz = (float)workprefs.gf[filter_nativertg].gfx_filter_left_border;
+               vz = (float)workprefs.gf[filter_nativertg].gfx_filter_right_border;
+               ho = (float)workprefs.gf[filter_nativertg].gfx_filter_top_border;
+               vo = (float)workprefs.gf[filter_nativertg].gfx_filter_bottom_border;
        } else {
-               hz = workprefs.gf[filter_nativertg].gfx_filter_horiz_zoom;
-               vz = workprefs.gf[filter_nativertg].gfx_filter_vert_zoom;
-               ho = workprefs.gf[filter_nativertg].gfx_filter_horiz_offset;
-               vo = workprefs.gf[filter_nativertg].gfx_filter_vert_offset;
+               hz = (float)workprefs.gf[filter_nativertg].gfx_filter_horiz_zoom;
+               vz = (float)workprefs.gf[filter_nativertg].gfx_filter_vert_zoom;
+               ho = (float)workprefs.gf[filter_nativertg].gfx_filter_horiz_offset;
+               vo = (float)workprefs.gf[filter_nativertg].gfx_filter_vert_offset;
        }
 
        SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, (int)hz);
@@ -20569,20 +20569,20 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                }
                        } else {
                                if (h == hz) {
-                                       fd->gfx_filter_horiz_zoom = fdwp->gfx_filter_horiz_zoom = (int)SendMessage (hz, TBM_GETPOS, 0, 0);
+                                       fd->gfx_filter_horiz_zoom = fdwp->gfx_filter_horiz_zoom = (float)SendMessage (hz, TBM_GETPOS, 0, 0);
                                        if (fdwp->gfx_filter_keep_aspect) {
                                                fd->gfx_filter_vert_zoom = fdwp->gfx_filter_vert_zoom = currprefs.gf[filter_nativertg].gfx_filter_horiz_zoom;
-                                               SendDlgItemMessage (hDlg, IDC_FILTERVZ, TBM_SETPOS, TRUE, fdwp->gfx_filter_vert_zoom);
+                                               SendDlgItemMessage (hDlg, IDC_FILTERVZ, TBM_SETPOS, TRUE, (int)fdwp->gfx_filter_vert_zoom);
                                        }
                                } else if (h == vz) {
-                                       fd->gfx_filter_vert_zoom = fdwp->gfx_filter_vert_zoom = (int)SendMessage (vz, TBM_GETPOS, 0, 0);
+                                       fd->gfx_filter_vert_zoom = fdwp->gfx_filter_vert_zoom = (float)SendMessage (vz, TBM_GETPOS, 0, 0);
                                        if (fdwp->gfx_filter_keep_aspect) {
                                                fd->gfx_filter_horiz_zoom = fdwp->gfx_filter_horiz_zoom = currprefs.gf[filter_nativertg].gfx_filter_vert_zoom;
-                                               SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, fdwp->gfx_filter_horiz_zoom);
+                                               SendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, (int)fdwp->gfx_filter_horiz_zoom);
                                        }
                                }
-                               fd->gfx_filter_horiz_offset = fdwp->gfx_filter_horiz_offset = (int)SendMessage (GetDlgItem (hDlg, IDC_FILTERHO), TBM_GETPOS, 0, 0);
-                               fd->gfx_filter_vert_offset = fdwp->gfx_filter_vert_offset = (int)SendMessage (GetDlgItem (hDlg, IDC_FILTERVO), TBM_GETPOS, 0, 0);
+                               fd->gfx_filter_horiz_offset = fdwp->gfx_filter_horiz_offset = (float)SendMessage (GetDlgItem (hDlg, IDC_FILTERHO), TBM_GETPOS, 0, 0);
+                               fd->gfx_filter_vert_offset = fdwp->gfx_filter_vert_offset = (float)SendMessage (GetDlgItem (hDlg, IDC_FILTERVO), TBM_GETPOS, 0, 0);
                                SetDlgItemInt (hDlg, IDC_FILTERHOV, (int)workprefs.gf[filter_nativertg].gfx_filter_horiz_offset, TRUE);
                                SetDlgItemInt (hDlg, IDC_FILTERVOV, (int)workprefs.gf[filter_nativertg].gfx_filter_vert_offset, TRUE);
                                SetDlgItemInt (hDlg, IDC_FILTERHZV, (int)workprefs.gf[filter_nativertg].gfx_filter_horiz_zoom, TRUE);
index 17e61fecf7699c20605548cf558ecf8bfb5d59d8..e39f116386c695cb5af89a9e68dc768605e7cb96 100644 (file)
@@ -70,7 +70,7 @@ typedef struct
 struct newreswnd
 {
        HWND hwnd;
-       uae_s16 x, y, w, h;
+       LONG x, y, w, h;
 };
 
 struct newresource
index adb3f098ff6e133deea16a2df435f07b243394b1..2aa71d635fe151d96b6b07fabf458e74aeaa7cb0 100644 (file)
@@ -847,21 +847,13 @@ static void scalechildwindows(struct newresource *nr)
        for (int i = 0; i < nr->hwndcnt; i++) {
                struct newreswnd *nw = &nr->hwnds[i];
 
-               int x = nw->x;
-               x *= multx;
-               x /= 100;
+               int x = (int)(nw->x * multx / 100);
 
-               int y = nw->y;
-               y *= multy;
-               y /= 100;
+               int y = (int)(nw->y * multy / 100);
 
-               int w = nw->w;
-               w *= multx;
-               w /= 100;
+               int w = (int)(nw->w * multx / 100);
 
-               int h = nw->h;
-               h *= multy;
-               h /= 100;
+               int h = (int)(nw->h * multy / 100);
 
                if (nr->fontchanged) {
                        SendMessage(nw->hwnd, WM_SETFONT, (WPARAM)nr->dinfo.hUserFont, 0);
@@ -928,13 +920,13 @@ void rescaleresource(struct newresource *nr, bool full)
        pwi.cbSize = sizeof(WINDOWINFO);
        GetWindowInfo(nr->hwnd, &pwi);
 
-       float neww = scaleresource_width - pwi.cxWindowBorders * 2;
-       float oldw = (530.0 * nr->unitx) / 8.0;
-       multx = neww * 100.0 / oldw;
+       float neww = (float)scaleresource_width - pwi.cxWindowBorders * 2;
+       float oldw = (530.0f * nr->unitx) / 8.0f;
+       multx = neww * 100.0f / oldw;
 
-       float newh = scaleresource_height - height - pwi.cyWindowBorders * 2;
-       float oldh = (345.0 * nr->unity) / 8.0;
-       multy = newh * 100.0 / oldh;
+       float newh = (float)scaleresource_height - height - pwi.cyWindowBorders * 2;
+       float oldh = (345.0f * nr->unity) / 8.0f;
+       multy = newh * 100.0f / oldh;
 
        HMONITOR m = MonitorFromWindow(nr->hwnd, MONITOR_DEFAULTTOPRIMARY);
        int dpi = getdpiformonitor(m);
index f22acb7fbd0567359f94bec21191df64dd524403..d790bbd8a89ca94f02b7172d867b9764cb47cb8a 100644 (file)
@@ -106,7 +106,7 @@ static inline uint32_t timer_get_remaining_us(pc_timer_t *timer)
 
                if (remaining < 0)
                        return 0;
-               return remaining / TIMER_USEC;
+               return (uint32_t)(remaining / TIMER_USEC);
        }
 
        return 0;
diff --git a/pci.cpp b/pci.cpp
index 55e5fc5837ada0b05ef2aefeff05dbdece14e477..f2d8e0eed0d5267c415907dc6cfab46287b6a289 100644 (file)
--- a/pci.cpp
+++ b/pci.cpp
@@ -228,9 +228,9 @@ static void create_config_data(struct pci_board_state *s)
 
        // big endian, get/put functions will swap if needed.
        d[0] = c->device >> 8;
-       d[1] = c->device;
+       d[1] = (uae_u8)c->device;
        d[2] = c->vendor >> 8;
-       d[3] = c->vendor;
+       d[3] = (uae_u8)c->vendor;
 
        d[8] = c->deviceclass >> 16;
        d[9] = c->deviceclass >> 8;
@@ -248,9 +248,9 @@ static void create_config_data(struct pci_board_state *s)
        }
 
        d[0x2c] = c->subsystem >> 8;
-       d[0x2d] = c->subsystem;
+       d[0x2d] = (uae_u8)c->subsystem;
        d[0x2e] = c->subsystenvendor >> 8;
-       d[0x2f] = c->subsystenvendor;
+       d[0x2f] = (uae_u8)c->subsystenvendor;
 
        d[0x3c] = c->max_latency;
        d[0x3d] = c->min_grant;
@@ -1153,7 +1153,7 @@ static void mediator_set_window_offset(struct pci_bridge *pcib, uae_u16 v)
                pcib->memory_start_offset = pcib->window << 16;
                offset = pcib->memory_start_offset;
                pcib->memory_start_offset -= pcib->baseaddress;
-               pcib->memory_start_offset = -pcib->memory_start_offset;
+               pcib->memory_start_offset = 0 - pcib->memory_start_offset;
        }
 #if 0
        write_log(_T"Mediator window: %08x %04x PC=%08x\n"), offset, v, M68K_GETPC);
@@ -1175,7 +1175,7 @@ static uae_u32 REGPARAM2 pci_bridge_bget_2(uaecptr addr)
                if (pcib->bank_2_zorro == 3) {
                        int offset = addr & 0x7fffff;
                        if (offset == 0) {
-                               v = pcib->window;
+                               v = (uae_u8)pcib->window;
                                v |= 8; // id
                        }
                        if (offset == 4) {
index 0530dcca6a182c551654b7fe3dae02978ad0c97a..72c754555c7c08be72e7e3cf5122103be22e39d6 100644 (file)
@@ -721,8 +721,8 @@ out2:
 #endif
 endofline:
                /* now, we have a match */
-               if (table68k[opc].mnemo != i_ILLG)
-                       ;//write_log (_T("Double match: %x: %s\n"), opc, opcstr);
+               //if (table68k[opc].mnemo != i_ILLG)
+               //      write_log (_T("Double match: %x: %s\n"), opc, opcstr);
                if (find == -1) {
                        for (find = 0;; find++) {
                                if (_tcscmp (mnemonic, lookuptab[find].name) == 0) {
index f4671cf00996e115fd649ab979d85b6a54e859ab..44dd69ba7f3610767e348b1b573efeff860eb428 100644 (file)
@@ -1161,7 +1161,7 @@ void addkeyfile (const TCHAR *path)
        if (!f)
                return;
        zfile_fseek (f, 0, SEEK_END);
-       keysize = zfile_ftell (f);
+       keysize = zfile_ftell32(f);
        if (keysize > 0) {
                zfile_fseek (f, 0, SEEK_SET);
                keybuf = xmalloc (uae_u8, keysize);
@@ -1529,9 +1529,9 @@ struct romdata *getromdatabyzfile (struct zfile *f)
        uae_u8 *p;
        struct romdata *rd;
 
-       pos = zfile_ftell (f);
+       pos = zfile_ftell32(f);
        zfile_fseek (f, 0, SEEK_END);
-       size = zfile_ftell (f);
+       size = zfile_ftell32(f);
        if (size > 2048 * 1024)
                return NULL;
        p = xmalloc (uae_u8, size);
@@ -1973,7 +1973,7 @@ static struct zfile *rom_fopen2(const TCHAR *name, const TCHAR *mode, int mask)
        struct zfile *f2 = NULL;
        struct zfile *f = rom_fopen(name, mode, mask);
        if (f) {
-               int size = zfile_size(f);
+               int size = zfile_size32(f);
                if (size == 524288 * 2 || size == 524288 || size == 262144) {
                        uae_u8 *newrom = NULL;
                        uae_u8 *tmp1 = xcalloc(uae_u8, 524288 * 2);
@@ -2057,7 +2057,7 @@ struct zfile *read_rom_name (const TCHAR *filename)
                        uae_u8 *buf;
                        addkeydir(filename);
                        zfile_fseek(f, 0, SEEK_END);
-                       size = zfile_ftell(f) - sizeof tmp;
+                       size = zfile_ftell32(f) - sizeof tmp;
                        zfile_fseek(f, sizeof tmp, SEEK_SET);
                        buf = xmalloc(uae_u8, size);
                        zfile_fread(buf, size, 1, f);
index fe511ebe90da000ab9217316f2f11aea12ae9075..0de6bfb92fa8c6e4988b63688d1c6c07cc89fd5f 100644 (file)
@@ -103,7 +103,7 @@ static void capture_free (void)
        samplebuffer = NULL;
 }
 
-static evt oldcycles;
+static evt_t oldcycles;
 static int oldoffset;
 
 uae_u8 sampler_getsample (int channel)
@@ -113,14 +113,14 @@ uae_u8 sampler_getsample (int channel)
        static int cap_pos;
        static float diffsample;
 #endif
-       static double doffset_offset;
+       static float doffset_offset;
        HRESULT hr;
        DWORD t;
        void *p1, *p2;
        DWORD len1, len2;
-       evt cycles;
+       evt_t cycles;
        int sample, samplecnt;
-       double doffset;
+       float doffset;
        int offset;
 
        if (!currprefs.sampler_stereo)
index 0c46b2cb7c0c7b859bfba31ef59cf9098281d104..69ef94f015fa71a5bf1b1670606846352113ea3d 100644 (file)
@@ -387,7 +387,7 @@ static void save_chunk (struct zfile *f, uae_u8 *chunk, unsigned int len, const
        s = ua (name);
        zfile_fwrite (s, 1, 4, f);
        xfree (s);
-       pos = zfile_ftell (f);
+       pos = zfile_ftell32(f);
        /* chunk size */
        dst = &tmp[0];
        chunklen = len + 4 + 4 + 4;
@@ -404,7 +404,7 @@ static void save_chunk (struct zfile *f, uae_u8 *chunk, unsigned int len, const
                size_t opos;
                dst = &tmp[0];
                save_u32 (len);
-               opos = zfile_ftell (f);
+               opos = zfile_ftell32(f);
                zfile_fwrite (&tmp[0], 1, 4, f);
                len = zfile_zcompress (f, chunk, len);
                if (len > 0) {
@@ -457,7 +457,7 @@ static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, unsigned int *len, u
                len2 = 0;
        *len = len2;
        if (len2 == 0) {
-               *filepos = zfile_ftell (f);
+               *filepos = zfile_ftell32(f);
                return 0;
        }
 
@@ -472,11 +472,11 @@ static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, unsigned int *len, u
        if (flags & 1) {
                zfile_fread (tmp, 1, 4, f);
                src = tmp;
-               *totallen = restore_u32 ();
-               *filepos = zfile_ftell (f) - 4 - 4 - 4;
+               *totallen = restore_u32();
+               *filepos = zfile_ftell32(f) - 4 - 4 - 4;
                len2 -= 4;
        } else {
-               *filepos = zfile_ftell (f) - 4 - 4;
+               *filepos = zfile_ftell32(f) - 4 - 4;
        }
        /* chunk data.  RAM contents will be loaded during the reset phase,
           no need to malloc multiple megabytes here.  */
@@ -586,7 +586,7 @@ void restore_state (const TCHAR *filename)
        if (!f)
                goto error;
        zfile_fseek (f, 0, SEEK_END);
-       filesize = zfile_ftell (f);
+       filesize = zfile_ftell32(f);
        zfile_fseek (f, 0, SEEK_SET);
        savestate_state = STATE_RESTORE;
        savestate_init ();
@@ -1222,12 +1222,12 @@ int save_state (const TCHAR *filename, const TCHAR *description)
                size_t pos;
                if (savestate_specialdump == 2)
                        write_wavheader (f, 0, 22050);
-               pos = zfile_ftell (f);
+               pos = zfile_ftell32(f);
                save_rams (f, -1);
                if (savestate_specialdump == 2) {
                        int len, len2, i;
                        uae_u8 *tmp;
-                       len = zfile_ftell (f) - pos;
+                       len = zfile_ftell32(f) - pos;
                        tmp = xmalloc (uae_u8, len);
                        zfile_fseek(f, pos, SEEK_SET);
                        len2 = zfile_fread (tmp, 1, len, f);
@@ -1912,13 +1912,13 @@ void statefile_save_recording (const TCHAR *filename)
 {
        if (!staterecord_statefile)
                return;
-       struct zfile *zf = zfile_fopen (filename, _T("wb"), 0);
+       struct zfile *zf = zfile_fopen(filename, _T("wb"), 0);
        if (zf) {
-               int len = zfile_size (staterecord_statefile);
-               uae_u8 *data = zfile_getdata (staterecord_statefile, 0, len, NULL);
-               zfile_fwrite (data, len, 1, zf);
+               int len = zfile_size32(staterecord_statefile);
+               uae_u8 *data = zfile_getdata(staterecord_statefile, 0, len, NULL);
+               zfile_fwrite(data, len, 1, zf);
                xfree (data);
-               zfile_fclose (zf);
+               zfile_fclose(zf);
                write_log (_T("input statefile '%s' saved\n"), filename);
        }
 }
diff --git a/scp.cpp b/scp.cpp
index 705696fff26356ded3e8be8fbaf7d8e00aa35103..c7d7e2ef3c57fd5469193b81ea1e2eebfb438ae4 100644 (file)
--- a/scp.cpp
+++ b/scp.cpp
@@ -187,7 +187,7 @@ static int scp_next_flux(struct scpdrive *d)
          * reversal sits exactly on the index we have some time to donate to 
          * the first reversal of the first revolution. */
         val = d->total_ticks - d->acc_ticks;
-        d->acc_ticks = -val;
+        d->acc_ticks = 0 - val;
     }
 
     for (;;) {
@@ -275,15 +275,15 @@ void scp_loadrevolution(
         if (b)
             mfmbuf[i>>4] |= 0x8000u >> (i&15);
         if ((i & 7) == 7) {
-            tracktiming[i>>3] = d->latency - prev_latency;
+            tracktiming[i>>3] = (uae_u16)(d->latency - prev_latency);
             prev_latency = d->latency;
         }
     }
 
     if (i & 7)
-        tracktiming[i>>3] = ((d->latency - prev_latency) * 8) / (i & 7);
+        tracktiming[i>>3] = (uae_u16)(((d->latency - prev_latency) * 8) / (i & 7));
 
-    av_latency = prev_latency / (i>>3);
+    av_latency = (uint32_t)(prev_latency / (i>>3));
     for (j = 0; j < (i+7)>>3; j++)
         tracktiming[j] = ((uint32_t)tracktiming[j] * 1000u) / av_latency;
 
index 83f6af2a801b278ce7060a334dc2efeae549b376..929bfd224b6ac9c5db3e10584bf94897bbbe8af4 100644 (file)
@@ -446,7 +446,7 @@ static int command_read(TrapContext *ctx, struct devstruct *dev, uaecptr data, u
        offset /= blocksize;
        while (length > 0) {
                uae_u8 buffer[4096];
-               if (!sys_command_read (dev->unitnum, buffer, offset, 1))
+               if (!sys_command_read (dev->unitnum, buffer, (int)offset, 1))
                        return 20;
                trap_memcpyha_safe(ctx, data, buffer, blocksize);
                data += blocksize;
@@ -465,7 +465,7 @@ static int command_write(TrapContext *ctx, struct devstruct *dev, uaecptr data,
                uae_u8 buffer[4096];
                int err;
                trap_memcpyah_safe(ctx, buffer, data, blocksize);
-               err = sys_command_write (dev->unitnum, buffer, offset, 1);
+               err = sys_command_write (dev->unitnum, buffer, (int)offset, 1);
                if (!err)
                        return 20;
                if (err < 0)
@@ -486,7 +486,7 @@ static int command_cd_read(TrapContext *ctx, struct devstruct *dev, uaecptr data
        *io_actual = 0;
        startoffset = offset % blocksize;
        offset -= startoffset;
-       sector = offset / blocksize;
+       sector = (uae_u32)(offset / blocksize);
        while (length > 0) {
                uae_u8 temp[4096];
                if (blocksize != 2048) {
index fcbb0635cdee7de2784b144619d7e3c9b1c5f6cf..d5439febc6ac3767f56059998bccff5262e68c5e 100644 (file)
@@ -384,7 +384,7 @@ static int tape_write (struct scsi_data_tape *tape, uae_u8 *scsi_data, int len)
 int scsi_tape_emulate (struct scsi_data_tape *tape, uae_u8 *cmdbuf, int scsi_cmd_len,
        uae_u8 *scsi_data, int *data_len, uae_u8 *r, int *reply_len, uae_u8 *s, int *sense_len)
 {
-       uae_s64 len;
+       int len;
        int lr = 0, ls = 0;
        int scsi_len = -1;
        int status = 0;
@@ -528,7 +528,7 @@ int scsi_tape_emulate (struct scsi_data_tape *tape, uae_u8 *cmdbuf, int scsi_cmd
                        goto errreq;
                len = rl (cmdbuf + 1) & 0xffffff;
                if (log_tapeemu)
-                       write_log (_T("TAPEEMU WRITE FILEMARK %lld\n"), len);
+                       write_log (_T("TAPEEMU WRITE FILEMARK %d\n"), len);
                if (notape (tape))
                        goto notape;
                if (tape->unloaded)
@@ -608,7 +608,7 @@ int scsi_tape_emulate (struct scsi_data_tape *tape, uae_u8 *cmdbuf, int scsi_cmd
                        s[13] = 1; /* File Mark detected */
                        ls = 0x12;
                        if (log_tapeemu)
-                               write_log(_T("TAPEEMU READ FILE END, %lld remaining (BEOM=%d)\n"), len - scsi_len, tape->beom);
+                               write_log(_T("TAPEEMU READ FILE END, %ld remaining (BEOM=%d)\n"), len - scsi_len, tape->beom);
                } else if (tape->beom > 0) {
                        scsi_len = 0;
                        if (tape->beom <= 0)
@@ -625,7 +625,7 @@ int scsi_tape_emulate (struct scsi_data_tape *tape, uae_u8 *cmdbuf, int scsi_cmd
                        s[13] = tape->beom == 2 ? 2 : 5; /* End-of-media / End-of-data  */
                        ls = 0x12;
                        if (log_tapeemu)
-                               write_log(_T("TAPEEMU READ DATA END, %lld remaining\n"), len - scsi_len);
+                               write_log(_T("TAPEEMU READ DATA END, %ld remaining\n"), len - scsi_len);
                }
        break;
 
index 99976870fcf28244c62dd030b3d8ff093b796ade..b6d07e6e084170df3a60aabc27f06c0efb8c5bca 100644 (file)
@@ -46,9 +46,9 @@
 
 int cksum(struct mbuf *m, int len)
 {
-       register u_int16_t *w;
-       register int sum = 0;
-       register int mlen = 0;
+       u_int16_t *w;
+       int sum = 0;
+       int mlen = 0;
        int byte_swapped = 0;
 
        union {
index 94003d1ac09b9f6968ec7527fbe84e80a324fcad..6ba9b3eb5cc5aea9aefd54428a8112c993472bd0 100644 (file)
@@ -135,7 +135,7 @@ void m_cleanup(void);
 void msize_init(void);
 struct mbuf * m_get(void);
 void m_free(struct mbuf *);
-void m_cat(register struct mbuf *, register struct mbuf *);
+void m_cat(struct mbuf *, struct mbuf *);
 void m_inc(struct mbuf *, int);
 void m_adj(struct mbuf *, int);
 int m_copy(struct mbuf *, struct mbuf *, int, int);
index 73fe20894ea3e3f3bb21978eea5279dd642cff66..e7f76de63a4ddabd5a9aa3f6afa9229554345673 100644 (file)
@@ -133,6 +133,6 @@ struct tcpcb;
 void tcp_fasttimo(void);
 void tcp_slowtimo(void);
 void tcp_canceltimers(struct tcpcb *);
-struct tcpcb * tcp_timers(register struct tcpcb *, int);
+struct tcpcb * tcp_timers(struct tcpcb *, int);
 
 #endif
index 5b48bee21ad683d07cb62de15b9d8dde25a4560b..ad73ed72e6ba57204eb452f3b65cb71cd66c4052 100644 (file)
@@ -39,7 +39,7 @@ static bool sndboard_init_capture(int freq);
 static void uaesndboard_reset(int hardreset);
 static void sndboard_reset(int hardreset);
 
-static double base_event_clock;
+static float base_event_clock;
 
 extern addrbank uaesndboard_bank_z2, uaesndboard_bank_z3;
 
@@ -1495,7 +1495,7 @@ extern addrbank toccata_bank;
 #define STATUS_READ_RECORD_HALF 4
 
 
-void update_sndboard_sound (double clk)
+void update_sndboard_sound (float clk)
 {
        base_event_clock = clk;
 }
@@ -1671,8 +1671,8 @@ static void codec_start(struct snddev_data *data)
 
        codec_setup(data);
 
-       data->event_time = base_event_clock * CYCLE_UNIT / data->freq;
-       data->record_event_time = base_event_clock * CYCLE_UNIT / (data->freq_adjusted * data->record_bytespersample);
+       data->event_time = (int)(base_event_clock * CYCLE_UNIT / data->freq);
+       data->record_event_time = (int)(base_event_clock * CYCLE_UNIT / (data->freq_adjusted * data->record_bytespersample));
        data->record_event_counter = 0;
 
        if (data->snddev_active & STATUS_FIFO_PLAY) {
@@ -2527,7 +2527,7 @@ static void fm801_play(struct fm801_data *data)
        data->freq = fm801_freq[f];
        if (!data->freq)
                data->freq = 44100;
-       data->event_time = base_event_clock * CYCLE_UNIT / data->freq;
+       data->event_time = (int)(base_event_clock * CYCLE_UNIT / data->freq);
        data->bits = (control & 0x4000) ? 16 : 8;
        f = (control >> 12) & 3;
        switch (f)
@@ -2896,7 +2896,7 @@ int AUD_write(SWVoiceOut *sw, void *pcm_buf, int size)
 void AUD_set_active_out(SWVoiceOut *sw, int on)
 {
        sw->active = on != 0;
-       sw->event_time = base_event_clock * CYCLE_UNIT / sw->freq;
+       sw->event_time = (int)(base_event_clock * CYCLE_UNIT / sw->freq);
        sw->samplebuf_index = 0;
        sw->samplebuf_total = 0;
        calculate_volume_qemu();
index aa6665e1010c781072611c8a095a179786fdaf22..31d1618e956a2a5f1306f1f5a624b86cf71724be 100644 (file)
@@ -511,9 +511,9 @@ static inline void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t
     uint32_t aHigh, aLow, bHigh, bLow;
     uint64_t z0, zMiddleA, zMiddleB, z1;
 
-    aLow = a;
+    aLow = (uint32_t)a;
     aHigh = a>>32;
-    bLow = b;
+    bLow = (uint32_t)b;
     bHigh = b>>32;
     z1 = ( (uint64_t) aLow ) * bLow;
     zMiddleA = ( (uint64_t) aLow ) * bHigh;
@@ -735,7 +735,7 @@ static inline int8_t countLeadingZeros64( uint64_t a )
     else {
         a >>= 32;
     }
-    shiftCount += countLeadingZeros32( a );
+    shiftCount += countLeadingZeros32( (uint32_t)a );
     return shiftCount;
 #endif
 }
index ce7efc77ff5a9a38d094fadd1ee3ec9cd9209787..bef29081abc43a8584a9b23dbd44f96136c482ae 100644 (file)
@@ -500,7 +500,7 @@ static int32_t roundAndPackInt32(flag zSign, uint64_t absZ, float_status *status
     roundBits = absZ & 0x7F;
     absZ = ( absZ + roundIncrement )>>7;
     absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
-    z = absZ;
+    z = (int32_t)absZ;
     if ( zSign ) z = - z;
     if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
         float_raise(float_flag_invalid, status);
@@ -542,7 +542,7 @@ static int16_t roundAndPackInt16( flag zSign, uint64_t absZ, float_status *statu
     roundBits = absZ & 0x7F;
     absZ = ( absZ + roundIncrement )>>7;
     absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
-    z = absZ;
+    z = (int16_t)absZ;
     if ( zSign ) z = - z;
     z = (int16_t) z;
     if ( ( absZ>>16 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
@@ -581,7 +581,7 @@ static int8_t roundAndPackInt8( flag zSign, uint64_t absZ, float_status *status
     roundBits = absZ & 0x7F;
     absZ = ( absZ + roundIncrement )>>7;
     absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
-    z = absZ;
+    z = (int8_t)absZ;
     if ( zSign ) z = - z;
     z = (int8_t) z;
     if ( ( absZ>>8 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
@@ -1875,7 +1875,7 @@ int32_t floatx80_to_int32_round_to_zero(floatx80 a, float_status *status)
     shiftCount = 0x403E - aExp;
     savedASig = aSig;
     aSig >>= shiftCount;
-    z = aSig;
+    z = (int32_t)aSig;
     if ( aSign ) z = - z;
     if ( ( z < 0 ) ^ aSign ) {
  invalid:
@@ -1966,7 +1966,7 @@ float32 floatx80_to_float32(floatx80 a, float_status *status)
     shift64RightJamming( aSig, 33, &aSig );
     if ( aExp || aSig ) aExp -= 0x3F81;
 #endif
-    return roundAndPackFloat32(aSign, aExp, aSig, status);
+    return roundAndPackFloat32(aSign, aExp, (uint32_t)aSig, status);
 
 }
 
@@ -2138,7 +2138,7 @@ floatx80 floatx80_normalize( floatx80 a )
     
     shiftCount = countLeadingZeros64( aSig );
     
-    if ( shiftCount > aExp ) shiftCount = aExp;
+    if ( shiftCount > aExp ) shiftCount = (int8_t)aExp;
     
     aExp -= shiftCount;
     aSig <<= shiftCount;
@@ -3253,7 +3253,7 @@ floatx80 floatx80_scale(floatx80 a, floatx80 b, float_status *status)
     
     shiftCount = 0x403E - bExp;
     bSig >>= shiftCount;
-    aExp = bSign ? ( aExp - bSig ) : ( aExp + bSig );
+    aExp = (int32_t)(bSign ? ( aExp - bSig ) : ( aExp + bSig ));
     
     return roundAndPackFloatx80(
                 status->floatx80_rounding_precision, aSign, aExp, aSig, 0, status);
index a272b0327b101ff9abf9097a34043f0747f37438..ea63d206bd88c32390162026cc13c081df34fb09 100644 (file)
@@ -326,7 +326,7 @@ static int32_t getDecimalExponent(int32_t aExp, uint64_t aSig)
                zSig0 &= ~(((int64_t)(zSig1<<1) == 0) & 1);
        }
        
-       zExp = zSign ? (0 - zSig0) : zSig0;
+       zExp = (int32_t)(zSign ? (0 - zSig0) : zSig0);
 
        return zExp;
 }
index caca9fa8966c5342144e76fb06632416cac919b2..664b82c67ebbe6c6c831dd825a9dcd3c09c2fca6 100644 (file)
@@ -506,7 +506,7 @@ void statusline_add_message(int statustype, const TCHAR *format, ...)
                        statusline_data[i].text = my_strdup(buffer);
                        statusline_data[i].type = statustype;
                        if (i == 0)
-                               statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1);
+                               statusline_delay = (int)(STATUSLINE_MS * vblank_hz / 1000.0f);
                        statusline_text_active = statusline_data[0].text;
                        statusline_update_notification();
                        return;
@@ -530,11 +530,11 @@ void statusline_vsync(void)
        if (!statusline_data[0].text)
                return;
        if (statusline_delay == 0)
-               statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1);
-       if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000 * 1))
-               statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 1);
-       if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000 * 3) && statusline_data[1].text)
-               statusline_delay = STATUSLINE_MS * vblank_hz / (1000 * 3);
+               statusline_delay = (int)(STATUSLINE_MS * vblank_hz / (1000.0f * 1.0f));
+       if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000.0f * 1.0f))
+               statusline_delay = (int)(STATUSLINE_MS * vblank_hz / (1000.0f * 1.0f));
+       if (statusline_delay > STATUSLINE_MS * vblank_hz / (1000.0f * 3.0f) && statusline_data[1].text)
+               statusline_delay = (int)(STATUSLINE_MS * vblank_hz / (1000.0f * 3.0f));
        statusline_delay--;
        if (statusline_delay)
                return;
index a258645f4f77da9c0a06adbd5622d034522bcc98..7f5ae5bcc225af3815701fb8638e09a8fa60a28b 100644 (file)
@@ -35,7 +35,7 @@
 #include <dlfcn.h>
 #endif
 
-static double syncdivisor;
+static float syncdivisor;
 
 #define SIGBIT 8 // SIGB_DOS
 
@@ -216,7 +216,7 @@ static void set_library_globals(void *dl)
 
 static uae_u32 open_library (const char *name, uae_u32 min_version)
 {
-    syncdivisor = (3580000.0 * CYCLE_UNIT) / (double) syncbase;
+    syncdivisor = (3580000.0f * CYCLE_UNIT) / (float) syncbase;
 
     for (const char *c = name; *c; c++) {
         if (*c == '/' || *c == '\\' || *c == ':') {
@@ -416,7 +416,7 @@ static void do_call_function (struct uni *uni)
 {
     printf("uni: calling native function %p\n", uni->native_function);
 
-    unsigned long start_time;
+    frame_time_t start_time;
     const int flags = uni->flags;
     if ((flags & UNI_FLAG_ASYNCHRONOUS) == 0) {
         start_time = read_processor_time ();
@@ -437,11 +437,11 @@ static void do_call_function (struct uni *uni)
     }
 
     if ((flags & UNI_FLAG_ASYNCHRONOUS) == 0) {
-        unsigned long time_diff = read_processor_time () - start_time;
-        double v = syncdivisor * time_diff;
+        frame_time_t time_diff = read_processor_time () - start_time;
+        float v = syncdivisor * time_diff;
         if (v > 0) {
-            if (v > 1000000 * CYCLE_UNIT) {
-                v = 1000000 * CYCLE_UNIT;
+            if (v > 1000000.0f * CYCLE_UNIT) {
+                v = 1000000.0f * CYCLE_UNIT;
             }
             // compensate for the time spent in the native function
             do_extra_cycles ((unsigned long) (syncdivisor * time_diff));
diff --git a/x86.cpp b/x86.cpp
index f70816cc2167663d8ccc01ccc3eab7a9f2541c37..18fea90849b4f096939d31fe40c0dad30931132e 100644 (file)
--- a/x86.cpp
+++ b/x86.cpp
@@ -80,7 +80,7 @@ static void(*port_outw[MAX_IO_PORT])(uint16_t addr, uint16_t val, void *priv);
 static void(*port_outl[MAX_IO_PORT])(uint16_t addr, uint32_t val, void *priv);
 static void *port_priv[MAX_IO_PORT];
 
-static double x86_base_event_clock;
+static float x86_base_event_clock;
 static int x86_sndbuffer_playpos;
 static int x86_sndbuffer_playindex;
 static int sound_handlers_num;
@@ -1677,7 +1677,7 @@ static uae_u8 vlsi_in(struct x86_bridge *xb, int portnum)
                v = xb->scamp_idx1 | 0x80;
                break;
                case 0xea:
-               v = xb->vlsi_regs_ems[xb->scamp_idx1 & 0x3f];
+               v = (uae_u8)xb->vlsi_regs_ems[xb->scamp_idx1 & 0x3f];
                break;
                case 0xeb:
                v = xb->vlsi_regs_ems[xb->scamp_idx1 & 0x3f] >> 8;
@@ -2082,7 +2082,7 @@ void portout16(uint16_t portnum, uint16_t value)
                if (port_outw[portnum]) {
                        port_outw[portnum](portnum, value, port_priv[portnum]);
                } else {
-                       portout(portnum, value);
+                       portout(portnum, (uae_u8)value);
                        portout(portnum + 1, value >> 8);
                }
                break;
@@ -2392,7 +2392,7 @@ uint8_t portin(uint16_t portnum)
                case 0x176:
                case 0x177:
                case 0x376:
-               v = x86_ide_hd_get(portnum, 0);
+               v = (uae_u8)x86_ide_hd_get(portnum, 0);
                break;
                // at ide 0
                case 0x1f0:
@@ -2404,7 +2404,7 @@ uint8_t portin(uint16_t portnum)
                case 0x1f6:
                case 0x1f7:
                case 0x3f6:
-               v = x86_ide_hd_get(portnum, 0);
+               v = (uae_u8)x86_ide_hd_get(portnum, 0);
                break;
 
                // universal xt bios
@@ -2424,7 +2424,7 @@ uint8_t portin(uint16_t portnum)
                case 0x30d:
                case 0x30e:
                case 0x30f:
-               v = x86_ide_hd_get(portnum, 0);
+               v = (uae_u8)x86_ide_hd_get(portnum, 0);
                break;
 
                // led debug (a2286 bios uses this)
@@ -2829,7 +2829,7 @@ static void vga_writeb(uint32_t addr, uint8_t val, void *priv)
 }
 static void vga_writew(uint32_t addr, uint16_t val, void *priv)
 {
-       vga_ram_put(x86_vga_board, addr, val);
+       vga_ram_put(x86_vga_board, addr, (uae_u8)val);
        vga_ram_put(x86_vga_board, addr + 1, val >> 8);
 }
 static void vga_writel(uint32_t addr, uint32_t val, void *priv)
@@ -2858,7 +2858,7 @@ static void vgalfb_writeb(uint32_t addr, uint8_t val, void *priv)
 }
 static void vgalfb_writew(uint32_t addr, uint16_t val, void *priv)
 {
-       vgalfb_ram_put(x86_vga_board, addr, val);
+       vgalfb_ram_put(x86_vga_board, addr, (uae_u8)val);
        vgalfb_ram_put(x86_vga_board, addr + 1, val >> 8);
 }
 static void vgalfb_writel(uint32_t addr, uint32_t val, void *priv)
@@ -2948,7 +2948,7 @@ static void mem_write_romextw3(uint32_t addr, uint16_t val, void *priv)
        } else if (addr >= 0x3800) {
                int reg = to53c400reg(addr + 0, true);
                if (reg >= 0)
-                       x86_rt1000_bput(reg, val);
+                       x86_rt1000_bput(reg, (uae_u8)val);
                reg = to53c400reg(addr + 1, true);
                if (reg >= 0)
                        x86_rt1000_bput(reg, val >> 8);
@@ -3133,7 +3133,7 @@ static void x86_bridge_vsync(void)
        if (rc) {
                xb->mouse_port = (rc->device_settings & 3) + 1;
        }
-       xb->audeventtime = x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1;
+       xb->audeventtime = (int)(x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1);
 }
 
 static void x86_bridge_hsync(void)
@@ -3148,7 +3148,7 @@ static void x86_bridge_hsync(void)
                xb->sound_initialized = true;
                if (xb->sound_emu) {
                        write_log(_T("x86 sound init\n"));
-                       xb->audeventtime = x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1;
+                       xb->audeventtime = (int)(x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1);
                        timer_add(&sound_poll_timer, sound_poll, NULL, 0);
                        xb->audstream = audio_enable_stream(true, -1, 2, audio_state_sndboard_x86, NULL);
                        sound_speed_changed(true);
@@ -3701,7 +3701,7 @@ bool x86_bridge_init(struct autoconfig_info *aci, uae_u32 romtype, int type)
                                        } else if (cputype == CPU_286 && fpu_type != FPU_NONE) {
                                                fpu_type = FPU_287;
                                        } else if (cputype == CPU_8088 && fpu_type != FPU_NONE) {
-                                               fpu_type == FPU_8087;
+                                               fpu_type = FPU_8087;
                                        }
                                        write_log(_T("CPU override = %s\n"), cpuname);
                                }
@@ -3955,7 +3955,7 @@ void sound_add_handler(void(*get_buffer)(int32_t *buffer, int len, void *p), voi
 void sound_speed_changed(bool enable)
 {
        if (sound_poll_timer.enabled || enable) {
-               sound_poll_latch = (uae_u64)((double)TIMER_USEC * (1000000.0 / currprefs.sound_freq));
+               sound_poll_latch = (uae_u64)((float)TIMER_USEC * (1000000.0f / currprefs.sound_freq));
                timer_set_delay_u64(&sound_poll_timer, sound_poll_latch);
        }
 }
@@ -3999,12 +3999,12 @@ void sound_set_cd_volume(unsigned int l, unsigned int r)
 
 }
 
-void x86_update_sound(double clk)
+void x86_update_sound(float clk)
 {
        struct x86_bridge *xb = bridges[0];
        x86_base_event_clock = clk;
        if (xb) {
-               xb->audeventtime = x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1;
+               xb->audeventtime = (int)(x86_base_event_clock * CYCLE_UNIT / currprefs.sound_freq + 1);
                sound_speed_changed(false);
        }
 }
index fb9f8508447fec6414448d1bd81a4cb768ce2177..83a172d443aaed310f7b22e86ad8bc08b343cb5d 100644 (file)
--- a/zfile.cpp
+++ b/zfile.cpp
@@ -389,7 +389,7 @@ static uae_u64 vhd_fread2 (struct zfile *zf, void *dataptrv, uae_u64 offset, uae
        if (len & 511)
                return read;
        while (len > 0) {
-               bamoffset = (offset / zvhd->vhd_blocksize) * 4 + zvhd->vhd_bamoffset;
+               bamoffset = (uae_u32)((offset / zvhd->vhd_blocksize) * 4 + zvhd->vhd_bamoffset);
                sectoroffset = gl (zvhd->vhd_header + bamoffset);
                if (sectoroffset == 0xffffffff) {
                        memset (dataptr, 0, 512);
@@ -450,7 +450,7 @@ static uae_s64 vhd_fread (void *data, uae_u64 l1, uae_u64 l2, struct zfile *zf)
                        zf->seek += s;
                }
                while (size > 0) {
-                       int s = size > 512 ? 512 : size;
+                       int s = size > 512 ? 512 : (int)size;
                        vhd_fread2 (zf, tmp, zf->seek, 512);
                        memcpy ((uae_u8*)data + len, tmp, s);
                        zf->seek += s;
@@ -640,8 +640,11 @@ static void truncate880k (struct zfile *z)
 
        if (z == NULL || z->data == NULL)
                return;
+       if (z->size > INT_MAX) {
+               return;
+       }
        if (z->size < 880 * 512 * 2) {
-               int size = 880 * 512 * 2 - z->size;
+               int size = 880 * 512 * 2 - (int)z->size;
                b = xcalloc (uae_u8, size);
                zfile_fwrite (b, size, 1, z);
                xfree (b);
@@ -704,7 +707,7 @@ static struct zfile *extadf (struct zfile *z, int index, int *retcode)
 
                zfile_fseek (z, pos, SEEK_SET);
                zfile_fread (buffer, 2 + 2 + 4 + 4, 1, z);
-               pos = zfile_ftell (z);
+               pos = zfile_ftell32(z);
                type = buffer[2] * 256 + buffer[3];
                len = buffer[5] * 65536 + buffer[6] * 256 + buffer[7];
                bitlen = buffer[9] * 65536 + buffer[10] * 256 + buffer[11];
@@ -801,7 +804,7 @@ static struct zfile *fdi (struct zfile *z, int index, int *retcode)
                        for (j = 0; j < len / 2; j++) {
                                uae_u16 v = mfm[j];
                                *p++ = v >> 8;
-                               *p++ = v;
+                               *p++ = (uae_u8)v;
                        }
                        zd->zdisktracks[i].data = buf;
                        zd->zdisktracks[i].len = len;
@@ -835,7 +838,7 @@ static struct zfile *fdi (struct zfile *z, int index, int *retcode)
                zfile_fwrite (tmp, 4, 1, zo);
                memset (tmp, 0, sizeof tmp);
                tmp[2] = 0; tmp[3] = 1; /* track type */
-               startpos = zfile_ftell (zo);
+               startpos = zfile_ftell32(zo);
                for (i = 0; i < tracks; i++)
                        zfile_fwrite (tmp, sizeof tmp, 1, zo);
        }
@@ -860,7 +863,7 @@ static struct zfile *fdi (struct zfile *z, int index, int *retcode)
                        }
                        zfile_fwrite (outbuf, outsize, 1, zo);
                } else {
-                       int pos = zfile_ftell (zo);
+                       int pos = zfile_ftell32(zo);
                        int maxlen = len > 12798 ? len : 12798;
                        int lenb = len * 8;
 
@@ -932,7 +935,7 @@ static struct zfile *ipf (struct zfile *z, int index, int *retcode)
                        for (j = 0; j < len / 2; j++) {
                                uae_u16 v = mfm[j];
                                *p++ = v >> 8;
-                               *p++ = v;
+                               *p++ = (uae_u8)v;
                        }
                        zd->zdisktracks[i].data = buf;
                        zd->zdisktracks[i].len = len;
@@ -970,7 +973,7 @@ static struct zfile *ipf (struct zfile *z, int index, int *retcode)
                zfile_fwrite (tmp, 4, 1, zo);
                memset (tmp, 0, sizeof tmp);
                tmp[2] = 0; tmp[3] = 1; /* track type */
-               startpos = zfile_ftell (zo);
+               startpos = zfile_ftell32(zo);
                for (i = 0; i < tracks; i++)
                        zfile_fwrite (tmp, sizeof tmp, 1, zo);
        }
@@ -996,7 +999,7 @@ static struct zfile *ipf (struct zfile *z, int index, int *retcode)
                        }
                        zfile_fwrite (outbuf, outsize, 1, zo);
                } else {
-                       int pos = zfile_ftell (zo);
+                       int pos = zfile_ftell32(zo);
                        int maxlen = len > 12798 ? len : 12798;
                        int lenb = len * 8;
 
@@ -1244,7 +1247,7 @@ static struct zfile *dms (struct zfile *z, int index, int *retcode)
                return NULL;
        ret = DMS_Process_File (z, zo, CMD_UNPACK, OPT_VERBOSE, 0, 0, 0, zextra);
        if (ret == NO_PROBLEM || ret == DMS_FILE_END) {
-               int off = zfile_ftell (zo);
+               int off = zfile_ftell32(zo);
                if (off >= 1760 * 512 / 3 && off <= 1760 * 512 * 3 / 4) { // possible split dms?
                        if (_tcslen (orgname) > 5) {
                                TCHAR *s = orgname + _tcslen (orgname) - 5;
@@ -1965,13 +1968,16 @@ struct zfile *zfile_dup (struct zfile *zf)
        if (!zf->data && zf->dataseek) {
                nzf = zfile_create (zf, NULL);
        } else if (zf->data) {
+               if (zf->size > INT_MAX) {
+                       return NULL;
+               }
                nzf = zfile_create (zf, NULL);
-               nzf->data = xmalloc (uae_u8, zf->size);
+               nzf->data = xmalloc (uae_u8, (size_t)zf->size);
                if (!nzf->data) {
                        write_log(_T("Out of memory: %s\n"), zfile_getname(zf));
                        return NULL;
                }
-               memcpy (nzf->data, zf->data, zf->size);
+               memcpy (nzf->data, zf->data, (size_t)zf->size);
                nzf->size = zf->size;
                nzf->datasize = zf->datasize;
        } else if (zf->useparent) {
@@ -2022,11 +2028,14 @@ int zfile_iscompressed (struct zfile *z)
 
 struct zfile *zfile_fopen_empty (struct zfile *prev, const TCHAR *name, uae_u64 size)
 {
+       if (size > INT_MAX) {
+               return NULL;
+       }
        struct zfile *l;
        l = zfile_create (prev, NULL);
        l->name = my_strdup (name ? name : _T(""));
        if (size) {
-               l->data = xcalloc (uae_u8, size);
+               l->data = xcalloc (uae_u8, (size_t)size);
                if (!l->data)  {
                        xfree (l);
                        return NULL;
@@ -2074,11 +2083,14 @@ struct zfile *zfile_fopen_parent (struct zfile *z, const TCHAR *name, uae_u64 of
 
 struct zfile *zfile_fopen_load_zfile (struct zfile *f)
 {
+       if (f->size > INT_MAX) {
+               return NULL;
+       }
        struct zfile *l = zfile_fopen_empty (f, f->name, f->size);
        if (!l)
                return NULL;
        zfile_fseek (f, 0, SEEK_SET);
-       zfile_fread (l->data, f->size, 1, f);
+       zfile_fread (l->data, (size_t)f->size, 1, f);
        return l;
 }
 
@@ -2086,12 +2098,15 @@ struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, const uae_u8 *d
 {
        struct zfile *l;
 
+       if (size > INT_MAX) {
+               return NULL;
+       }
        l = zfile_create (NULL, name);
        l->name = my_strdup (name ? name : _T(""));
-       l->data = xmalloc (uae_u8, size);
+       l->data = xmalloc (uae_u8, (size_t)size);
        l->size = size;
        l->datasize = size;
-       memcpy (l->data, data, size);
+       memcpy (l->data, data, (size_t)size);
        return l;
 }
 
@@ -2100,7 +2115,7 @@ uae_u8 *zfile_get_data_pointer(struct zfile *z, int *len)
 {
        if (!z->data)
                return NULL;
-       *len = z->size;
+       *len = (int)z->size;
        return z->data;
 }
 
@@ -2112,7 +2127,7 @@ uae_u8 *zfile_load_data (const TCHAR *name, const uae_u8 *data,int datalen, int
        
        zf = zfile_fopen_data (name, datalen, data);
        f = zfile_gunzip (zf);
-       size = f->datasize;
+       size = (int)f->datasize;
        zfile_fseek (f, 0, SEEK_SET);
        out = xmalloc (uae_u8, size);
        zfile_fread (out, 1, size, f);
@@ -2130,11 +2145,12 @@ uae_u8 *zfile_load_file(const TCHAR *name, int *outlen)
        zf = zfile_fopen(name, _T("rb"));
        if (!zf)
                return NULL;
-       size = zfile_size(zf);
+       size = zfile_size32(zf);
        out = xmalloc (uae_u8, size);
        zfile_fread(out, 1, size, zf);
        zfile_fclose(zf);
        *outlen = size;
+
        return out;
 }
 
@@ -2156,17 +2172,41 @@ int zfile_truncate (struct zfile *z, uae_s64 size)
        }
 }
 
-uae_s64 zfile_size (struct zfile *z)
+uae_s64 zfile_size(struct zfile *z)
 {
        return z->size;
 }
 
+uae_s32 zfile_size32(struct zfile *z)
+{
+       uae_s64 s = z->size;
+       if (s > INT_MAX) {
+               return INT_MAX;
+       }
+       return (uae_s32)s;
+}
+
 uae_s64 zfile_ftell (struct zfile *z)
 {
        if (z->data || z->dataseek || z->parent)
                return z->seek;
        return _ftelli64 (z->f);
+}
 
+uae_s32 zfile_ftell32(struct zfile *z)
+{
+       if (z->data || z->dataseek || z->parent) {
+               uae_s64 s = z->seek;
+               if (s > INT_MAX) {
+                       return INT_MAX;
+               }
+               return (uae_s32)s;
+       }
+       uae_s64 s = _ftelli64(z->f);
+       if (s > INT_MAX) {
+               return INT_MAX;
+       }
+       return (uae_s32)s;
 }
 
 uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode)
@@ -2205,7 +2245,7 @@ uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode)
 size_t zfile_fread  (void *b, size_t l1, size_t l2, struct zfile *z)
 {
        if (z->zfileread)
-               return z->zfileread (b, l1, l2, z);
+               return (size_t)z->zfileread(b, l1, l2, z);
        if (z->data) {
                if (z->datasize < z->size && z->seek + l1 * l2 > z->datasize) {
                        if (z->archiveparent) {
@@ -2216,7 +2256,7 @@ size_t zfile_fread  (void *b, size_t l1, size_t l2, struct zfile *z)
                }
                if (z->seek + l1 * l2 > z->size) {
                        if (l1)
-                               l2 = (z->size - z->seek) / l1;
+                               l2 = (size_t)((z->size - z->seek) / l1);
                        else
                                l2 = 0;
                        if (l2 < 0)
@@ -2233,7 +2273,7 @@ size_t zfile_fread  (void *b, size_t l1, size_t l2, struct zfile *z)
                v = z->seek;
                if (v + l1 * l2 > size) {
                        if (l1)
-                               l2 = (size - v) / l1;
+                               l2 = (size_t)((size - v) / l1);
                        else
                                l2 = 0;
                        if (l2 < 0)
@@ -2253,7 +2293,7 @@ size_t zfile_fwrite (const void *b, size_t l1, size_t l2, struct zfile *z)
        if (z->archiveparent)
                return 0;
        if (z->zfilewrite)
-               return z->zfilewrite (b, l1, l2, z);
+               return (size_t)z->zfilewrite(b, l1, l2, z);
        if (z->parent && z->useparent)
                return 0;
        if (z->data) {
@@ -2267,7 +2307,7 @@ size_t zfile_fwrite (const void *b, size_t l1, size_t l2, struct zfile *z)
                        if (inc < 10000)
                                inc = 10000;
                        z->allocsize += inc;
-                       z->data = xrealloc (uae_u8, z->data, z->allocsize);
+                       z->data = xrealloc (uae_u8, z->data, (size_t)z->allocsize);
                }
                memcpy (z->data + z->seek, b, l1 * l2);
                z->seek += l1 * l2;
@@ -2398,17 +2438,17 @@ int zfile_ferror (struct zfile *z)
 
 uae_u8 *zfile_getdata (struct zfile *z, uae_s64 offset, int len, int *outlen)
 {
-       uae_s64 pos = zfile_ftell (z);
+       uae_s32 pos = zfile_ftell32(z);
        uae_u8 *b;
        if (len < 0) {
-               zfile_fseek (z, 0, SEEK_END);
-               len = zfile_ftell (z);
-               zfile_fseek (z, 0, SEEK_SET);
-       }
-       b = xmalloc (uae_u8, len);
-       zfile_fseek (z, offset, SEEK_SET);
-       zfile_fread (b, len, 1, z);
-       zfile_fseek (z, pos, SEEK_SET);
+               zfile_fseek(z, 0, SEEK_END);
+               len = zfile_ftell32(z);
+               zfile_fseek(z, 0, SEEK_SET);
+       }
+       b = xmalloc(uae_u8, len);
+       zfile_fseek(z, offset, SEEK_SET);
+       zfile_fread(b, len, 1, z);
+       zfile_fseek(z, pos, SEEK_SET);
        if (outlen)
                *outlen = len;
        return b;
@@ -2492,7 +2532,7 @@ TCHAR *zfile_getfilename (struct zfile *f)
        return f->name;
 }
 
-uae_u32 zfile_crc32 (struct zfile *f)
+uae_u32 zfile_crc32(struct zfile *f)
 {
        uae_u8 *p;
        int pos, size;
@@ -2501,18 +2541,18 @@ uae_u32 zfile_crc32 (struct zfile *f)
        if (!f)
                return 0;
        if (f->data)
-               return get_crc32 (f->data, f->size);
-       pos = zfile_ftell (f);
-       zfile_fseek (f, 0, SEEK_END);
-       size = zfile_ftell (f);
+               return get_crc32(f->data, (uae_u32)f->size);
+       pos = zfile_ftell32(f);
+       zfile_fseek(f, 0, SEEK_END);
+       size = zfile_ftell32(f);
        p = xmalloc (uae_u8, size);
        if (!p)
                return 0;
-       memset (p, 0, size);
-       zfile_fseek (f, 0, SEEK_SET);
-       zfile_fread (p, 1, size, f);
-       zfile_fseek (f, pos, SEEK_SET);
-       crc = get_crc32 (p, size);
+       memset(p, 0, size);
+       zfile_fseek(f, 0, SEEK_SET);
+       zfile_fread(p, 1, size, f);
+       zfile_fseek(f, pos, SEEK_SET);
+       crc = get_crc32(p, size);
        xfree (p);
        return crc;
 }
@@ -2979,10 +3019,9 @@ static struct znode *get_znode (struct zvolume *zv, const TCHAR *ppath, int recu
 
 static void addvolumesize (struct zvolume *zv, uae_s64 size)
 {
-       unsigned int blocks = (size + 511) / 512;
-
-       if (blocks == 0)
-               blocks++;
+//     unsigned int blocks = (size + 511) / 512;
+//     if (blocks == 0)
+//             blocks++;
        while (zv) {
                zv->size += size;
                zv = zv->parent;
@@ -3495,7 +3534,7 @@ int zfile_convertimage (const TCHAR *src, const TCHAR *dst)
                uae_u8 *b;
                int size;
                zfile_fseek (s, 0, SEEK_END);
-               size = zfile_ftell (s);
+               size = zfile_ftell32(s);
                zfile_fseek (s, 0, SEEK_SET);
                b = xcalloc (uae_u8, size);
                if (b) {
index 62cdd8c3b27298bd98433dcf173d6c915b0760df..4a4a8dd34bae638a5eb0c3f5f949baa71ab2c147 100644 (file)
@@ -320,7 +320,7 @@ struct zvolume *archive_directory_tar (struct zfile *z)
                        } else {
                                zn = zvolume_addfile_abs (zv, &zai);
                                if (zn)
-                                       zn->offset = zfile_ftell (z);
+                                       zn->offset = zfile_ftell32(z);
                        }
                        xfree (zai.name);
                }
@@ -451,7 +451,7 @@ static struct zfile *archive_do_zip (struct znode *zn, struct zfile *z, int flag
                int err = -1;
                if (!(flags & FILE_DELAYEDOPEN) || z->size <= PEEK_BYTES) {
                        unpack_log (_T("ZIP: unpacking %s, flags=%d\n"), name, flags);
-                       err = unzReadCurrentFile (uz, z->data, z->datasize);
+                       err = unzReadCurrentFile (uz, z->data, (size_t)z->datasize);
                        unpack_log (_T("ZIP: unpacked, code=%d\n"), err);
                } else {
                        z->archiveparent = zfile_dup (zn->volume->archive);
@@ -460,11 +460,11 @@ static struct zfile *archive_do_zip (struct znode *zn, struct zfile *z, int flag
                                xfree (z->archiveparent->name);
                                z->archiveparent->name = my_strdup (tmp);
                                z->datasize = PEEK_BYTES;
-                               err = unzReadCurrentFile (uz, z->data, z->datasize);
+                               err = unzReadCurrentFile (uz, z->data, (size_t)z->datasize);
                                unpack_log (_T("ZIP: unpacked, code=%d\n"), err);
                        } else {
                                unpack_log (_T("ZIP: unpacking %s (failed DELAYEDOPEN)\n"), name);
-                               err = unzReadCurrentFile (uz, z->data, z->datasize);
+                               err = unzReadCurrentFile (uz, z->data, (size_t)z->datasize);
                                unpack_log (_T("ZIP: unpacked, code=%d\n"), err);
                        }
                }
@@ -639,7 +639,7 @@ static struct zfile *archive_access_7z (struct znode *zn)
                &offset, &outSizeProcessed,
                &allocImp, &allocTempImp);
        if (res == SZ_OK) {
-               zfile_fwrite (ctx->outBuffer + offset, zn->size, 1, z);
+               zfile_fwrite (ctx->outBuffer + offset, (size_t)zn->size, 1, z);
        } else {
                write_log (_T("7Z: SzExtract %s returned %d\n"), zn->fullname, res);
                zfile_fclose (z);
@@ -1099,14 +1099,14 @@ static struct zfile *archive_access_plain (struct znode *zn)
                z = zfile_fopen_empty (zn->volume->archive, zn->fullname, zn->size);
                zf = zfile_fopen (zfile_getname (zn->volume->archive), _T("rb"), zn->volume->archive->zfdmask & ~ZFD_ADF, zn->offset - 1);
                if (zf) {
-                       zfile_fread (z->data, zn->size, 1, zf);
+                       zfile_fread (z->data, (size_t)zn->size, 1, zf);
                        zfile_fclose (zf);
                }
        } else {
                z = zfile_fopen_empty (zn->volume->archive, zn->fullname, zn->size);
                if (z) {
                        zfile_fseek (zn->volume->archive, 0, SEEK_SET);
-                       zfile_fread (z->data, zn->size, 1, zn->volume->archive);
+                       zfile_fread (z->data, (size_t)zn->size, 1, zn->volume->archive);
                }
        }
        return z;
@@ -1358,7 +1358,7 @@ struct zvolume *archive_directory_adf (struct znode *parent, struct zfile *z)
 
        adf = xcalloc (struct adfhandle, 1);
        zfile_fseek (z, 0, SEEK_END);
-       adf->size = zfile_ftell (z);
+       adf->size = zfile_ftell32(z);
        zfile_fseek (z, 0, SEEK_SET);
 
        adf->blocksize = 512;
@@ -1574,7 +1574,7 @@ static struct zfile *archive_access_adf (struct znode *zn)
                                        zfile_fseek (adf->z, block * adf->blocksize, SEEK_SET);
                                else
                                        zfile_fseek (adf->z, block * adf->blocksize + 24, SEEK_SET);
-                               zfile_fread (dst, bsize, 1, adf->z);
+                               zfile_fread (dst, (size_t)bsize, 1, adf->z);
                                size -= bsize;
                                dst += bsize;
                                if (size <= 0)
@@ -1629,7 +1629,7 @@ static struct zfile *archive_access_adf (struct znode *zn)
                        zfile_fseek (adf->z, block * adf->blocksize, SEEK_SET);
                        if (bsize > size)
                                bsize = size;
-                       zfile_fread (dst, bsize, 1, adf->z);
+                       zfile_fread (dst, (size_t)bsize, 1, adf->z);
                        dst += bsize;
                        size -= bsize; 
                }
@@ -2062,7 +2062,7 @@ static struct zfile *archive_access_fat (struct znode *zn)
                uae_s64 left = size > sectorspercluster * 512 ? sectorspercluster * 512 : size;
                int sector = dataregion + (cluster - 2) * sectorspercluster;
                zfile_fseek (sz, sector * 512, SEEK_SET);
-               zfile_fread (dz->data + offset, 1, left, sz);
+               zfile_fread (dz->data + offset, 1, (size_t)left, sz);
                size -= left;
                offset += left;
                cluster = getcluster (sz, cluster, reserved, fatbits);