From: Frode Solheim Date: Fri, 4 Sep 2015 19:20:21 +0000 (+0200) Subject: trivial changes in several modules X-Git-Tag: 3200~89^2~13 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=add7f46b1ebc6b3b0920b98e5a369549ade8486c;p=francis%2Fwinuae.git trivial changes in several modules --- diff --git a/a2091.cpp b/a2091.cpp index 3bb74bd2..6340bbcf 100644 --- a/a2091.cpp +++ b/a2091.cpp @@ -3422,7 +3422,7 @@ void gvp_s2_add_accelerator_scsi_unit(int ch, struct uaedev_config_info *ci, str add_scsi_device(&wd->scsis[ch], ch, ci, rc); } -void a2091_free_device (struct wd_state *wd) +static void a2091_free_device (struct wd_state *wd) { freencrunit(wd); } @@ -3586,7 +3586,7 @@ addrbank *a2090_init (struct romconfig *rc) return wd->bank; } -void gvp_free_device (struct wd_state *wd) +static void gvp_free_device (struct wd_state *wd) { freencrunit(wd); } diff --git a/ar.cpp b/ar.cpp index ba8d80bf..23855d83 100644 --- a/ar.cpp +++ b/ar.cpp @@ -213,7 +213,6 @@ #include "savestate.h" #include "crc32.h" #include "akiko.h" -#include "picasso96.h" #define DEBUG #ifdef DEBUG diff --git a/archivers/chd/corefile.h b/archivers/chd/corefile.h index 87ca8e2b..10bfc397 100644 --- a/archivers/chd/corefile.h +++ b/archivers/chd/corefile.h @@ -116,7 +116,7 @@ int core_fputs(core_file *f, const TCHAR *s); /* printf-style text write to a file */ int core_vfprintf(core_file *f, const TCHAR *fmt, va_list va); -int CLIB_DECL core_fprintf(core_file *f, const TCHAR *fmt, ...) ATTR_PRINTF(2,3); +int CLIB_DECL core_fprintf(core_file *f, const TCHAR *fmt, ...); diff --git a/archivers/dms/u_deep.cpp b/archivers/dms/u_deep.cpp index 1595d778..95245f89 100644 --- a/archivers/dms/u_deep.cpp +++ b/archivers/dms/u_deep.cpp @@ -48,7 +48,7 @@ static USHORT son[T]; /* pointers to child nodes (son[], son[] + 1) */ -void Init_DEEP_Tabs(void){ +static void Init_DEEP_Tabs(void){ USHORT i, j; for (i = 0; i < N_CHAR; i++) { diff --git a/archivers/zip/unzip.cpp b/archivers/zip/unzip.cpp index 62ce2168..4d6b3304 100644 --- a/archivers/zip/unzip.cpp +++ b/archivers/zip/unzip.cpp @@ -888,7 +888,7 @@ extern int ZEXPORT unzOpenCurrentFile (unzFile file) if ((s->cur_file_info.compression_method!=0) && (s->cur_file_info.compression_method!=Z_DEFLATED)) { - write_log (_T("ZIP: unknown compression method %lld\n"), s->cur_file_info.compression_method); + write_log (_T("ZIP: unknown compression method %ld\n"), s->cur_file_info.compression_method); err=UNZ_BADZIPFILE; } Store = s->cur_file_info.compression_method==0; diff --git a/audio.cpp b/audio.cpp index ef6aadda..e2798449 100644 --- a/audio.cpp +++ b/audio.cpp @@ -899,7 +899,7 @@ void sample16ss_handler (void) /* This interpolator examines sample points when Paula switches the output * voltage and computes the average of Paula's output */ -void sample16ss_anti_handler (void) +static void sample16ss_anti_handler (void) { int data0, data1, data2, data3; int datas[AUDIO_CHANNELS_PAULA]; @@ -949,7 +949,7 @@ static void sample16si_anti_handler (void) check_sound_buffers (); } -void sample16ss_sinc_handler (void) +static void sample16ss_sinc_handler (void) { int data0, data1, data2, data3; int datas[AUDIO_CHANNELS_PAULA]; @@ -1346,7 +1346,7 @@ static void loaddat (int nr, bool modper) return; if (modper && audap) { if (cdp->dat == 0) - cdp[1].per = 65536 * CYCLE_UNIT; + cdp[1].per = 65536 * CYCLE_UNIT; else if (cdp->dat > PERIOD_MIN) cdp[1].per = cdp->dat * CYCLE_UNIT; else @@ -1588,7 +1588,7 @@ static void audio_state_channel2 (int nr, bool perfin) } } -void audio_state_cda(void); +static void audio_state_cda(void); static void audio_state_channel (int nr, bool perfin) { @@ -2306,7 +2306,7 @@ void audio_enable_sndboard(bool enable) audio_set_extra_channels(); } -void audio_enable_cda(bool enable) +static void audio_enable_cda(bool enable) { struct audio_channel_data *acd = audio_channel + AUDIO_CHANNEL_CDA_LEFT; if (!enable) { diff --git a/blitter.cpp b/blitter.cpp index 19e8a7e9..9fa0577a 100644 --- a/blitter.cpp +++ b/blitter.cpp @@ -341,7 +341,6 @@ int blitter_channel_state (void) return channel_state (blit_cyclecounter); } -extern int is_bitplane_dma (int hpos); STATIC_INLINE int canblit (int hpos) { if (!dmaen (DMA_BLITTER)) @@ -953,21 +952,16 @@ STATIC_INLINE uae_u16 blitter_doblit (void) STATIC_INLINE void blitter_doddma (int hpos) { - int wd; uae_u16 d; - wd = 0; if (blit_dmacount2 == 0) { d = blitter_doblit (); - wd = -1; } else if (ddat2use) { d = ddat2; ddat2use = 0; - wd = 2; } else if (ddat1use) { d = ddat1; ddat1use = 0; - wd = 1; } else { static int warn = 10; if (warn > 0) { diff --git a/blkdev_cdimage.cpp b/blkdev_cdimage.cpp index 823e1630..1c254c92 100644 --- a/blkdev_cdimage.cpp +++ b/blkdev_cdimage.cpp @@ -431,7 +431,7 @@ static void audio_unpack (struct cdunit *cdu, struct cdtoc *t) static volatile int cda_bufon[2]; static cda_audio *cda; -void next_cd_audio_buffer_callback(int bufnum) +static void next_cd_audio_buffer_callback(int bufnum) { uae_sem_wait(&play_sem); if (bufnum >= 0) { diff --git a/bsdsocket.cpp b/bsdsocket.cpp index 0f3282bc..7bb42386 100644 --- a/bsdsocket.cpp +++ b/bsdsocket.cpp @@ -26,7 +26,7 @@ #ifdef BSDSOCKET -int log_bsd; +int log_bsd = 0; struct socketbase *socketbases; static uae_u32 SockLibBase; @@ -169,17 +169,17 @@ bool checksd(TrapContext *context, SB, int sd) if (iCounter != sd) { if (getsock(sb,iCounter) == s) { releasesock(context, sb, sd); - return TRUE; + return true; } } } for (iCounter = 0; iCounter < SOCKPOOLSIZE; iCounter++) { if (s == sockdata->sockpoolsocks[iCounter]) - return TRUE; + return true; } } BSDTRACE((_T("checksd FALSE s 0x%x sd %d\n"),s,sd)); - return FALSE; + return false; } void setsd(TrapContext *context, SB, int sd, SOCKET_TYPE s) diff --git a/catweasel.cpp b/catweasel.cpp index 6a2854df..4dfc5142 100644 --- a/catweasel.cpp +++ b/catweasel.cpp @@ -714,4 +714,4 @@ int catweasel_detect (void) return FALSE; } -#endif \ No newline at end of file +#endif diff --git a/cd32_fmv.cpp b/cd32_fmv.cpp index 8177b35f..64e86ffc 100644 --- a/cd32_fmv.cpp +++ b/cd32_fmv.cpp @@ -1371,7 +1371,7 @@ void cd32_fmv_set_sync(double svpos, double adjust) fmv_syncadjust = adjust; } -void fmv_next_cd_audio_buffer_callback(int bufnum) +static void fmv_next_cd_audio_buffer_callback(int bufnum) { uae_sem_wait(&play_sem); if (bufnum >= 0) { diff --git a/cia.cpp b/cia.cpp index ef15c962..e78c3cde 100644 --- a/cia.cpp +++ b/cia.cpp @@ -2207,7 +2207,6 @@ static uae_u32 REGPARAM2 clock_wget (uaecptr addr) static uae_u32 REGPARAM2 clock_bget (uaecptr addr) { - time_t t; struct tm *ct; uae_u8 v = 0; @@ -2229,7 +2228,7 @@ static uae_u32 REGPARAM2 clock_bget (uaecptr addr) v = regs.irc >> 8; return v; } - t = time (0); + time_t t = time (0); t += currprefs.cs_rtc_adjust; ct = localtime (&t); addr >>= 2; diff --git a/cpuboard.cpp b/cpuboard.cpp index 262dfe4d..690c9703 100644 --- a/cpuboard.cpp +++ b/cpuboard.cpp @@ -946,10 +946,11 @@ static void cyberstorm_maprom(void) { if (a3000hmem_bank.allocated <= 2 * 524288) return; - if (maprom_state && is_ppc()) + if (maprom_state && is_ppc()) { map_banks(&blizzardmaprom2_bank, CYBERSTORM_MAPROM_BASE >> 16, 524288 >> 16, 0); - else + } else { map_banks(&blizzardmaprom_bank, CYBERSTORM_MAPROM_BASE >> 16, 524288 >> 16, 0); + } } static void cyberstormmk2_maprom(void) @@ -1710,7 +1711,7 @@ void cpuboard_init(void) mapped_malloc(&blizzardmaprom_bank); } else if (is_csmk3()) { - + blizzardram_bank.start = CS_RAM_BASE; blizzardram_bank.allocated = cpuboard_size; blizzardram_bank.mask = blizzardram_bank.allocated - 1; diff --git a/cpummu.cpp b/cpummu.cpp index 23c119b5..233d0c75 100644 --- a/cpummu.cpp +++ b/cpummu.cpp @@ -293,7 +293,7 @@ static void mmu_dump_table(const char * label, uaecptr root_ptr) #endif /* {{{ mmu_dump_atc */ -void mmu_dump_atc(void) +static void mmu_dump_atc(void) { } @@ -750,7 +750,7 @@ uae_u32 REGPARAM2 mmu_get_ilong_unaligned(uaecptr addr) return res; } -uae_u16 REGPARAM2 mmu_get_lrmw_word_unaligned(uaecptr addr) +static uae_u16 REGPARAM2 mmu_get_lrmw_word_unaligned(uaecptr addr) { uae_u16 res; @@ -768,7 +768,7 @@ uae_u16 REGPARAM2 mmu_get_lrmw_word_unaligned(uaecptr addr) return res; } -uae_u32 REGPARAM2 mmu_get_lrmw_long_unaligned(uaecptr addr) +static uae_u32 REGPARAM2 mmu_get_lrmw_long_unaligned(uaecptr addr) { uae_u32 res; diff --git a/cpummu30.cpp b/cpummu30.cpp index eb5d1e99..ac2a9519 100644 --- a/cpummu30.cpp +++ b/cpummu30.cpp @@ -1700,7 +1700,8 @@ uae_u32 mmu030_get_long_atc(uaecptr addr, int l, uae_u32 fc) { return phys_get_long(physical_addr); } -uae_u32 mmu030_get_ilong_atc(uaecptr addr, int l, uae_u32 fc) { + +static uae_u32 mmu030_get_ilong_atc(uaecptr addr, int l, uae_u32 fc) { uae_u32 page_index = addr & mmu030.translation.page.mask; uae_u32 addr_mask = mmu030.translation.page.imask; @@ -1738,7 +1739,7 @@ uae_u16 mmu030_get_word_atc(uaecptr addr, int l, uae_u32 fc) { return phys_get_word(physical_addr); } -uae_u16 mmu030_get_iword_atc(uaecptr addr, int l, uae_u32 fc) { +static uae_u16 mmu030_get_iword_atc(uaecptr addr, int l, uae_u32 fc) { uae_u32 page_index = addr & mmu030.translation.page.mask; uae_u32 addr_mask = mmu030.translation.page.imask; @@ -1800,6 +1801,7 @@ void mmu030_put_atc_generic(uaecptr addr, uae_u32 val, int l, uae_u32 fc, int si phys_put_long(physical_addr, val); } + uae_u32 mmu030_get_atc_generic(uaecptr addr, int l, uae_u32 fc, int size, int flags, bool checkwrite) { uae_u32 page_index = addr & mmu030.translation.page.mask; uae_u32 addr_mask = mmu030.translation.page.imask; @@ -2026,7 +2028,6 @@ uae_u8 mmu030_get_byte(uaecptr addr, uae_u32 fc) { } } - /* Not commonly used access function */ void mmu030_put_generic(uaecptr addr, uae_u32 val, uae_u32 fc, int size, int accesssize, int flags) { diff --git a/crc32.cpp b/crc32.cpp index 29cd3769..200da20b 100644 --- a/crc32.cpp +++ b/crc32.cpp @@ -355,4 +355,4 @@ const TCHAR *get_sha1_txt (void *vinput, int len) } *p = 0; return outtxt; -} \ No newline at end of file +} diff --git a/diskutil.cpp b/diskutil.cpp index b96eaa9e..47ba93ad 100644 --- a/diskutil.cpp +++ b/diskutil.cpp @@ -2,6 +2,7 @@ #include "sysdeps.h" #include "crc32.h" +#include "diskutil.h" #define MFMMASK 0x55555555 static uae_u32 getmfmlong (uae_u16 * mbuf) diff --git a/dongle.cpp b/dongle.cpp index 061d53f7..1024e602 100644 --- a/dongle.cpp +++ b/dongle.cpp @@ -12,6 +12,7 @@ #include "sysdeps.h" #include "options.h" +#include "dongle.h" #include "events.h" #include "uae.h" diff --git a/drawing.cpp b/drawing.cpp index 73b10072..29746ad2 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -308,7 +308,7 @@ static void clearbuffer (struct vidbuffer *dst) } } -void reset_decision_table (void) +static void reset_decision_table (void) { for (int i = 0; i < sizeof linestate / sizeof *linestate; i++) { linestate[i] = LINE_UNDECIDED; @@ -1039,11 +1039,11 @@ STATIC_INLINE void fill_line_16 (uae_u8 *buf, int start, int stop, bool blank) unsigned int i; unsigned int rem = 0; xcolnr col = getbgc (blank); - if (((long)&b[start]) & 1) + if (((uintptr_t)&b[start]) & 1) b[start++] = (uae_u16) col; if (start >= stop) return; - if (((long)&b[stop]) & 1) { + if (((uintptr_t)&b[stop]) & 1) { rem++; stop--; } @@ -2371,7 +2371,7 @@ void init_row_map (void) oldgenlock = init_genlock_data; } -void init_aspect_maps (void) +static void init_aspect_maps (void) { int i, maxl, h; diff --git a/enforcer.cpp b/enforcer.cpp index f61da4ca..3da1d5c6 100644 --- a/enforcer.cpp +++ b/enforcer.cpp @@ -20,6 +20,8 @@ #include "enforcer.h" #include "debug.h" +int enforcermode = 0; + #ifdef AHI #if defined(JIT) @@ -46,7 +48,6 @@ extern uae_u8 *natmem_offset; static int enforcer_installed = 0; -int enforcermode = 0; static int enforcer_hit = 0; /* set to 1 if displaying the hit */ #define ENFORCER_BUF_SIZE 8192 @@ -422,7 +423,7 @@ end: enforcer_hit = 0; } -uae_u32 REGPARAM2 chipmem_lget2 (uaecptr addr) +static uae_u32 REGPARAM2 chipmem_lget2 (uaecptr addr) { uae_u32 *m; @@ -439,7 +440,7 @@ uae_u32 REGPARAM2 chipmem_lget2 (uaecptr addr) return do_get_mem_long (m); } -uae_u32 REGPARAM2 chipmem_wget2(uaecptr addr) +static uae_u32 REGPARAM2 chipmem_wget2(uaecptr addr) { uae_u16 *m; @@ -456,7 +457,7 @@ uae_u32 REGPARAM2 chipmem_wget2(uaecptr addr) return do_get_mem_word (m); } -uae_u32 REGPARAM2 chipmem_bget2 (uaecptr addr) +static uae_u32 REGPARAM2 chipmem_bget2 (uaecptr addr) { addr -= chipmem_start_addr & chipmem_bank.mask; addr &= chipmem_bank.mask; @@ -471,7 +472,7 @@ uae_u32 REGPARAM2 chipmem_bget2 (uaecptr addr) return chipmem_bank.baseaddr[addr]; } -void REGPARAM2 chipmem_lput2 (uaecptr addr, uae_u32 l) +static void REGPARAM2 chipmem_lput2 (uaecptr addr, uae_u32 l) { uae_u32 *m; @@ -491,7 +492,7 @@ void REGPARAM2 chipmem_lput2 (uaecptr addr, uae_u32 l) do_put_mem_long (m, l); } -void REGPARAM2 chipmem_wput2 (uaecptr addr, uae_u32 w) +static void REGPARAM2 chipmem_wput2 (uaecptr addr, uae_u32 w) { uae_u16 *m; @@ -510,7 +511,7 @@ void REGPARAM2 chipmem_wput2 (uaecptr addr, uae_u32 w) do_put_mem_word (m, w); } -void REGPARAM2 chipmem_bput2 (uaecptr addr, uae_u32 b) +static void REGPARAM2 chipmem_bput2 (uaecptr addr, uae_u32 b) { addr -= chipmem_start_addr & chipmem_bank.mask; addr &= chipmem_bank.mask; @@ -526,21 +527,21 @@ void REGPARAM2 chipmem_bput2 (uaecptr addr, uae_u32 b) chipmem_bank.baseaddr[addr] = b; } -int REGPARAM2 chipmem_check2 (uaecptr addr, uae_u32 size) +static int REGPARAM2 chipmem_check2 (uaecptr addr, uae_u32 size) { addr -= chipmem_start_addr & chipmem_bank.mask; addr &= chipmem_bank.mask; return (addr + size) <= chipmem_bank.allocated; } -uae_u8 * REGPARAM2 chipmem_xlate2 (uaecptr addr) +static uae_u8 * REGPARAM2 chipmem_xlate2 (uaecptr addr) { addr -= chipmem_start_addr & chipmem_bank.mask; addr &= chipmem_bank.mask; return chipmem_bank.baseaddr + addr; } -uae_u32 REGPARAM2 dummy_lget2 (uaecptr addr) +static uae_u32 REGPARAM2 dummy_lget2 (uaecptr addr) { special_mem_r; enforcer_display_hit (_T("LONG READ from"), m68k_getpc (), addr); @@ -555,7 +556,7 @@ uae_u32 REGPARAM2 dummy_lget2 (uaecptr addr) static int warned_JIT_0xF10000 = 0; #endif -uae_u32 REGPARAM2 dummy_wget2 (uaecptr addr) +static uae_u32 REGPARAM2 dummy_wget2 (uaecptr addr) { special_mem_r; @@ -576,7 +577,7 @@ uae_u32 REGPARAM2 dummy_wget2 (uaecptr addr) return 0xbadf; } -uae_u32 REGPARAM2 dummy_bget2 (uaecptr addr) +static uae_u32 REGPARAM2 dummy_bget2 (uaecptr addr) { special_mem_r; enforcer_display_hit (_T("BYTE READ from"), m68k_getpc (), addr); @@ -587,7 +588,7 @@ uae_u32 REGPARAM2 dummy_bget2 (uaecptr addr) return 0xbadedeef; } -void REGPARAM2 dummy_lput2 (uaecptr addr, uae_u32 l) +static void REGPARAM2 dummy_lput2 (uaecptr addr, uae_u32 l) { special_mem_w; enforcer_display_hit (_T("LONG WRITE to"), m68k_getpc (), addr); @@ -597,7 +598,7 @@ void REGPARAM2 dummy_lput2 (uaecptr addr, uae_u32 l) } } -void REGPARAM2 dummy_wput2 (uaecptr addr, uae_u32 w) +static void REGPARAM2 dummy_wput2 (uaecptr addr, uae_u32 w) { special_mem_w; enforcer_display_hit (_T("WORD WRITE to"), m68k_getpc (), addr); @@ -607,7 +608,7 @@ void REGPARAM2 dummy_wput2 (uaecptr addr, uae_u32 w) } } -void REGPARAM2 dummy_bput2 (uaecptr addr, uae_u32 b) +static void REGPARAM2 dummy_bput2 (uaecptr addr, uae_u32 b) { special_mem_w; enforcer_display_hit (_T("BYTE WRITE to"), m68k_getpc (), addr); @@ -617,7 +618,7 @@ void REGPARAM2 dummy_bput2 (uaecptr addr, uae_u32 b) } } -int REGPARAM2 dummy_check2 (uaecptr addr, uae_u32 size) +static int REGPARAM2 dummy_check2 (uaecptr addr, uae_u32 size) { special_mem_r; enforcer_display_hit (_T("CHECK from "), m68k_getpc (), addr); diff --git a/fake86_cpu.cpp b/fake86_cpu.cpp index 7074be56..717b7c59 100644 --- a/fake86_cpu.cpp +++ b/fake86_cpu.cpp @@ -126,7 +126,7 @@ extern uint16_t VGA_SC[0x100], VGA_CRTC[0x100], VGA_ATTR[0x100], VGA_GC[0x100]; extern uint8_t updatedscreen; #endif -union _bytewordregs_ regs; +static union _bytewordregs_ regs; #if 0 uint8_t portram[0x10000]; diff --git a/fpp.cpp b/fpp.cpp index 715570be..36870322 100644 --- a/fpp.cpp +++ b/fpp.cpp @@ -33,7 +33,7 @@ #include "cpummu030.h" #include "debug.h" -#ifdef WITH_SOFTFLOAT +#ifdef WITH_SOFTFLOAT #include "softfloatx80.h" #endif @@ -566,20 +566,20 @@ static void native_set_fpucw (uae_u32 m68k_cw) __asm { fldcw word ptr x87_cw } -#elif defined(X86_ASSEMBLY) +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) __asm__ ("fldcw %0" : : "m" (*&x87_cw)); +#else + #warning floating point control not specified #endif +#endif /* USE_X86_FPUCW */ #endif -#endif +#else +#warning NATIVE_FPUCW not enabled #endif } } -#if defined(uae_s64) /* Close enough for government work? */ typedef uae_s64 tointtype; -#else -typedef uae_s32 tointtype; -#endif static void fpu_format_error (void) { @@ -945,7 +945,7 @@ static tointtype toint(fpdata *src, int size) #ifdef WITH_SOFTFLOAT if (currprefs.fpu_softfloat) { if (floatx80_compare(src->fpx, fxsizes[size * 2 + 0], fxstatus) == float_relation_greater) - return floatx80_to_int32(fxsizes[size * 2 + 0], fxstatus); + return floatx80_to_int32(fxsizes[size * 2 + 0], fxstatus); if (floatx80_compare(src->fpx, fxsizes[size * 2 + 1], fxstatus) == float_relation_less) return floatx80_to_int32(fxsizes[size * 2 + 1], fxstatus); return floatx80_to_int32(src->fpx, fxstatus); @@ -1022,7 +1022,7 @@ static bool fp_is_infinity (fpdata *fpd) #ifdef _MSC_VER return !_finite (fpd->fp); #elif defined(HAVE_ISINF) - return _isinf (fpd->fp); + return isinf(fpd->fp); #else return false; #endif @@ -1063,7 +1063,7 @@ uae_u32 fpp_get_fpsr (void) if (answer & (1 << 10)) answer |= 0x10; // DZ = DZ if (answer & ((1 << 12) | (1 << 9) | (1 << 8))) - answer |= 0x08; // INEX = INEX1 | INEX2 | OVFL + answer |= 0x08; // INEX = INEX1 | INEX2 | OVFL regs.fpsr = answer; diff --git a/fsusage.cpp b/fsusage.cpp index 181272ec..73af6458 100644 --- a/fsusage.cpp +++ b/fsusage.cpp @@ -136,7 +136,7 @@ int statvfs (); Return the actual number of bytes read, zero for EOF, or negative for an error. */ -int safe_read (int desc, TCHAR *ptr, int len) +static int safe_read (int desc, TCHAR *ptr, int len) { int n_chars; diff --git a/genlinetoscr.cpp b/genlinetoscr.cpp index e997dfb3..05695b4f 100644 --- a/genlinetoscr.cpp +++ b/genlinetoscr.cpp @@ -86,39 +86,39 @@ typedef enum static FILE *outfile; static unsigned int outfile_indent = 0; -void set_outfile (FILE *f) +static void set_outfile (FILE *f) { outfile = f; } -int set_indent (int indent) +static int set_indent (int indent) { int old_indent = outfile_indent; outfile_indent = indent; return old_indent; } -void outindent(void) +static void outindent(void) { unsigned int i; for (i = 0; i < outfile_indent; i++) fputc(' ', outfile); } -void outf(const char *s, ...) +static void outf(const char *s, ...) { va_list ap; va_start(ap, s); vfprintf(outfile, s, ap); } -void outln (const char *s) +static void outln (const char *s) { outindent(); fprintf (outfile, "%s\n", s); } -void outlnf (const char *s, ...) +static void outlnf (const char *s, ...) { va_list ap; outindent(); @@ -378,7 +378,7 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CM if (bpp == DEPTH_16BPP && hmode != HMODE_DOUBLE && hmode != HMODE_DOUBLE2X && spr == 0) { outln ( "int rem;"); - outln ( "if (((long)&buf[dpix]) & 2) {"); + outln ( "if (((uintptr_t)&buf[dpix]) & 2) {"); outln ( " uae_u32 spix_val;"); outln ( " uae_u32 dpix_val;"); @@ -390,7 +390,7 @@ static void out_linetoscr_mode (DEPTH_T bpp, HMODE_T hmode, int aga, int spr, CM outln ( "}"); outln ( "if (dpix >= dpix_end)"); outln ( " return spix;"); - outln ( "rem = (((long)&buf[dpix_end]) & 2);"); + outln ( "rem = (((uintptr_t)&buf[dpix_end]) & 2);"); outln ( "if (rem)"); outln ( " dpix_end--;"); } diff --git a/include/scsi.h b/include/scsi.h index d7f28e1c..d525097f 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -2,6 +2,7 @@ #define UAE_SCSI_H #include "uae/types.h" +#include "memory.h" #define SCSI_DEFAULT_DATA_BUFFER_SIZE (256 * 512) diff --git a/include/uae/endian.h b/include/uae/endian.h new file mode 100644 index 00000000..54205261 --- /dev/null +++ b/include/uae/endian.h @@ -0,0 +1,70 @@ +#ifndef UAE_ENDIAN_H +#define UAE_ENDIAN_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "uae/types.h" + +#ifdef _WIN32 + +/* Use custom conversion routines for Windows */ +#ifdef WORDS_BIGENDIAN +#error big-endian windows not supported here +#endif + +#ifndef be16toh +static inline uint16_t be16toh_impl(uint16_t v) +{ + return (v << 8) | (v >> 8); +} +#define be16toh be16toh_impl +#endif + +#ifndef le16toh +static inline uint16_t le16toh_impl(uint16_t v) +{ + return v; +} +#define le16toh le16toh_impl +#endif + +#ifndef le32toh +static inline uint32_t le32toh_impl(uint32_t v) +{ + return v; +} +#define le32toh le32toh_impl +#endif + +#elif defined(HAVE_LIBKERN_OSBYTEORDER_H) + +/* OS X lacks endian.h, but has something similar */ +#include +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) + +#elif defined(HAVE_ENDIAN_H) + +/* Linux has endian.h */ +#include + +#elif defined(HAVE_SYS_ENDIAN_H) + +/* BSD's generally have sys/endian.h */ +#include + +#endif + +#endif /* UAE_ENDIAN_H */ diff --git a/include/uae/seh.h b/include/uae/seh.h new file mode 100644 index 00000000..37de7c6f --- /dev/null +++ b/include/uae/seh.h @@ -0,0 +1,28 @@ +/* + * Structured exception handling + * Copyright (C) 2014 Frode Solheim + * + * Licensed under the terms of the GNU General Public License version 2. + * See the file 'COPYING' for full license text. + */ + +#ifndef UAE_SEH_H +#define UAE_SEH_H + +#ifdef _MSC_VER + +/* Structured exception handling is available */ + +#else + +/* MinGW defines __try / __except */ +#undef __try +#undef __except + +/* Structured exception handling is not available - do nothing */ +#define __try +#define __except(x) + +#endif + +#endif /* UAE_SEH_H */ diff --git a/inputrecord.cpp b/inputrecord.cpp index 06fb769c..eddb639e 100644 --- a/inputrecord.cpp +++ b/inputrecord.cpp @@ -25,6 +25,7 @@ #include "uae.h" #include "disk.h" #include "fsdb.h" +#include "xwin.h" #if INPUTRECORD_DEBUG > 0 #include "memory.h" @@ -56,8 +57,6 @@ static uae_u32 pcs2[16]; extern void activate_debugger (void); static int warned; -extern void refreshtitle (void); - static void setlasthsync (void) { if (lasthsync / current_maxvpos () != hsync_counter / current_maxvpos ()) { diff --git a/mame/mameglue.h b/mame/mameglue.h index 6d47a19d..96621e2f 100644 --- a/mame/mameglue.h +++ b/mame/mameglue.h @@ -1,4 +1,4 @@ - +#include "uae/types.h" #include "sysconfig.h" #include "sysdeps.h" @@ -41,6 +41,7 @@ inline UINT64 mulu_32x32(UINT32 a, UINT32 b) { return (UINT64)a * (UINT64)b; } + #define NULL 0 class direct_read_data diff --git a/ncr_scsi.cpp b/ncr_scsi.cpp index d7553c0b..6041ae3d 100644 --- a/ncr_scsi.cpp +++ b/ncr_scsi.cpp @@ -162,9 +162,6 @@ static struct ncr_state *ncr_a4000t; static struct ncr_state *ncra4091[MAX_DUPLICATE_EXPANSION_BOARDS]; static struct ncr_state *ncr_wildfire; -extern void cyberstorm_mk3_ppc_irq(int); -extern void blizzardppc_irq(int); - static void set_irq2(int level) { if (level) @@ -390,11 +387,13 @@ static void ncr_io_bput(struct ncr_state *ncr, uaecptr addr, uae_u32 val) addr &= IO_MASK; lsi_mmio_write(ncr->devobject.lsistate, beswap(addr), val, 1); } + static void ncr710_io_bput(struct ncr_state *ncr, uaecptr addr, uae_u32 val) { addr &= IO_MASK; lsi710_mmio_write(ncr->devobject.lsistate, beswap(addr), val, 1); } + void cpuboard_ncr710_io_bput(uaecptr addr, uae_u32 v) { ncr710_io_bput(ncr_cpuboard, addr, v); @@ -419,11 +418,13 @@ static uae_u32 ncr_io_bget(struct ncr_state *ncr, uaecptr addr) addr &= IO_MASK; return 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); } + uae_u32 cpuboard_ncr710_io_bget(uaecptr addr) { return ncr710_io_bget(ncr_cpuboard, addr); diff --git a/newcpu.cpp b/newcpu.cpp index a65ae5b8..2f035ddc 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -43,6 +43,7 @@ #include "cpuboard.h" #include "threaddep/thread.h" #include "x86.h" +#include "bsdsocket.h" #ifdef JIT #include "jit/compemu.h" #include @@ -1910,7 +1911,7 @@ void REGPARAM2 MakeSR (void) | GET_CFLG ()); } -void SetSR (uae_u16 sr) +static void SetSR (uae_u16 sr) { regs.sr &= 0xff00; regs.sr |= sr; @@ -3644,8 +3645,6 @@ static int do_specialties (int cycles) isstopped: check_uae_int_request(); { - extern void bsdsock_fake_int_handler (void); - extern int volatile bsd_int_requested; if (bsd_int_requested) bsdsock_fake_int_handler (); } diff --git a/od-win32/bsdsock.cpp b/od-win32/bsdsock.cpp index 69516842..f39d3015 100644 --- a/od-win32/bsdsock.cpp +++ b/od-win32/bsdsock.cpp @@ -24,6 +24,7 @@ #include "options.h" #include "memory.h" +#include "uae/seh.h" #include "custom.h" #include "events.h" #include "newcpu.h" @@ -117,8 +118,6 @@ extern HWND hAmigaWnd; static LRESULT CALLBACK SocketWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); -static int PASCAL WSAEventSelect(SOCKET,HANDLE,long); - #define PREPARE_THREAD EnterCriticalSection(&bsd->SockThreadCS) #define TRIGGER_THREAD { SetEvent(bsd->hSockReq); WaitForSingleObject(bsd->hSockReqHandled, INFINITE); LeaveCriticalSection(&bsd->SockThreadCS); } @@ -515,7 +514,7 @@ void sockabort(SB) unlocksigqueue(); } -void setWSAAsyncSelect(SB, uae_u32 sd, SOCKET s, long lEvent ) +static void setWSAAsyncSelect(SB, uae_u32 sd, SOCKET s, long lEvent ) { if (sb->mtable[sd - 1]) { long wsbevents = 0; @@ -1654,7 +1653,7 @@ int host_CloseSocket(TrapContext *context, SB, int sd) sb->mtable[sd-1] = 0; } - if (checksd(context, sb ,sd) == TRUE) + if (checksd(context, sb ,sd) == true) return 0; BEGINBLOCKING; diff --git a/od-win32/caps/CapsAPI.h b/od-win32/caps/CapsAPI.h index 0d5bc9d6..562e789c 100644 --- a/od-win32/caps/CapsAPI.h +++ b/od-win32/caps/CapsAPI.h @@ -90,7 +90,7 @@ struct CapsTrackInfo { UDWORD sectorcnt; // available sectors UDWORD sectorsize; // sector size UDWORD trackcnt; // track variant count - PUBYTE trackbuf; // track buffer memory + PUBYTE trackbuf; // track buffer memory UDWORD tracklen; // track buffer memory length PUBYTE trackdata[CAPS_MTRS]; // track data pointer if available UDWORD tracksize[CAPS_MTRS]; // track data size @@ -107,7 +107,7 @@ struct CapsTrackInfoT1 { UDWORD head; // head# UDWORD sectorcnt; // available sectors UDWORD sectorsize; // sector size - PUBYTE trackbuf; // track buffer memory + PUBYTE trackbuf; // track buffer memory UDWORD tracklen; // track buffer memory length UDWORD timelen; // timing buffer length PUDWORD timebuf; // timing buffer @@ -123,7 +123,7 @@ struct CapsTrackInfoT2 { UDWORD head; // head# UDWORD sectorcnt; // available sectors UDWORD sectorsize; // sector size, unused - PUBYTE trackbuf; // track buffer memory + PUBYTE trackbuf; // track buffer memory UDWORD tracklen; // track buffer memory length UDWORD timelen; // timing buffer length PUDWORD timebuf; // timing buffer diff --git a/od-win32/caps/Comtype.h b/od-win32/caps/Comtype.h index 56bc0251..f55b235a 100644 --- a/od-win32/caps/Comtype.h +++ b/od-win32/caps/Comtype.h @@ -4,14 +4,14 @@ typedef void *PVOID; typedef char *PCHAR; -typedef unsigned char UBYTE; -typedef unsigned short UWORD; -typedef unsigned long UDWORD; -typedef unsigned __int64 UQUAD; -typedef signed char SBYTE; -typedef signed short SWORD; -typedef signed long SDWORD; -typedef signed __int64 SQUAD; +typedef uae_u8 UBYTE; +typedef uae_u16 UWORD; +typedef uae_u32 UDWORD; +typedef uae_u64 UQUAD; +typedef uae_s8 SBYTE; +typedef uae_s16 SWORD; +typedef uae_s32 SDWORD; +typedef uae_s64 SQUAD; typedef UBYTE *PUBYTE; typedef UWORD *PUWORD; diff --git a/od-win32/cda_play.cpp b/od-win32/cda_play.cpp index 7291194a..5ddea5d1 100644 --- a/od-win32/cda_play.cpp +++ b/od-win32/cda_play.cpp @@ -153,7 +153,7 @@ cda_audio::cda_audio(int num_sectors, int sectorsize, int samplerate) } this->num_sectors = num_sectors; for (int i = 0; i < 2; i++) { - memset (&whdr[i], 0, sizeof WAVEHDR); + memset (&whdr[i], 0, sizeof(WAVEHDR)); whdr[i].dwBufferLength = sectorsize * num_sectors; whdr[i].lpData = (LPSTR)buffers[i]; mmr = waveOutPrepareHeader (wavehandle, &whdr[i], sizeof (WAVEHDR)); diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index ca4cfb25..a51d54d1 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -402,12 +402,12 @@ static bool test_rawinput (int usage) rid.usUsagePage = 1; rid.usUsage = usage; - if (RegisterRawInputDevices (&rid, 1, sizeof RAWINPUTDEVICE) == FALSE) { + if (RegisterRawInputDevices (&rid, 1, sizeof(RAWINPUTDEVICE)) == FALSE) { write_log (_T("RAWINPUT test failed, usage=%d ERR=%d\n"), usage, GetLastError ()); return false; } rid.dwFlags |= RIDEV_REMOVE; - if (RegisterRawInputDevices (&rid, 1, sizeof RAWINPUTDEVICE) == FALSE) { + if (RegisterRawInputDevices (&rid, 1, sizeof(RAWINPUTDEVICE)) == FALSE) { write_log (_T("RAWINPUT test failed (release), usage=%d, ERR=%d\n"), usage, GetLastError ()); return false; } @@ -501,7 +501,7 @@ static int doregister_rawinput (void) if (!add) rawinput_reg = -rawinput_reg; //write_log (_T("+++++++++++++++++++++++++++%x\n"), hMainWnd); - if (RegisterRawInputDevices (rid, num, sizeof RAWINPUTDEVICE) == FALSE) { + if (RegisterRawInputDevices (rid, num, sizeof(RAWINPUTDEVICE)) == FALSE) { write_log (_T("RAWINPUT %sregistration failed %d\n"), add ? _T("") : _T("un"), GetLastError ()); return 0; @@ -1118,7 +1118,7 @@ static void rawinputfriendlynames (void) for (i = 0; SetupDiEnumDeviceInfo (di, i, &dd); i++) { TCHAR devpath[MAX_DPATH]; DWORD size = 0; - if (SetupDiGetDeviceInstanceId (di, &dd, devpath, sizeof devpath / sizeof TCHAR , &size)) { + if (SetupDiGetDeviceInstanceId (di, &dd, devpath, sizeof devpath / sizeof(TCHAR), &size)) { DEVINST devinst = dd.DevInst; TCHAR *cg = outGUID (&guid[ii]); @@ -1127,15 +1127,15 @@ static void rawinputfriendlynames (void) ULONG size2; TCHAR bufguid[MAX_DPATH]; - size2 = sizeof bufguid / sizeof TCHAR; + size2 = sizeof bufguid / sizeof(TCHAR); if (CM_Get_DevNode_Registry_Property (devinst, CM_DRP_CLASSGUID, NULL, bufguid, &size2, 0) != CR_SUCCESS) break; if (_tcsicmp (cg, bufguid)) break; - size2 = sizeof devname / sizeof TCHAR; + size2 = sizeof devname / sizeof(TCHAR); if (CM_Get_DevNode_Registry_Property (devinst, CM_DRP_FRIENDLYNAME, NULL, devname, &size2, 0) != CR_SUCCESS) { - ULONG size2 = sizeof devname / sizeof TCHAR; + ULONG size2 = sizeof devname / sizeof(TCHAR); if (CM_Get_DevNode_Registry_Property (devinst, CM_DRP_DEVICEDESC, NULL, devname, &size2, 0) != CR_SUCCESS) devname[0] = 0; } @@ -1818,7 +1818,7 @@ static bool initialize_rawinput (void) did->axisname[axiscnt] = my_strdup (tmp); did->axissort[axiscnt] = hidtable[ht].priority * 2 + l; did->axismappings[axiscnt] = acnt; - memcpy (&did->hidvcaps[axiscnt], &vcaps[i], sizeof HIDP_VALUE_CAPS); + memcpy (&did->hidvcaps[axiscnt], &vcaps[i], sizeof(HIDP_VALUE_CAPS)); did->axistype[axiscnt] = l + 1; axiscnt++; } @@ -1827,7 +1827,7 @@ static bool initialize_rawinput (void) did->axissort[axiscnt] = hidtable[ht].priority * 2; did->axisname[axiscnt] = my_strdup (hidtable[ht].name); did->axismappings[axiscnt] = acnt; - memcpy (&did->hidvcaps[axiscnt], &vcaps[i], sizeof HIDP_VALUE_CAPS); + memcpy (&did->hidvcaps[axiscnt], &vcaps[i], sizeof(HIDP_VALUE_CAPS)); fixhidvcaps (&rdi->hid, &did->hidvcaps[axiscnt]); did->axistype[axiscnt] = hidtable[ht].type; axiscnt++; @@ -2120,8 +2120,8 @@ static void handle_rawinput_2 (RAWINPUT *raw) } } } - memcpy (did->prevusagelist, did->usagelist, usagelength * sizeof USAGE_AND_PAGE); - memset (did->prevusagelist + usagelength, 0, (did->maxusagelistlength - usagelength) * sizeof USAGE_AND_PAGE); + memcpy (did->prevusagelist, did->usagelist, usagelength * sizeof(USAGE_AND_PAGE)); + memset (did->prevusagelist + usagelength, 0, (did->maxusagelistlength - usagelength) * sizeof(USAGE_AND_PAGE)); for (int axisnum = 0; axisnum < did->axles; axisnum++) { ULONG val; int usage = did->axismappings[axisnum]; @@ -3670,8 +3670,8 @@ static void read_joystick (void) write_log (_T("%d/%d OFF\n"), did->prevusagelist[j].UsagePage, did->prevusagelist[j].Usage); } } - memcpy (did->prevusagelist, did->usagelist, usagelength * sizeof USAGE_AND_PAGE); - memset (did->prevusagelist + usagelength, 0, (did->maxusagelistlength - usagelength) * sizeof USAGE_AND_PAGE); + memcpy (did->prevusagelist, did->usagelist, usagelength * sizeof(USAGE_AND_PAGE)); + memset (did->prevusagelist + usagelength, 0, (did->maxusagelistlength - usagelength) * sizeof(USAGE_AND_PAGE)); } } } diff --git a/od-win32/dxwrap.h b/od-win32/dxwrap.h index e9e59d84..08cdcabd 100644 --- a/od-win32/dxwrap.h +++ b/od-win32/dxwrap.h @@ -144,4 +144,3 @@ int dx_islost (void); #define DDFORCED_SYSMEM 3 #endif - diff --git a/od-win32/keyboard_win32.cpp b/od-win32/keyboard_win32.cpp index 1c8360b1..9e1fdf79 100644 --- a/od-win32/keyboard_win32.cpp +++ b/od-win32/keyboard_win32.cpp @@ -43,6 +43,11 @@ //#define DBG_KEYBD 1 //#define DEBUG_KBD +#ifndef DIK_PREVTRACK +/* Not defined by MinGW */ +#define DIK_PREVTRACK 0x90 +#endif + static struct uae_input_device_kbr_default keytrans_amiga[] = { { DIK_ESCAPE, INPUTEVENT_KEY_ESC }, diff --git a/od-win32/md-fpp.h b/od-win32/md-fpp.h index d7cb7885..45058c0e 100644 --- a/od-win32/md-fpp.h +++ b/od-win32/md-fpp.h @@ -9,6 +9,8 @@ * Modified 2005 Peter Keunecke */ +#include + #define FPCR_ROUNDING_MODE 0x00000030 #define FPCR_ROUND_NEAR 0x00000000 #define FPCR_ROUND_ZERO 0x00000010 @@ -174,8 +176,13 @@ STATIC_INLINE double to_double_x(uae_u32 wrd1, uae_u32 wrd2) uae_u32 u[2]; } val; - val.u[0] = wrd2; // little endian +#ifdef WORDS_BIGENDIAN + val.u[0] = wrd1; + val.u[1] = wrd2; +#else val.u[1] = wrd1; + val.u[0] = wrd2; +#endif return val.d; } #endif diff --git a/od-win32/parser.h b/od-win32/parser.h index 76ab8c62..838a38ad 100644 --- a/od-win32/parser.h +++ b/od-win32/parser.h @@ -23,6 +23,8 @@ void flushprinter (void); int checkserwrite (int spaceneeded); void serialuartbreak (int); +void hsyncstuff(void); + void shmem_serial_delete(void); bool shmem_serial_create(void); int shmem_serial_state(void); @@ -42,8 +44,8 @@ extern int load_ghostscript (void); #define MAX_MIDI_PORTS 100 struct midiportinfo { - TCHAR *name; - UINT devid; + TCHAR *name; + unsigned int devid; }; extern struct midiportinfo *midiinportinfo[MAX_MIDI_PORTS]; extern struct midiportinfo *midioutportinfo[MAX_MIDI_PORTS]; diff --git a/od-win32/registry.h b/od-win32/registry.h index d00978fe..cfd3b4ca 100644 --- a/od-win32/registry.h +++ b/od-win32/registry.h @@ -1,5 +1,4 @@ - typedef struct UAEREG { HKEY fkey; TCHAR *inipath; diff --git a/od-win32/screenshot.cpp b/od-win32/screenshot.cpp index 9ae8d546..3e4f7927 100644 --- a/od-win32/screenshot.cpp +++ b/od-win32/screenshot.cpp @@ -312,7 +312,7 @@ int screenshot_prepare (void) void Screenshot_RGBinfo (int rb, int gb, int bb, int rs, int gs, int bs) { if (!bi) - bi = xcalloc (BITMAPINFO, sizeof BITMAPINFO + 256 * sizeof RGBQUAD); + bi = xcalloc (BITMAPINFO, sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)); rgb_rb = rb; rgb_gb = gb; rgb_bb = rb; @@ -389,16 +389,16 @@ static int savebmp (FILE *fp) BITMAPFILEHEADER bfh; // write the file header, bitmap information and pixel data bfh.bfType = 19778; - bfh.bfSize = sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER) + (bi->bmiHeader.biClrUsed * sizeof RGBQUAD) + bi->bmiHeader.biSizeImage; + bfh.bfSize = sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER) + (bi->bmiHeader.biClrUsed * sizeof(RGBQUAD)) + bi->bmiHeader.biSizeImage; bfh.bfReserved1 = 0; bfh.bfReserved2 = 0; - bfh.bfOffBits = sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER) + bi->bmiHeader.biClrUsed * sizeof RGBQUAD; + bfh.bfOffBits = sizeof (BITMAPFILEHEADER) + sizeof (BITMAPINFOHEADER) + bi->bmiHeader.biClrUsed * sizeof(RGBQUAD); if (fwrite (&bfh, 1, sizeof (BITMAPFILEHEADER), fp) < sizeof (BITMAPFILEHEADER)) return 0; // failed to write bitmap file header if (fwrite (bi, 1, sizeof (BITMAPINFOHEADER), fp) < sizeof (BITMAPINFOHEADER)) return 0; // failed to write bitmap infomation header if (bi->bmiHeader.biClrUsed) { - if (fwrite (bi->bmiColors, 1, bi->bmiHeader.biClrUsed * sizeof RGBQUAD, fp) < bi->bmiHeader.biClrUsed * sizeof RGBQUAD) + if (fwrite (bi->bmiColors, 1, bi->bmiHeader.biClrUsed * sizeof(RGBQUAD), fp) < bi->bmiHeader.biClrUsed * sizeof(RGBQUAD)) return 0; // failed to write bitmap file header } if (fwrite (lpvBits, 1, bi->bmiHeader.biSizeImage, fp) < bi->bmiHeader.biSizeImage) diff --git a/od-win32/sounddep/sound.cpp b/od-win32/sounddep/sound.cpp index 9a75c2a8..d9ca02ab 100644 --- a/od-win32/sounddep/sound.cpp +++ b/od-win32/sounddep/sound.cpp @@ -175,7 +175,6 @@ float scaled_sample_evtime_orig; extern float sampler_evtime; void update_sound (double clk) - { if (!have_sound) return; diff --git a/od-win32/sounddep/sound.h b/od-win32/sounddep/sound.h index e0f508de..f62ae1f5 100644 --- a/od-win32/sounddep/sound.h +++ b/od-win32/sounddep/sound.h @@ -155,4 +155,4 @@ extern int sounddrivermask; #define SOUNDDRIVER_WASAPI 2 #define SOUNDDRIVER_OPENAL 4 #define SOUNDDRIVER_PORTAUDIO 8 -#define SOUNDDRIVE_XAUDIO2 16 \ No newline at end of file +#define SOUNDDRIVE_XAUDIO2 16 diff --git a/od-win32/threaddep/thread.h b/od-win32/threaddep/thread.h index 11428971..06a26247 100644 --- a/od-win32/threaddep/thread.h +++ b/od-win32/threaddep/thread.h @@ -1,4 +1,3 @@ - typedef HANDLE uae_sem_t; typedef HANDLE uae_thread_id; diff --git a/p96_blit.cpp b/p96_blit.cpp index d6d43c85..a4747967 100644 --- a/p96_blit.cpp +++ b/p96_blit.cpp @@ -138,4 +138,4 @@ static void NOINLINE BLT_NAME (unsigned int w, unsigned int h, uae_u8 *src, uae_ #undef BLT_FUNC #ifdef BLT_TEMP #undef BLT_TEMP -#endif \ No newline at end of file +#endif diff --git a/ppc/ppcd.cpp b/ppc/ppcd.cpp index faeb4050..bd32073d 100644 --- a/ppc/ppcd.cpp +++ b/ppc/ppcd.cpp @@ -58,7 +58,7 @@ static PPCD_CB *o; #define Rc LK // GPRs. sp, sd1 and sd2 are named corresponding to PPC EABI. -static char *regname[] = { +static const char *regname[] = { #ifdef UPPERCASE "R0" , "R1" , "R2", "R3" , "R4" , "R5" , "R6" , "R7" , "R8" , "R9" , "R10", "R11", "R12", "R13", "R14", "R15", @@ -104,7 +104,7 @@ static char * simm(int val, int hex, int s) } // Simple instruction form + reserved bitmask. -static void put(char * mnem, u32 mask, u32 chkval=0, int iclass=PPC_DISA_OTHER) +static void put(const char * mnem, u32 mask, u32 chkval=0, int iclass=PPC_DISA_OTHER) { if( (Instr & mask) != chkval ) { ill(); return; } o->iclass |= iclass; @@ -112,7 +112,7 @@ static void put(char * mnem, u32 mask, u32 chkval=0, int iclass=PPC_DISA_OTHER) } // Simplified mnemonic trap conditions -static char * t_cond[32] = { +static const char * t_cond[32] = { NULL, "lgt", "llt", NULL, "eq", "lge", "lle", NULL, "gt", NULL, NULL, NULL, "ge", NULL, NULL, NULL, "lt", NULL, NULL, NULL, "le", NULL, NULL, NULL, @@ -182,7 +182,7 @@ static void trap(int L, int imm) // dab LSB bits : [D][A][B] (D should always present) // 'hex' for logic opcodes, 's' for alu opcodes, 'crfD' and 'L' for cmp opcodes // 'imm': 1 to show immediate operand -static void integer(char *mnem, char form, int dab, int hex=0, int s=1, int crfD=0, int L=0, int imm=1) +static void integer(const char *mnem, char form, int dab, int hex=0, int s=1, int crfD=0, int L=0, int imm=1) { char * ptr = o->operands; int rd = DIS_RD, ra = DIS_RA, rb = DIS_RB; @@ -264,7 +264,7 @@ static void integer(char *mnem, char form, int dab, int hex=0, int s=1, int crfD } // Compare instructions (wraps to integer call) -static void cmp(char *l, char *i) +static void cmp(const char *l, const char *i) { char mnem[sizeof(o->mnemonic)]; int rd = DIS_RD; @@ -289,7 +289,7 @@ static void cmp(char *l, char *i) } // Add immediate (wraps to integer call) -static void addi(char *suffix) +static void addi(const char *suffix) { char mnem[sizeof(o->mnemonic)]; @@ -329,15 +329,15 @@ static void addi(char *suffix) } // Branch suffix: AA || LK. -static char *b_opt[4] = { "", "l", "a", "la" }; +static const char *b_opt[4] = { "", "l", "a", "la" }; // Branch condition code: 4 * BO[1] + (BI & 3) -static char * b_cond[8] = { +static const char * b_cond[8] = { "ge", "le", "ne", "ns", "lt", "gt", "eq", "so" }; // Branch on CTR code: BO[0..3] -static char * b_ctr[16] = { +static const char * b_ctr[16] = { "dnzf", "dzf", NULL, NULL, "dnzt", "dzt", NULL, NULL, "dnz", "dz", NULL, NULL, NULL, NULL, NULL, NULL }; @@ -381,7 +381,7 @@ static void bcx(int Disp, int L) if(Disp) { bd = DIS_UIMM & ~3; - if(bd & 0x8000) bd |= 0xffffffffffff0000; + if(bd & 0x8000) bd |= 0xffffffffffff0000LL; o->target = (AA ? 0 : DIS_PC) + bd; } else o->target = 0; @@ -405,7 +405,7 @@ static void bcx(int Disp, int L) { if(bo & 2) { ill(); return; } // BO[3] #ifdef SIMPLIFIED - char *cond = b_cond[((bo & 8) >> 1) | (bi & 3)]; + const char *cond = b_cond[((bo & 8) >> 1) | (bi & 3)]; if(cond != NULL) // BO[1] { sprintf(o->mnemonic, "b%s%s%s%c", cond, r, b_opt[Disp ? AALK : LK], y); @@ -444,9 +444,9 @@ static void bx(void) { // Calculate displacement and target address u64 bd = Instr & 0x03fffffc; - if(bd & 0x02000000) bd |= 0xfffffffffc000000; + if(bd & 0x02000000) bd |= 0xfffffffffc000000LL; o->target = (AA ? 0 : DIS_PC) + bd; - + o->iclass |= PPC_DISA_BRANCH; sprintf(o->mnemonic, "b%s", b_opt[AALK]); place_target(o->operands, 0); @@ -461,7 +461,7 @@ static void mcrf(void) } // CR logic operations -static void crop(char *name, char *simp="", int ddd=0, int daa=0) +static void crop(const char *name, const char *simp="", int ddd=0, int daa=0) { if(Instr & 1) { ill(); return; } @@ -506,7 +506,7 @@ static void crop(char *name, char *simp="", int ddd=0, int daa=0) } // Rotate left word. -static void rlw(char *name, int rb, int ins=0) +static void rlw(const char *name, int rb, int ins=0) { int mb = DIS_MB, me = DIS_ME; char * ptr = o->operands; @@ -564,7 +564,7 @@ static void rld(char *name, int rb, int mtype) } // Load/Store. -static void ldst(char *name, int x/*indexed*/, int load=1, int L=0, int string=0, int fload=0) +static void ldst(const char *name, int x/*indexed*/, int load=1, int L=0, int string=0, int fload=0) { if(x) integer(name, fload ? 'F' : 'X', DAB_D|DAB_A|DAB_B); else @@ -586,7 +586,7 @@ static void ldst(char *name, int x/*indexed*/, int load=1, int L=0, int string=0 } // Cache. -static void cache(char *name, int flag=PPC_DISA_OTHER) +static void cache(const char *name, int flag=PPC_DISA_OTHER) { if (DIS_RD) { ill(); return; } else @@ -600,7 +600,7 @@ static void cache(char *name, int flag=PPC_DISA_OTHER) } } -static void movesr(char *name, int from, int L, int xform) +static void movesr(const char *name, int from, int L, int xform) { int reg = DIS_RD, sreg = DIS_RA & 0xF, regb = DIS_RB; @@ -660,7 +660,7 @@ static void mcrxr(void) o->r[0] = DIS_RD >> 2; } -static char *spr_name(int n) +static const char *spr_name(int n) { static char def[8]; @@ -758,7 +758,7 @@ static char *spr_name(int n) return def; } -static char *tbr_name(int n) +static const char *tbr_name(int n) { static char def[8]; @@ -776,7 +776,7 @@ static char *tbr_name(int n) static void movespr(int from) { int spr = (DIS_RB << 5) | DIS_RA, f = 1; - char *fix; + const char *fix; if( !((spr == 1) || (spr == 8) || (spr == 9)) ) o->iclass |= PPC_DISA_OEA; @@ -813,7 +813,7 @@ static void movespr(int from) static void movetbr(void) { int tbr = (DIS_RB << 5) | DIS_RA, f = 1; - char *fix; + const char *fix; // Handle simplified mnemonic if (tbr == 268) { fix = "tbl"; o->iclass |= PPC_DISA_SIMPLIFIED; } @@ -857,7 +857,7 @@ static void sradi(void) o->iclass = PPC_DISA_INTEGER | PPC_DISA_64; } -static void lsswi(char *name) +static void lsswi(const char *name) { int rd = DIS_RD, ra = DIS_RA, nb = DIS_RB; strcpy (o->mnemonic, name); @@ -874,7 +874,7 @@ static void lsswi(char *name) #define FPU_DACB 4 #define FPU_D 5 -static void fpu(char *name, u32 mask, int type, int flag=PPC_DISA_OTHER) +static void fpu(const char *name, u32 mask, int type, int flag=PPC_DISA_OTHER) { int d = DIS_RD, a = DIS_RA, c = DIS_RC, b = DIS_RB; @@ -909,7 +909,7 @@ static void fpu(char *name, u32 mask, int type, int flag=PPC_DISA_OTHER) o->iclass = PPC_DISA_FPU | flag; } -static void fcmp(char *name) +static void fcmp(const char *name) { int crfd = DIS_RD >> 2, ra = DIS_RA, rb = DIS_RB; @@ -933,7 +933,7 @@ static void mtfsf(void) o->iclass = PPC_DISA_FPU; } -static void mtfsb(char *name) +static void mtfsb(const char *name) { int crbd = DIS_RD; @@ -1766,6 +1766,6 @@ char *PPCDisasmSimple(u64 pc, u32 instr) dis_out.instr = instr; PPCDisasm(&dis_out); - sprintf(output, "%08X %08X %-10s %s", pc, instr, dis_out.mnemonic, dis_out.operands); + sprintf(output, "%08llX %08X %-10s %s", pc, instr, dis_out.mnemonic, dis_out.operands); return output; } diff --git a/ppc/ppcd.h b/ppc/ppcd.h index 2ebf7945..4c10f601 100644 --- a/ppc/ppcd.h +++ b/ppc/ppcd.h @@ -6,10 +6,10 @@ typedef signed char s8; typedef signed short s16; -typedef signed long s32; +typedef signed int s32; typedef unsigned char u8; typedef unsigned short u16; -typedef unsigned long u32; +typedef unsigned int u32; typedef float f32; typedef double f64; diff --git a/qemuvga/qemuuaeglue.h b/qemuvga/qemuuaeglue.h index d2441f99..9fc9575c 100644 --- a/qemuvga/qemuuaeglue.h +++ b/qemuvga/qemuuaeglue.h @@ -72,9 +72,13 @@ inline int c99_snprintf(char* str, size_t size, const char* format, ...) #define ABS(x) abs(x) #endif +#ifdef USE_GLIB +#include +#else #define g_free free #define g_malloc malloc #define g_new(type, num) ((type*)calloc(sizeof(type),num)) +#endif enum device_endian { DEVICE_NATIVE_ENDIAN, diff --git a/sampler.cpp b/sampler.cpp index 273fbac4..fe511ebe 100644 --- a/sampler.cpp +++ b/sampler.cpp @@ -297,4 +297,4 @@ void sampler_vsync (void) sampler_free (); return; } -} \ No newline at end of file +} diff --git a/savestate.cpp b/savestate.cpp index 63b98593..390a25b0 100644 --- a/savestate.cpp +++ b/savestate.cpp @@ -257,7 +257,6 @@ TCHAR *restore_path_func (uae_u8 **dstp, int type) { TCHAR *newpath; TCHAR *s; - TCHAR *out = NULL; TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH]; s = restore_string_func (dstp); @@ -302,13 +301,13 @@ TCHAR *restore_path_func (uae_u8 **dstp, int type) /* read and write IFF-style hunks */ -static void save_chunk (struct zfile *f, uae_u8 *chunk, size_t len, TCHAR *name, int compress) +static void save_chunk (struct zfile *f, uae_u8 *chunk, unsigned int len, const TCHAR *name, int compress) { uae_u8 tmp[8], *dst; uae_u8 zero[4]= { 0, 0, 0, 0 }; uae_u32 flags; - size_t pos; - size_t chunklen, len2; + unsigned int pos; + unsigned int chunklen, len2; char *s; if (!chunk) @@ -365,10 +364,10 @@ static void save_chunk (struct zfile *f, uae_u8 *chunk, size_t len, TCHAR *name, if (len2) zfile_fwrite (zero, 1, len2, f); - write_log (_T("Chunk '%s' chunk size %d (%d)\n"), name, chunklen, len); + write_log (_T("Chunk '%s' chunk size %u (%u)\n"), name, chunklen, len); } -static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, size_t *len, size_t *totallen, size_t *filepos) +static uae_u8 *restore_chunk (struct zfile *f, TCHAR *name, unsigned int *len, unsigned int *totallen, size_t *filepos) { uae_u8 tmp[6], dummy[4], *mem, *src; uae_u32 flags; @@ -497,7 +496,7 @@ void restore_state (const TCHAR *filename) struct zfile *f; uae_u8 *chunk,*end; TCHAR name[5]; - size_t len, totallen; + unsigned int len, totallen; size_t filepos, filesize; int z3num; @@ -526,7 +525,7 @@ void restore_state (const TCHAR *filename) for (;;) { name[0] = 0; chunk = end = restore_chunk (f, name, &len, &totallen, &filepos); - write_log (_T("Chunk '%s' size %d (%d)\n"), name, len, totallen); + write_log (_T("Chunk '%s' size %u (%u)\n"), name, len, totallen); if (!_tcscmp (name, _T("END "))) { #ifdef _DEBUG if (filesize > filepos + 8) @@ -721,7 +720,7 @@ void restore_state (const TCHAR *filename) write_log (_T("Chunk '%s', size %d bytes was not accepted!\n"), name, len); else if (totallen != end - chunk) - write_log (_T("Chunk '%s' total size %d bytes but read %d bytes!\n"), + write_log (_T("Chunk '%s' total size %d bytes but read %ld bytes!\n"), name, totallen, end - chunk); xfree (chunk); } @@ -1198,7 +1197,7 @@ int savestate_dorewind (int pos) pos = replaycounter - 1; if (canrewind (pos)) { savestate_state = STATE_DOREWIND; - write_log (_T("dorewind %d (%010d/%03d) -> %d\n"), replaycounter - 1, hsync_counter, vsync_counter, pos); + write_log (_T("dorewind %d (%010ld/%03ld) -> %d\n"), replaycounter - 1, hsync_counter, vsync_counter, pos); return 1; } return 0; @@ -1342,7 +1341,7 @@ void savestate_rewind (void) return; } inprec_setposition (st->inprecoffset, pos); - write_log (_T("state %d restored. (%010d/%03d)\n"), pos, hsync_counter, vsync_counter); + write_log (_T("state %d restored. (%010ld/%03ld)\n"), pos, hsync_counter, vsync_counter); if (rewind) { replaycounter--; if (replaycounter < 0) @@ -1729,7 +1728,7 @@ retry2: staterecords_first -= staterecords_max; } - write_log (_T("state capture %d (%010d/%03d,%d/%d) (%d bytes, alloc %d)\n"), + write_log (_T("state capture %d (%010ld/%03ld,%ld/%d) (%ld bytes, alloc %d)\n"), replaycounter, hsync_counter, vsync_counter, hsync_counter % current_maxvpos (), current_maxvpos (), st->end - st->data, statefile_alloc); diff --git a/scp.cpp b/scp.cpp index 6707568e..0d7a6a5e 100644 --- a/scp.cpp +++ b/scp.cpp @@ -15,22 +15,10 @@ #include "zfile.h" #include "gui.h" #include "uae.h" +#include "uae/endian.h" #include -#ifndef _MSC_VER -#include -#else -static uint16_t be16toh(uint16_t v) -{ - return (v << 8) | (v >> 8); -} -static uint32_t le32toh(uint32_t v) -{ - return v; -} -#endif - #define MAX_REVS 5 enum pll_mode { diff --git a/scsi.cpp b/scsi.cpp index e1ec1cfd..c11d876b 100644 --- a/scsi.cpp +++ b/scsi.cpp @@ -2989,13 +2989,13 @@ static void REGPARAM2 ncr80_bput(struct soft_scsi *ncr, uaecptr addr, uae_u32 b) ncr80_bput2(ncr, addr, b, 1); } - static void REGPARAM2 soft_generic_bput (uaecptr addr, uae_u32 b) { struct soft_scsi *ncr = getscsiboard(addr); if (ncr) ncr80_bput(ncr, addr, b); } + static void REGPARAM2 soft_generic_wput (uaecptr addr, uae_u32 b) { struct soft_scsi *ncr = getscsiboard(addr); @@ -3078,7 +3078,7 @@ uae_u32 soft_scsi_get(uaecptr addr, int size) /* $8380 select unit (unit mask) - $8200 + $8200 6: REQ (1=active) 8: BSY (0=active) 10: C/D (1=data) @@ -3093,7 +3093,7 @@ uae_u32 soft_scsi_get(uaecptr addr, int size) addrbank *supra_init(struct romconfig *rc) { struct soft_scsi *scsi = getscsi(rc); - + if (!scsi) return &expamem_null; diff --git a/scsitape.cpp b/scsitape.cpp index 7eb4a3db..f21da2b8 100644 --- a/scsitape.cpp +++ b/scsitape.cpp @@ -12,6 +12,7 @@ #include "options.h" #include "filesys.h" +#include "scsi.h" #include "blkdev.h" #include "zfile.h" #include "memory.h" diff --git a/sndboard.cpp b/sndboard.cpp index 91afc8e3..a418c6ed 100644 --- a/sndboard.cpp +++ b/sndboard.cpp @@ -1294,10 +1294,10 @@ static void sndboard_free_capture(void) if (capture_started) pAudioClient->Stop(); capture_started = false; - SAFE_RELEASE(pEnumerator) - SAFE_RELEASE(pDevice) - SAFE_RELEASE(pAudioClient) - SAFE_RELEASE(pCaptureClient) + SAFE_RELEASE(pEnumerator) + SAFE_RELEASE(pDevice) + SAFE_RELEASE(pAudioClient) + SAFE_RELEASE(pCaptureClient) } static bool sndboard_init_capture(int freq) @@ -1318,7 +1318,7 @@ static bool sndboard_init_capture(int freq) hr = pEnumerator->GetDefaultAudioEndpoint(eCapture, eConsole, &pDevice); EXIT_ON_ERROR(hr) - hr = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pAudioClient); + hr = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pAudioClient); EXIT_ON_ERROR(hr) memset (&wavfmtsrc, 0, sizeof wavfmtsrc); @@ -1363,7 +1363,7 @@ static bool sndboard_init_capture(int freq) hr = pAudioClient->GetService(IID_IAudioCaptureClient, (void**)&pCaptureClient); - EXIT_ON_ERROR(hr) + EXIT_ON_ERROR(hr) hr = pAudioClient->Start(); EXIT_ON_ERROR(hr) @@ -1381,8 +1381,4 @@ Exit:; return false; } - #endif - - - diff --git a/specialmonitors.cpp b/specialmonitors.cpp index 7f1a91de..93910ba0 100755 --- a/specialmonitors.cpp +++ b/specialmonitors.cpp @@ -1568,7 +1568,8 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst, bool doublelines yend = isntsc ? MAXVPOS_NTSC : MAXVPOS_PAL; uae_u8 r, g, b; - uae_u8 or, og, ob; + /* or is an alternative operator and cannot be used as an identifier */ + uae_u8 or_, og, ob; int pcnt = 0; int bank = 0; int mode_active = 0; @@ -1640,7 +1641,7 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst, bool doublelines if (mode_active) { if (cookie_line || x < cookiestartx) { r = g = b = 0; - or = og = ob = 0; + or_ = og = ob = 0; } else { if (mode_active == ham_e_magic_cookie_reg) { uae_u8 *pal = &graffiti_palette[val * 4]; @@ -1670,7 +1671,7 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst, bool doublelines if (hameplus) { uae_u8 ar, ag, ab; - ar = (r + or) / 2; + ar = (r + or_) / 2; ag = (g + og) / 2; ab = (b + ob) / 2; @@ -1693,7 +1694,7 @@ static bool ham_e(struct vidbuffer *src, struct vidbuffer *dst, bool doublelines PRGB(dst, d2, r, g, b); } } - or = r; + or_ = r; og = g; ob = b; } else { @@ -2245,6 +2246,8 @@ static void load_genlock_image(void) png_uint_32 width, height; int depth, color_type; struct png_cb cb; + png_bytepp row_pp; + png_size_t cols; xfree(genlock_image); genlock_image = NULL; @@ -2290,13 +2293,13 @@ static void load_genlock_image(void) if (!(color_type & PNG_COLOR_MASK_ALPHA)) png_set_add_alpha(png_ptr, 0, PNG_FILLER_AFTER); - png_size_t cols = png_get_rowbytes(png_ptr, info_ptr); + cols = png_get_rowbytes(png_ptr, info_ptr); genlock_image_pitch = width * 4; genlock_image_width = width; genlock_image_height = height; - png_bytepp row_pp = new png_bytep[height]; + row_pp = new png_bytep[height]; genlock_image = xcalloc(uae_u8, width * height * 4); diff --git a/uaelib.cpp b/uaelib.cpp index 4747de62..9cdd3f5b 100644 --- a/uaelib.cpp +++ b/uaelib.cpp @@ -360,8 +360,6 @@ static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3) return 0; } -extern uae_u32 picasso_demux (uae_u32 arg, TrapContext *context); - static uae_u32 REGPARAM2 uaelib_demux2 (TrapContext *context) { #define ARG0 (get_long (m68k_areg (regs, 7) + 4)) diff --git a/writelog.cpp b/writelog.cpp index 91e35981..4258fbd3 100644 --- a/writelog.cpp +++ b/writelog.cpp @@ -29,5 +29,5 @@ void write_log_standard (const char *fmt, ...) fprintf (stderr, fmt, x1, x2, x3, x4, x5, x6, x7, x8); } #endif + va_end (ap); } - diff --git a/x86.cpp b/x86.cpp index 320f7158..69aef5b0 100644 --- a/x86.cpp +++ b/x86.cpp @@ -3434,7 +3434,7 @@ void DOSBOX_RunMachine(void) { } -void GFX_SetTitle(long a, long b, bool c) +void GFX_SetTitle(Bit32s cycles, Bits frameskip, bool paused) { }