]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Small fixes.
authorToni Wilen <twilen@winuae.net>
Thu, 16 Dec 2021 19:59:55 +0000 (21:59 +0200)
committerToni Wilen <twilen@winuae.net>
Thu, 16 Dec 2021 19:59:55 +0000 (21:59 +0200)
disasm.cpp
filesys.cpp
fpp.cpp
od-win32/debug_win32.cpp
pcem/cpu.cpp
pcem/x86.h
zfile.cpp

index 9e954ee5148bc725655b987940ddee319f9864ef..f29de32b6b7e79d38638a508eec2f8fb630e1d9c 100644 (file)
@@ -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';
                        }
                }
        }
index 09ec5492af26c5b98b9171b467e7de92b61ac1f6..5b6a6676ffde4072d11e2302fabe83a5b423e88a 100644 (file)
@@ -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 1606a209308da16ce1a76c3bff70cefad66023a4..0a6193d7d2d12d486f0119c4b8b327a6a23389f6 100644 (file)
--- 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) {
index c41a7cf7c69b9d0f99486b210a4d130d9b25b592..b4515a2046aa680d2ef057580ff8f928e5f85774 100644 (file)
@@ -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;
        }
index 37c6d51ffdc70ad5da3264e457662b6971f2bd7f..9d6ac58d8f0e1b4327321c48691093c702056dea 100644 (file)
@@ -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;
index 822d079671c355ce2a5ba3805699b03630c234eb..7ed5ac8da706f9d06b668d6d0a3e333a0e37d3d5 100644 (file)
@@ -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
index 4cf778abad88768ba4d6276daacf9d3eaf4e18a3..b2224f2716ef03b8156529514366952c9ef09b58 100644 (file)
--- 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;
        }
 }