From: Toni Wilen Date: Thu, 16 Dec 2021 19:59:55 +0000 (+0200) Subject: Small fixes. X-Git-Tag: 4910~48 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=71db4693b443a4ff0190e68460293dec8199154a;p=francis%2Fwinuae.git Small fixes. --- diff --git a/disasm.cpp b/disasm.cpp index 9e954ee5..f29de32b 100644 --- a/disasm.cpp +++ b/disasm.cpp @@ -95,7 +95,7 @@ static const TCHAR *disasm_lc_hex2(const TCHAR *s, bool noprefix) if (!s2) { break; } - tmp[0] = 'x'; + tmp[s2 - tmp] = 'x'; } } } diff --git a/filesys.cpp b/filesys.cpp index 09ec5492..5b6a6676 100644 --- a/filesys.cpp +++ b/filesys.cpp @@ -767,7 +767,7 @@ static void fixcharset (TCHAR *s) char tmp[MAX_DPATH]; if (!s) return; - ua_fs_copy (tmp, MAX_DPATH, s, '_'); + ua_fs_copy (tmp, MAX_DPATH - 1, s, '_'); au_fs_copy (s, strlen (tmp) + 1, tmp); } diff --git a/fpp.cpp b/fpp.cpp index 1606a209..0a6193d7 100644 --- a/fpp.cpp +++ b/fpp.cpp @@ -3249,10 +3249,10 @@ static void fpuop_arithmetic2 (uae_u32 opcode, uae_u16 extra) return; } if (extra & 0x2000) { - // An -> FPIAR + // FPIAR -> An m68k_areg (regs, opcode & 7) = regs.fpiar; } else { - // FPIAR -> An + // An -> FPIAR regs.fpiar = m68k_areg (regs, opcode & 7); } } else if ((opcode & 0x3f) == 0x3c) { diff --git a/od-win32/debug_win32.cpp b/od-win32/debug_win32.cpp index c41a7cf7..b4515a20 100644 --- a/od-win32/debug_win32.cpp +++ b/od-win32/debug_win32.cpp @@ -203,7 +203,7 @@ static int CheckLineLimit(HWND hWnd, const TCHAR *out) tmp = (TCHAR *)out; lines_have = SendMessage(hWnd, EM_GETLINECOUNT, 0, 0); - while (_tcslen(tmp) > 0 && (p = _tcschr(tmp, '\n')) > 0) { + while (_tcslen(tmp) > 0 && (p = _tcschr(tmp, '\n'))) { lines_new++; tmp = p + 1; } diff --git a/pcem/cpu.cpp b/pcem/cpu.cpp index 37c6d51f..9d6ac58d 100644 --- a/pcem/cpu.cpp +++ b/pcem/cpu.cpp @@ -21,6 +21,8 @@ int isa_cycles; int has_vlb; static uint8_t ccr0, ccr1, ccr2, ccr3, ccr4, ccr5, ccr6; +struct cyrixs cyrix; + OpFn *x86_dynarec_opcodes; OpFn *x86_dynarec_opcodes_0f; OpFn *x86_dynarec_opcodes_d8_a16; diff --git a/pcem/x86.h b/pcem/x86.h index 822d0796..7ed5ac8d 100644 --- a/pcem/x86.h +++ b/pcem/x86.h @@ -333,7 +333,7 @@ void cyrix_write_seg_descriptor(uint32_t addr, x86seg *seg); #define SMHR_VALID (1 << 0) #define SMHR_ADDR_MASK (0xfffffffc) -struct +struct cyrixs { struct { @@ -341,6 +341,6 @@ struct uint64_t size; } arr[8]; uint32_t smhr; -} cyrix; - +}; +extern struct cyrixs cyrix; #endif diff --git a/zfile.cpp b/zfile.cpp index 4cf778ab..b2224f27 100644 --- a/zfile.cpp +++ b/zfile.cpp @@ -2340,14 +2340,30 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z) au_copy (s, size, s2); return s + size; } else { - char s2[MAX_DPATH]; + bool alloc = false; + char s2t[MAX_DPATH + 1]; + char *s2 = s2t; char *s1; + if (size >= MAX_DPATH + 1) { + s2 = xmalloc(char, size + 1); + if (!s2) { + return NULL; + } + alloc = true; + } s1 = fgets (s2, size, z->f); - if (!s1) + if (!s1) { + if (alloc) { + xfree(s2); + } return NULL; + } if (size > strlen (s2) + 1) size = strlen (s2) + 1; au_copy (s, size, s2); + if (alloc) { + xfree(s2); + } return s + size; } }