]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix order of operations.
authorToni Wilen <twilen@winuae.net>
Mon, 26 Dec 2022 08:59:54 +0000 (10:59 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 26 Dec 2022 08:59:54 +0000 (10:59 +0200)
blkdev.cpp
blkdev_cdimage.cpp
gayle.cpp
od-win32/debug_win32.cpp

index 19608d7d4146d4e4aae2018376246cdb06e23569..5b40a1bea116cd6bae0a6f572e7a586e7287e168 100644 (file)
@@ -1886,7 +1886,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
                                        strack++;
                                }
                                addtocentry (&p2, &maxlen, 0xa2, 0xaa, msf, p, toc);                            
-                               int tlen = addrdiff(p2, p + 2);
+                               int tlen = addrdiff(p2, p) + 2;
                                p[0] = tlen >> 8;
                                p[1] = tlen >> 0;
                                scsi_len = tlen + 2;
index 78635dcb4f49783e6cbcc1e519c4c6ea8d97d77c..7b7c3305f9d9b64679a94431e72952fbc98c67e9 100644 (file)
@@ -338,11 +338,11 @@ static int getsub_deinterleaved (uae_u8 *dst, struct cdunit *cdu, struct cdtoc *
                // regenerate Q-subchannel
                uae_u8 *s = dst + SUB_ENTRY_SIZE;
                s[0] = (t->ctrl << 4) | (t->adr << 0);
-               s[1] = tobcd(addrdiff(t, &cdu->toc[0] + 1));
+               s[1] = tobcd(addrdiff(t, &cdu->toc[0]) + 1);
                s[2] = tobcd(1);
                int msf = lsn2msf(sector);
                tolongbcd(s + 7, msf);
-               msf = lsn2msf(addrdiff(sector, t->address - 150));
+               msf = lsn2msf(addrdiff(sector, t->address) - 150);
                tolongbcd(s + 3, msf);
                ret = 2;
        }
index 8e9e6f3077810f1e1a1b4807277f64360ce2a05f..c5f84df6332735707c929ea40e8c5fba23342885 100644 (file)
--- a/gayle.cpp
+++ b/gayle.cpp
@@ -1278,7 +1278,7 @@ static void initscideattr (int readonly)
        strcpy ((char*)p, "Generic Emulated PCMCIA IDE");
        p += strlen ((char*)p) + 1;
        *p++= 0xff;
-       *rp = addrdiff(p, rp - 1);
+       *rp = addrdiff(p, rp) - 1;
 
        /* CISTPL_FUNCID */
        *p++ = 0x21;
@@ -1380,7 +1380,7 @@ static void initsramattr (int size, int readonly)
        sprintf ((char*)p, "Generic Emulated %dKB PCMCIA SRAM Card", size >> 10);
        p += strlen ((char*)p) + 1;
        *p++= 0xff;
-       *rp = addrdiff(p, rp - 1);
+       *rp = addrdiff(p, rp) - 1;
 
        /* CISTPL_FUNCID */
        *p++ = 0x21;
index a3e2a63a56e8a35e484963a1392550136a989d2a..f65a4b934ebb0fa5ae33f3bf55020efcc61afe06 100644 (file)
@@ -241,7 +241,7 @@ void WriteOutput(const TCHAR *out, int len)
        for(;;) {
                p = _tcschr(tmp, '\n');
                if (p) {
-                       pos = addrdiff(p, tmp + 1);
+                       pos = addrdiff(p, tmp) + 1;
                        if (pos > (MAX_LINEWIDTH + 1))
                                pos = MAX_LINEWIDTH + 1;
                        buf = xcalloc(TCHAR, pos + 2);