From 8aee58dce1b7a882fee5d38f4795792ba9bfad1b Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 16 Jun 2018 22:10:07 +0300 Subject: [PATCH] MSVC code analyzer warnings fixed. --- cdtvcr.cpp | 1 + expansion.cpp | 4 ++-- od-win32/bsdsock.cpp | 9 +++++---- od-win32/hardfile_win32.cpp | 4 ++-- od-win32/sounddep/sound.cpp | 2 +- qemuvga/ne2000.cpp | 6 ++++-- specialmonitors.cpp | 1 + 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/cdtvcr.cpp b/cdtvcr.cpp index 819d7738..17fddad0 100644 --- a/cdtvcr.cpp +++ b/cdtvcr.cpp @@ -457,6 +457,7 @@ static void cdtvcr_play_track(uae_u32 track_start, uae_u32 track_end) if (track_start == s->track) { start_found++; start = s->paddress; + end = toc.toc[toc.last_track_offset].paddress; } if (track_end == s->track) { end = s->paddress; diff --git a/expansion.cpp b/expansion.cpp index 94247f7f..036e86f2 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -245,8 +245,8 @@ static bool ks11orolder(void) */ /* Autoconfig address space at 0xE80000 */ -static uae_u8 expamem[65536]; -static uae_u8 expamem_write_space[65536]; +static uae_u8 expamem[65536 + 4]; +static uae_u8 expamem_write_space[65536 + 4]; #define AUTOMATIC_AUTOCONFIG_MAX_ADDRESS 0x80 static int expamem_autoconfig_mode; static addrbank*(*expamem_map)(struct autoconfig_info*); diff --git a/od-win32/bsdsock.cpp b/od-win32/bsdsock.cpp index c47c681b..58d655cd 100644 --- a/od-win32/bsdsock.cpp +++ b/od-win32/bsdsock.cpp @@ -2297,7 +2297,7 @@ static unsigned int thread_get2 (void *indexp) uae_u32 proto; uae_u32 type; char *proto_rp = 0; - struct servent *serv; + struct servent *serv = NULL; nameport = args->args2; proto = args->args3; @@ -2311,9 +2311,10 @@ static unsigned int thread_get2 (void *indexp) if (type) { serv = getservbyport(nameport, proto_rp); } else { - if (addr_valid (_T("thread_get4"), nameport, 1)) - name_rp = (char*)get_real_address (nameport); - serv = getservbyname(name_rp, proto_rp); + if (addr_valid(_T("thread_get4"), nameport, 1)) { + name_rp = (char*)get_real_address(nameport); + serv = getservbyname(name_rp, proto_rp); + } } if (bsd->threadGetargs_inuse[index] != GET_STATE_CANCEL) { // No CTRL-C Signal diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index 0298d6ad..3cd75c88 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -2224,7 +2224,7 @@ static int hdf_seek (struct hardfiledata *hfd, uae_u64 offset) static void poscheck (struct hardfiledata *hfd, int len) { DWORD err; - uae_s64 pos; + uae_s64 pos = -1; if (hfd->handle_valid == HDF_HANDLE_WIN32_NORMAL) { LARGE_INTEGER fppos; @@ -3341,7 +3341,7 @@ TCHAR *hdf_getnameharddrive (int index, int flags, int *sectorsize, int *dangero static int hmc (struct hardfiledata *hfd) { uae_u8 *buf = xmalloc (uae_u8, hfd->ci.blocksize); - DWORD ret, got, err, status; + DWORD ret = 0, got, err = 0, status = 0; int first = 1; while (hfd->handle_valid) { diff --git a/od-win32/sounddep/sound.cpp b/od-win32/sounddep/sound.cpp index 166fc9dd..2334cb0b 100644 --- a/od-win32/sounddep/sound.cpp +++ b/od-win32/sounddep/sound.cpp @@ -1568,7 +1568,7 @@ static int open_audio_ds (struct sound_data *sd, int index) DSBUFFERDESC sound_buffer; DSCAPS DSCaps; WAVEFORMATEXTENSIBLE wavfmt; - LPDIRECTSOUNDBUFFER pdsb; + LPDIRECTSOUNDBUFFER pdsb = NULL; int freq = sd->freq; int ch = sd->channels; int round, i; diff --git a/qemuvga/ne2000.cpp b/qemuvga/ne2000.cpp index e07d281d..094a2010 100644 --- a/qemuvga/ne2000.cpp +++ b/qemuvga/ne2000.cpp @@ -1607,7 +1607,8 @@ static int toariadne2(struct ne2000_s *ne, uaecptr addr, uae_u32 *vp, int size, } } else if ((addr & 0x8101) == 0x0100) { // mac rom - *vp = ncs.ne2000state->c.macaddr.a[(addr >> 1) & 7]; + int macoffset = (addr >> 1) & 7; + *vp = macoffset < 6 ? ncs.ne2000state->c.macaddr.a[macoffset] : 0; } else if ((addr & 0x8101) == 0x0001) { // io addr &= (15 << 1); @@ -1642,7 +1643,8 @@ static int toariadne2(struct ne2000_s *ne, uaecptr addr, uae_u32 *vp, int size, } } else if ((addr & 0xffe1) == 0xffc0) { // mac rom - *vp = ncs.ne2000state->c.macaddr.a[(addr >> 1) & 7]; + int macoffset = (addr >> 1) & 7; + *vp = macoffset < 6 ? ncs.ne2000state->c.macaddr.a[macoffset] : 0; } else if ((addr & 0xffe1) == 0xffe1) { // io addr &= (15 << 1); diff --git a/specialmonitors.cpp b/specialmonitors.cpp index 5c715e32..51aa9235 100755 --- a/specialmonitors.cpp +++ b/specialmonitors.cpp @@ -1890,6 +1890,7 @@ static bool graffiti(struct vidbuffer *src, struct vidbuffer *dst) command = true; found = false; + hires = false; isntsc = (beamcon0 & 0x20) ? 0 : 1; if (!(currprefs.chipset_mask & CSMASK_ECS_AGNUS)) isntsc = currprefs.ntscmode ? 1 : 0; -- 2.47.3