]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Warning fixes.
authorToni Wilen <twilen@winuae.net>
Fri, 29 Apr 2022 18:01:37 +0000 (21:01 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 29 Apr 2022 18:01:37 +0000 (21:01 +0300)
48 files changed:
archivers/chd/astring.h
audio.cpp
autoconf.cpp
bsdsocket.cpp
cdtv.cpp
cfgfile.cpp
consolehook.cpp
debug.cpp
debugmem.cpp
disasm.cpp
disk.cpp
enforcer.cpp
filesys.cpp
fpp_native.cpp
ide.cpp
include/sysdeps.h
include/traps.h
ini.cpp
isofs.cpp
jit/codegen_x86.cpp
jit/compemu_fpp.cpp
jit/compemu_midfunc_x86.cpp
jit/compemu_support.cpp
jit/exception_handler.cpp
luascript.cpp
main.cpp
od-win32/direct3d.cpp
od-win32/direct3d11.cpp
od-win32/unicode.cpp
od-win32/win32gui.cpp
qemuvga/cirrus_vga.cpp
qemuvga/es1370.cpp
qemuvga/esp.cpp
qemuvga/lsi53c710.cpp
qemuvga/lsi53c895a.cpp
qemuvga/ne2000.cpp
qemuvga/qemuuaeglue.h
qemuvga/scsi/esp.h
qemuvga/vga.cpp
qemuvga/vga_int.h
qemuvga/vga_template.h
rommgr.cpp
sana2.cpp
savestate.cpp
scsiemul.cpp
traps.cpp
zfile.cpp
zfile_archive.cpp

index 639591e04f25059117b4e82f9ee7a3f8bdfd6b61..4822468f16f196193c3344d065c733dc1b4980a0 100644 (file)
@@ -87,19 +87,19 @@ public:
        astring &cpy(const char *src, int count);
        astring &cpysubstr(const astring &src, int start, int count = -1);
        astring &cpy(const astring &src) { return cpy(src.cstr(), src.len()); }
-       astring &cpy(const char *src) { return cpy(src, strlen(src)); }
+       astring &cpy(const char *src) { return cpy(src, uaestrlen(src)); }
 
        // insertion helpers
        astring &ins(int insbefore, const char *src, int count);
        astring &inssubstr(int insbefore, const astring &src, int start, int count = -1);
        astring &ins(int insbefore, const astring &src) { return ins(insbefore, src.cstr(), src.len()); }
-       astring &ins(int insbefore, const char *src) { return ins(insbefore, src, strlen(src)); }
+       astring &ins(int insbefore, const char *src) { return ins(insbefore, src, uaestrlen(src)); }
 
        // concatenation helpers (== insert at end)
        astring &cat(const char *src, int count) { return ins(-1, src, count); }
        astring &catsubstr(const astring &src, int start, int count = -1) { return inssubstr(-1, src, start, count); }
        astring &cat(const astring &src) { return ins(-1, src.cstr(), src.len()); }
-       astring &cat(const char *src) { return ins(-1, src, strlen(src)); }
+       astring &cat(const char *src) { return ins(-1, src, uaestrlen(src)); }
        astring &cat(char ch) { return ins(-1, &ch, 1); }
 
        // substring helpers
@@ -118,13 +118,13 @@ public:
        int cmp(const char *str2, int count) const;
        int cmpsubstr(const astring &str2, int start, int count = -1) const;
        int cmp(const astring &str2) const { return cmp(str2.cstr(), str2.len()); }
-       int cmp(const char *str2) const { return cmp(str2, strlen(str2)); }
+       int cmp(const char *str2) const { return cmp(str2, uaestrlen(str2)); }
 
        // case-insensitive comparison helpers
        int icmp(const char *str2, int count) const;
        int icmpsubstr(const astring &str2, int start, int count = -1) const;
        int icmp(const astring &str2) const { return icmp(str2.cstr(), str2.len()); }
-       int icmp(const char *str2) const { return icmp(str2, strlen(str2)); }
+       int icmp(const char *str2) const { return icmp(str2, uaestrlen(str2)); }
 
        // character searching helpers
        int chr(int start, int ch) const;
index 77b7f8c3a720e18e4fd7fb233aa22c206205888c..be513b889befce534bbba5291648a51e79fed8a8 100644 (file)
--- a/audio.cpp
+++ b/audio.cpp
@@ -214,7 +214,7 @@ static void namesplit (TCHAR *s)
 {
        int l;
 
-       l = _tcslen (s) - 1;
+       l = uaetcslen(s) - 1;
        while (l >= 0) {
                if (s[l] == '.')
                        s[l] = 0;
index e720801b4dcd5340049edea05aac842c755e5bc8..4a1eb447e4467fd17ca1dc025cd5c160509058a0 100644 (file)
@@ -387,16 +387,16 @@ uae_u8 dbg (uaecptr addr)
 * backward.  store pointer at current address
 */
 
-uae_u32 ds_ansi (const uae_char *str)
+uae_u32 ds_ansi(const uae_char *str)
 {
        int len;
 
        if (!str)
-               return addr (rt_straddr);
-       len = strlen (str) + 1;
+               return addr(rt_straddr);
+       len = uaestrlen(str) + 1;
        rt_straddr -= len;
-       strcpy ((uae_char*)rtarea_bank.baseaddr + rt_straddr, str);
-       return addr (rt_straddr);
+       strcpy((uae_char*)rtarea_bank.baseaddr + rt_straddr, str);
+       return addr(rt_straddr);
 }
 
 uae_u32 ds (const TCHAR *str)
@@ -418,7 +418,7 @@ uae_u32 ds_bstr_ansi (const uae_char *str)
 {
        int len;
  
-       len = strlen (str) + 2;
+       len = uaestrlen(str) + 2;
        rt_straddr -= len;
        while (rt_straddr & 3)
                rt_straddr--;
index dfdf902d1128870d41519f0273216631988aaba3..95c3752cfea62245117438ef8c76ce0f4862a500 100644 (file)
@@ -68,7 +68,7 @@ uae_u32 addstr(TrapContext *ctx, uae_u32 * dst, const TCHAR *src)
        uae_u32 res = *dst;
        int len;
        char *s = ua(src);
-       len = strlen(s) + 1;
+       len = uaestrlen(s) + 1;
        if (trap_is_indirect()) {
                trap_put_bytes(ctx, dst, res, len);
        } else {
@@ -82,7 +82,7 @@ uae_u32 addstr_ansi(TrapContext *ctx, uae_u32 * dst, const uae_char *src)
 {
        uae_u32 res = *dst;
        int len;
-       len = strlen (src) + 1;
+       len = uaestrlen (src) + 1;
        if (trap_is_indirect()) {
                trap_put_bytes(ctx, dst, res, len);
        } else {
@@ -1802,15 +1802,15 @@ static uae_u32 REGPARAM2 bsdsocklib_init(TrapContext *ctx)
        _stprintf(verStr, _T("UAE %d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV);
        tmp1 = 0;
        for (i = number_sys_error; i--;)
-               tmp1 += _tcslen (errortexts[i]) + 1;
+               tmp1 += uaetcslen (errortexts[i]) + 1;
        for (i = number_host_error; i--;)
-               tmp1 += _tcslen (herrortexts[i]) + 1;
+               tmp1 += uaetcslen (herrortexts[i]) + 1;
        for (i = number_sana2io_error; i--;)
-               tmp1 += _tcslen (sana2io_errlist[i]) + 1;
+               tmp1 += uaetcslen (sana2io_errlist[i]) + 1;
        for (i = number_sana2wire_error; i--;)
-               tmp1 += _tcslen (sana2wire_errlist[i]) + 1;
-       tmp1 += _tcslen(strErr) + 1;
-       tmp1 += _tcslen(verStr) + 1;
+               tmp1 += uaetcslen (sana2wire_errlist[i]) + 1;
+       tmp1 += uaetcslen(strErr) + 1;
+       tmp1 += uaetcslen(verStr) + 1;
 
 #if NEWTRAP
        trap_call_add_dreg(ctx, 0, tmp1);
index 9bed4f6464ecaf7d9c06afc87ac9771dee534c81..13ec1bf92ce0dfaf5376c9ee52097c46809c6251 100644 (file)
--- a/cdtv.cpp
+++ b/cdtv.cpp
@@ -596,8 +596,8 @@ static void cdrom_command_thread (uae_u8 b)
                break;
        case 0x83:
                if (cdrom_command_cnt_in == 7) {
-                       memcpy (cdrom_command_output, MODEL_NAME, strlen (MODEL_NAME)); 
-                       cdrom_command_accepted (strlen (MODEL_NAME), s, &cdrom_command_cnt_in);
+                       memcpy (cdrom_command_output, MODEL_NAME, uaestrlen(MODEL_NAME)); 
+                       cdrom_command_accepted (uaestrlen(MODEL_NAME), s, &cdrom_command_cnt_in);
                        cd_finished = 1;
                }
        case 0x84:
index 68e78feaae5432282b53cdbd0e8f9385f4881fa7..8b0e729933a0545697666b2320cf51f2924f6d2d 100644 (file)
@@ -487,7 +487,7 @@ bool cfgfile_option_get_bool(const TCHAR* s, const TCHAR* option)
 static void trimwsa (char *s)
 {
        /* Delete trailing whitespace.  */
-       int len = strlen (s);
+       int len = uaestrlen(s);
        while (len > 0 && strcspn (s + len - 1, "\t \r\n") == 0)
                s[--len] = '\0';
 }
@@ -619,14 +619,14 @@ static TCHAR *cfgfile_subst_path2 (const TCHAR *path, const TCHAR *subst, const
                int l;
                TCHAR *p2, *p = xmalloc (TCHAR, _tcslen (file) + _tcslen (subst) + 2);
                _tcscpy (p, subst);
-               l = _tcslen (p);
+               l = uaetcslen(p);
                while (l > 0 && p[l - 1] == '/')
                        p[--l] = '\0';
-               l = _tcslen (path);
+               l = uaetcslen(path);
                while (file[l] == '/')
                        l++;
-               _tcscat (p, _T("/"));
-               _tcscat (p, file + l);
+               _tcscat(p, _T("/"));
+               _tcscat(p, file + l);
                p2 = target_expand_environment (p, NULL, 0);
                xfree (p);
                if (p2 && p2[0] == '$') {
@@ -4610,7 +4610,7 @@ static void get_filesys_controller (const TCHAR *hdc, int *type, int *typenum, i
                const TCHAR *ext = _tcsrchr(control, '_');
                if (ext) {
                        ext++;
-                       int len = _tcslen(ext);
+                       int len = uaetcslen(ext);
                        if (len > 2 && ext[len - 2] == '-' && ext[len - 1] >= '2' && ext[len - 1] <= '9') {
                                idx = ext[len - 1] - '1';
                                len -= 2;
@@ -6418,13 +6418,13 @@ static int cfgfile_separate_linea (const TCHAR *filename, char *line, TCHAR *lin
        *line2++ = '\0';
 
        /* Get rid of whitespace.  */
-       i = strlen (line2);
+       i = uaestrlen(line2);
        while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
                || line2[i - 1] == '\r' || line2[i - 1] == '\n'))
                line2[--i] = '\0';
        line2 += strspn (line2, "\t \r\n");
 
-       i = strlen (line);
+       i = uaestrlen(line);
        while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' '
                || line[i - 1] == '\r' || line[i - 1] == '\n'))
                line[--i] = '\0';
@@ -6459,13 +6459,13 @@ static int cfgfile_separate_line (TCHAR *line, TCHAR *line1b, TCHAR *line2b)
        *line2++ = '\0';
 
        /* Get rid of whitespace.  */
-       i = _tcslen (line2);
+       i = uaetcslen(line2);
        while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
                || line2[i - 1] == '\r' || line2[i - 1] == '\n'))
                line2[--i] = '\0';
        line2 += _tcsspn (line2, _T("\t \r\n"));
        _tcscpy (line2b, line2);
-       i = _tcslen (line);
+       i = uaetcslen(line);
        while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' '
                || line[i - 1] == '\r' || line[i - 1] == '\n'))
                line[--i] = '\0';
@@ -7462,7 +7462,7 @@ int cfgfile_searchconfig(const TCHAR *in, int index, TCHAR *out, int outsize)
 {
        TCHAR tmp[CONFIG_BLEN];
        int j = 0;
-       int inlen = _tcslen (in);
+       int inlen = uaetcslen(in);
        int joker = 0;
        uae_u32 err = 0;
        bool configsearchfound = false;
@@ -7717,7 +7717,7 @@ uae_u32 cfgfile_uaelib_modify(TrapContext *ctx, uae_u32 index, uae_u32 parms, ua
        xfree (parms_in);
        if (out && outsize > 0) {
                parms_out = ua (out_p);
-               if (!trap_valid_address(ctx, out, strlen(parms_out) + 1 > outsize ? outsize : strlen(parms_out) + 1))
+               if (!trap_valid_address(ctx, out, strlen(parms_out) + 1 > outsize ? outsize : uaestrlen(parms_out) + 1))
                        return 0;
                trap_put_string(ctx, parms_out, out, outsize - 1);
        }
@@ -9366,7 +9366,7 @@ TCHAR *get_error_log (void)
        strlist *sl;
        int len = 0;
        for (sl = error_lines; sl; sl = sl->next) {
-               len += _tcslen (sl->option) + 1;
+               len += uaetcslen(sl->option) + 1;
        }
        if (!len)
                return NULL;
index 5544715fd4d9d05d3c66cb27b825118d9375e056..ac63fb689bda944af5551a2260b7a64c0543de2a 100644 (file)
@@ -102,7 +102,7 @@ uaecptr consolehook_beginio(TrapContext *ctx, uaecptr request)
                if (len == -1) {
                        dbuf = xmalloc(char, MAX_DPATH);
                        trap_get_string(ctx, dbuf, io_data, MAX_DPATH);
-                       len = strlen(dbuf);
+                       len = uaestrlen(dbuf);
                } else {
                        dbuf = xmalloc(char, len);
                        trap_get_bytes(ctx, dbuf, io_data, len);
index 771d66b524d8e8feab012037b5b834ce135be8e2..84c1da2a59f8f191adc99346faef90c15dc61468 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -4089,7 +4089,7 @@ static void memwatch (TCHAR **c)
                        while (*cs) {
                                for (int i = 0; memwatch_access_masks[i].mask; i++) {
                                        const TCHAR *n = memwatch_access_masks[i].name;
-                                       int len = _tcslen(n);
+                                       int len = uaetcslen(n);
                                        if (!_tcsnicmp(cs, n, len)) {
                                                if (cs[len] == 0 || cs[len] == 10 || cs[len] == 13 || cs[len] == ' ') {
                                                        mwn->access_mask |= memwatch_access_masks[i].mask;
@@ -7416,7 +7416,7 @@ void debug_trainer_match(void)
 
 static int parsetrainerdata(const TCHAR *data, uae_u16 *outdata, uae_u16 *outmask)
 {
-       int len = _tcslen(data);
+       int len = uaetcslen(data);
        uae_u16 v = 0, vm = 0;
        int j = 0;
        for (int i = 0; i < len; ) {
@@ -7497,7 +7497,7 @@ void debug_init_trainer(const TCHAR *file)
 
                        struct trainerpatch *tp = xcalloc(struct trainerpatch, 1);
 
-                       int datalen = (_tcslen(data) + 3) / 4;
+                       int datalen = (uaetcslen(data) + 3) / 4;
                        tp->data = xcalloc(uae_u16, datalen);
                        tp->maskdata = xcalloc(uae_u16, datalen);
                        tp->length = parsetrainerdata(data, tp->data, tp->maskdata);
@@ -7508,7 +7508,7 @@ void debug_init_trainer(const TCHAR *file)
                                tp->offset = 0;
 
                        if (ini_getstring_multi(ini, section, _T("replacedata"), &data, &ictx)) {
-                               int replacedatalen = (_tcslen(data) + 3) / 4;
+                               int replacedatalen = (uaetcslen(data) + 3) / 4;
                                tp->replacedata = xcalloc(uae_u16, replacedatalen);
                                tp->replacemaskdata = xcalloc(uae_u16, replacedatalen);
                                tp->replacelength = parsetrainerdata(data, tp->replacedata, tp->replacemaskdata);
@@ -7812,7 +7812,7 @@ static void debug_sprintf_do(uae_u32 s)
                        break;
                if (gotm) {
                        bool got = false;
-                       buffersize = MAX_DPATH - strlen(out);
+                       buffersize = MAX_DPATH - uaestrlen(out);
                        if (buffersize <= 1)
                                break;
                        if (c == '%') {
index 5ba793ad50f7c298e778fbab8a6e6ea160209784..ce129bdc7de9939d0bd5dbd320783531a6ecb090 100644 (file)
@@ -1160,7 +1160,7 @@ static bool loadcodefiledata(struct debugcodefile *cf)
                                s[MAX_SOURCELINELEN] = 0;
                        }
                        cf->lineptr[linecnt++] = s;
-                       int len = strlen((char*)s);
+                       int len = uaestrlen((char*)s);
                        if (len > 0 && s[len - 1] == 13)
                                s[len - 1] = 0;
                }
@@ -2035,7 +2035,7 @@ static bool debugger_load_fd(void)
                        if (!zfile_fgetsa(line, sizeof(line), zf))
                                break;
                        for (;;) {
-                               int len = strlen(line);
+                               int len = uaestrlen(line);
                                if (len < 1)
                                        break;
                                char c = line[len - 1];
@@ -3567,7 +3567,7 @@ bool debugmem_get_symbol_value(const TCHAR *name, uae_u32 *valp)
 {
        for (int i = 0; i < libnamecnt; i++) {
                struct libname *libname = &libnames[i];
-               int lnlen = _tcslen(libname->name);
+               int lnlen = uaetcslen(libname->name);
                // "libname/lvoname"?
                if (!_tcsnicmp(name, libname->name, lnlen) && _tcslen(name) > lnlen + 1 && name[lnlen] == '/') {
                        for (int j = 0; j < libsymbolcnt; j++) {
@@ -3651,11 +3651,11 @@ int debugmem_get_symbol(uaecptr addr, TCHAR *out, int maxsize)
                                }
 #endif
 
-                               if (maxsize > _tcslen(txt)) {
+                               if (maxsize > uaetcslen(txt)) {
                                        if (found)
                                                _tcscat(out, _T("\n"));
                                        _tcscat(out, txt);
-                                       maxsize -= _tcslen(txt);
+                                       maxsize -= uaetcslen(txt);
                                }
                        }
                        found = i + 1;
@@ -3728,9 +3728,9 @@ int debugmem_get_sourceline(uaecptr addr, TCHAR *out, int maxsize)
                                        TCHAR txt[256];
                                        last_codefile = cf;
                                        _stprintf(txt, _T("Source file: %s\n"), cf->name);
-                                       if (maxsize > _tcslen(txt)) {
+                                       if (maxsize > uaetcslen(txt)) {
                                                _tcscat(out, txt);
-                                               maxsize -= _tcslen(txt);
+                                               maxsize -= uaetcslen(txt);
                                        }
                                }
                                if (lastline - line > 10)
@@ -3738,10 +3738,10 @@ int debugmem_get_sourceline(uaecptr addr, TCHAR *out, int maxsize)
                                for (int j = line; j < lastline; j++) {
                                        TCHAR txt[256];
                                        TCHAR *s = au((uae_char*)cf->lineptr[j]);
-                                       if (maxsize > 6 + _tcslen(s) + 2) {
+                                       if (maxsize > 6 + uaetcslen(s) + 2) {
                                                _stprintf(txt, _T("%5d %s\n"), j, s);
                                                _tcscat(out, txt);
-                                               maxsize -= _tcslen(txt) + 2;
+                                               maxsize -= uaetcslen(txt) + 2;
                                        }
                                        xfree(s);
                                }
index 9c3587f89e3bc08ee03ae1ea972c6db0d8dcb615..eb4702a6119e51e3f56f6f733ee875cfc07dff9a 100644 (file)
@@ -107,18 +107,18 @@ static const TCHAR *disasm_lc_hex2(const TCHAR *s, bool noprefix)
                        }
                        const TCHAR *s2 = _tcschr(tmp, '%');
                        if (s2) {
-                               int len = _tcslen(disasm_hexprefix);
+                               int len = uaetcslen(disasm_hexprefix);
                                if (s2 > tmp && s2[-1] == '$') {
                                        len--;
                                        s2--;
                                }
                                if (len < 0) {
-                                       memmove(tmp + (s2 - tmp), tmp + (s2 - tmp) - len, (_tcslen(tmp + (s2 - tmp) - len) + 1) * sizeof(TCHAR));
+                                       memmove(tmp + (s2 - tmp), tmp + (s2 - tmp) - len, (uaetcslen(tmp + (s2 - tmp) - len) + 1) * sizeof(TCHAR));
                                } else {
                                        if (len > 0) {
-                                               memmove(tmp + (s2 - tmp) + len, s2, (_tcslen(s2) + 1) * sizeof(TCHAR));
+                                               memmove(tmp + (s2 - tmp) + len, s2, (uaetcslen(s2) + 1) * sizeof(TCHAR));
                                        }
-                                       memcpy(tmp + (s2 - tmp), disasm_hexprefix, _tcslen(disasm_hexprefix) * sizeof(TCHAR));
+                                       memcpy(tmp + (s2 - tmp), disasm_hexprefix, uaetcslen(disasm_hexprefix) * sizeof(TCHAR));
                                }
                        }
                        return tmp;
@@ -1360,7 +1360,7 @@ int m68k_asm(TCHAR *sline, uae_u16 *out, uaecptr pc)
        int quick = 0;
        bool immrelpc = false;
 
-       if (_tcslen(sline) > 100)
+       if (uaetcslen(sline) > 100)
                return -1;
 
        srcea[0] = dstea[0] = 0;
@@ -1381,7 +1381,7 @@ int m68k_asm(TCHAR *sline, uae_u16 *out, uaecptr pc)
        }
        *p = 0;
 
-       to_upper(line, _tcslen(line));
+       to_upper(line, uaetcslen(line));
 
        p = line;
        while (*p && *p != ' ')
@@ -1393,7 +1393,7 @@ int m68k_asm(TCHAR *sline, uae_u16 *out, uaecptr pc)
        }
        _tcscpy(ins, line);
        
-       if (_tcslen(ins) == 0)
+       if (uaetcslen(ins) == 0)
                return 0;
 
        int size = 1;
@@ -1475,7 +1475,7 @@ int m68k_asm(TCHAR *sline, uae_u16 *out, uaecptr pc)
        }
        
        if (dmode == Areg) {
-               int l = _tcslen(ins);
+               int l = uaetcslen(ins);
                if (l <= 2)
                        return -1;
                TCHAR last = ins[l- 1];
@@ -1502,9 +1502,9 @@ int m68k_asm(TCHAR *sline, uae_u16 *out, uaecptr pc)
        bool fp = ins[0] == 'F';
        int tsize = size;
 
-       if (ins[_tcslen(ins) - 1] == 'Q' && _tcslen(ins) > 3 && !fp) {
+       if (ins[uaetcslen(ins) - 1] == 'Q' && uaetcslen(ins) > 3 && !fp) {
                quick = 1;
-               ins[_tcslen(ins) - 1] = 0;
+               ins[uaetcslen(ins) - 1] = 0;
                if (inssize < 0)
                        tsize = 2;
        }
@@ -2410,12 +2410,12 @@ uae_u32 m68k_disasm_2(TCHAR *buf, int bufsize, uaecptr pc, uae_u16 *bufpc, int b
                        TCHAR segout[256];
                        if (debugmem_get_symbol(segpc, segout, sizeof(segout) / sizeof(TCHAR))) {
                                _tcscat(segout, _T(":\n"));
-                               if (bufsize > _tcslen(segout)) {
-                                       memmove(symbolpos + _tcslen(segout), symbolpos, (_tcslen(symbolpos) + 1) * sizeof(TCHAR));
-                                       memcpy(symbolpos, segout, _tcslen(segout) * sizeof(TCHAR));
-                                       bufsize -= _tcslen(segout);
-                                       buf += _tcslen(segout);
-                                       symbolpos += _tcslen(segout);
+                               if (bufsize > uaetcslen(segout)) {
+                                       memmove(symbolpos + uaetcslen(segout), symbolpos, (uaetcslen(symbolpos) + 1) * sizeof(TCHAR));
+                                       memcpy(symbolpos, segout, uaetcslen(segout) * sizeof(TCHAR));
+                                       bufsize -= uaetcslen(segout);
+                                       buf += uaetcslen(segout);
+                                       symbolpos += uaetcslen(segout);
                                }
                        }
                }
index a6371b4bd8c545f146c2661cfae27eeda9d1f7d8..58204f9a33e656d21695f1432019a8bfdfb42de5 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -286,10 +286,10 @@ static int dirhash (const uae_char *name)
        uae_u32 hash;
        int i;
 
-       hash = strlen (name);
-       for(i = 0; i < strlen (name); i++) {
+       hash = uaestrlen(name);
+       for(i = 0; i < uaestrlen(name); i++) {
                hash = hash * 13;
-               hash = hash + toupper (name[i]);
+               hash = hash + toupper(name[i]);
                hash = hash & 0x7ff;
        }
        hash = hash % ((FS_FLOPPY_BLOCKSIZE / 4) - 56);
@@ -1037,7 +1037,7 @@ static void saveimagecutpathpart(TCHAR *name)
 {
        int i;
 
-       i = _tcslen (name) - 1;
+       i = uaetcslen(name) - 1;
        while (i > 0) {
                if (name[i] == '/' || name[i] == '\\') {
                        name[i] = 0;
@@ -1064,7 +1064,7 @@ static void saveimagecutfilepart(TCHAR *name)
        int i;
 
        _tcscpy(tmp, name);
-       i = _tcslen (tmp) - 1;
+       i = uaetcslen(tmp) - 1;
        while (i > 0) {
                if (tmp[i] == '/' || tmp[i] == '\\') {
                        _tcscpy(name, tmp + i + 1);
index 6ed5d0bc05d26d3e93dc0dd3827da8d77eb1afa7..59328141895e123ffdf0ed06128d9f8bc3bae832 100644 (file)
@@ -309,7 +309,7 @@ static void enforcer_display_hit (const TCHAR *addressmode, uae_u32 pc, uaecptr
                oldaddrs[i] = addr;
                if (j == i && addr != pc) {
                        if (enforcer_decode_hunk_and_offset (buf, addr)) {
-                               int l = _tcslen (buf);
+                               int l = uaetcslen (buf);
 
                                if (ENFORCER_BUF_SIZE - (enforcer_buf_ptr - enforcer_buf) > l + 256) {
                                        _tcscpy (enforcer_buf_ptr, buf);
index 58840cc3f563b7d406efd4874db9e781691039b1..1e7e6e9f948d472dddd97378767a32fda749e0ca 100644 (file)
@@ -743,14 +743,14 @@ static void stripsemicolon (TCHAR *s)
 {
        if (!s)
                return;
-       while (_tcslen(s) > 0 && s[_tcslen(s) - 1] == ':')
-               s[_tcslen(s) - 1] = 0;
+       while (uaetcslen(s) > 0 && s[uaetcslen(s) - 1] == ':')
+               s[uaetcslen(s) - 1] = 0;
 }
 static void stripspace (TCHAR *s)
 {
        if (!s)
                return;
-       for (int i = 0; i < _tcslen (s); i++) {
+       for (int i = 0; i < uaetcslen (s); i++) {
                if (s[i] == ' ')
                        s[i] = '_';
        }
@@ -759,17 +759,17 @@ static void striplength (TCHAR *s, int len)
 {
        if (!s)
                return;
-       if (_tcslen (s) <= len)
+       if (uaetcslen (s) <= len)
                return;
        s[len] = 0;
 }
-static void fixcharset (TCHAR *s)
+static void fixcharset(TCHAR *s)
 {
        char tmp[MAX_DPATH];
        if (!s)
                return;
-       ua_fs_copy (tmp, MAX_DPATH - 1, s, '_');
-       au_fs_copy (s, strlen (tmp) + 1, tmp);
+       ua_fs_copy(tmp, MAX_DPATH - 1, s, '_');
+       au_fs_copy(s, uaestrlen(tmp) + 1, tmp);
 }
 
 TCHAR *validatevolumename (TCHAR *s, const TCHAR *def)
@@ -777,7 +777,7 @@ TCHAR *validatevolumename (TCHAR *s, const TCHAR *def)
        stripsemicolon (s);
        fixcharset (s);
        striplength (s, 30);
-       if (_tcslen(s) == 0 && def) {
+       if (uaetcslen(s) == 0 && def) {
                xfree(s);
                s = my_strdup(def);
        }
@@ -789,7 +789,7 @@ TCHAR *validatedevicename (TCHAR *s, const TCHAR *def)
        stripspace (s);
        fixcharset (s);
        striplength (s, 30);
-       if (_tcslen(s) == 0 && def) {
+       if (uaetcslen(s) == 0 && def) {
                xfree(s);
                s = my_strdup(def);
        }
@@ -811,18 +811,18 @@ TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, struct
        else if (my_existsdir (path))
                archivehd = 0;
 
-       if (zv && zv->volumename && _tcslen(zv->volumename) > 0) {
+       if (zv && zv->volumename && uaetcslen(zv->volumename) > 0) {
                nvol = my_strdup(zv->volumename);
                nvol = validatevolumename (nvol, def);
                return nvol;
        }
 
-       if ((!volname || _tcslen (volname) == 0) && path && archivehd >= 0) {
+       if ((!volname || uaetcslen (volname) == 0) && path && archivehd >= 0) {
                p = my_strdup (path);
-               for (i = _tcslen (p) - 1; i >= 0; i--) {
+               for (i = uaetcslen (p) - 1; i >= 0; i--) {
                        TCHAR c = p[i];
                        if (c == ':' || c == '/' || c == '\\') {
-                               if (i == _tcslen (p) - 1)
+                               if (i == uaetcslen (p) - 1)
                                        continue;
                                if (!_tcscmp (p + i, _T(":\\"))) {
                                        xfree (p);
@@ -840,13 +840,13 @@ TCHAR *filesys_createvolname (const TCHAR *volname, const TCHAR *rootdir, struct
                        nvol = my_strdup (p + i);
        }
        if (!nvol && archivehd >= 0) {
-               if (volname && _tcslen (volname) > 0)
+               if (volname && uaetcslen (volname) > 0)
                        nvol = my_strdup (volname);
                else
                        nvol = my_strdup (def);
        }
        if (!nvol) {
-               if (volname && _tcslen (volname))
+               if (volname && uaetcslen (volname))
                        nvol = my_strdup (volname);
                else
                        nvol = my_strdup (_T(""));
@@ -1002,7 +1002,7 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci, bool custo
        for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
                if (nr == i || !mountinfo.ui[i].open || mountinfo.ui[i].rootdir == NULL || is_hardfile (i) == FILESYS_CD)
                        continue;
-               if (_tcslen(c.rootdir) > 0 && samepath(mountinfo.ui[i].rootdir, c.rootdir)) {
+               if (uaetcslen(c.rootdir) > 0 && samepath(mountinfo.ui[i].rootdir, c.rootdir)) {
                        error_log (_T("directory/hardfile '%s' already added."), c.rootdir);
                        return -1;
                }
@@ -1050,7 +1050,7 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci, bool custo
                ui->volname = filesys_createvolname (c.volname, c.rootdir, ui->zarchive, _T("harddrive"));
                ui->volflags = flags;
                TCHAR *vs = au(UAEFS_VERSION);
-               TCHAR *vsp = vs + _tcslen(vs) - 1;
+               TCHAR *vsp = vs + uaetcslen(vs) - 1;
                while (vsp != vs) {
                        if (*vsp == ' ') {
                                *vsp++ = 0;
@@ -1822,7 +1822,7 @@ static void set_volume_name(Unit *unit, struct mytimeval *tv)
        char *s;
 
        s = ua_fs (unit->ui.volname, -1);
-       namelen = strlen (s);
+       namelen = uaestrlen(s);
        if (namelen >= 58)
                namelen = 58;
        put_byte(unit->volume + 64, namelen);
@@ -1902,7 +1902,7 @@ static void filesys_delayed_change (Unit *u, int frames, const TCHAR *rootdir, c
        if (volume)
                u->newvolume = my_strdup (volume);
        filesys_eject (u->unit);
-       if (!rootdir || _tcslen (rootdir) == 0)
+       if (!rootdir || uaetcslen (rootdir) == 0)
                u->reinsertdelay = 0;
        if (u->reinsertdelay > 0)
                write_log (_T("FILESYS: delayed insert %d: '%s' ('%s')\n"), u->unit, volume ? volume : _T("<none>"), rootdir);
@@ -2232,7 +2232,7 @@ int filesys_media_change (const TCHAR *rootdir, int inserted, struct uaedev_conf
                if (is_virtual (u->unit)) {
                        ui = &mountinfo.ui[u->unit];
                        // inserted >= 2: drag&drop insert, do not replace existing normal drives
-                       if (inserted < 2 && ui->rootdir && !memcmp (ui->rootdir, rootdir, _tcslen (rootdir)) && _tcslen (rootdir) + 3 >= _tcslen (ui->rootdir)) {
+                       if (inserted < 2 && ui->rootdir && !memcmp (ui->rootdir, rootdir, uaetcslen (rootdir)) && uaetcslen (rootdir) + 3 >= uaetcslen (ui->rootdir)) {
                                if (filesys_isvolume(u) && inserted) {
                                        if (uci)ctx, 
                                                filesys_delayed_change (u, 50, rootdir, uci->ci.volname, uci->ci.readonly, 0);
@@ -2576,7 +2576,7 @@ void filesys_flush_cache (void)
 
 static void update_child_names (Unit *unit, a_inode *a, a_inode *parent)
 {
-       int l0 = _tcslen (parent->nname) + 2;
+       int l0 = uaetcslen (parent->nname) + 2;
 
        while (a != 0) {
                TCHAR *name_start;
@@ -2589,7 +2589,7 @@ static void update_child_names (Unit *unit, a_inode *a, a_inode *parent)
                        write_log (_T("malformed file name"));
                }
                name_start++;
-               new_name = xmalloc (TCHAR, _tcslen (name_start) + l0);
+               new_name = xmalloc (TCHAR, uaetcslen (name_start) + l0);
                _tcscpy (new_name, parent->nname);
                _tcscat (new_name, dirsep);
                _tcscat (new_name, name_start);
@@ -2708,7 +2708,7 @@ static a_inode *aino_from_lock(TrapContext *ctx, Unit *unit, uaecptr lock)
 TCHAR *build_nname (const TCHAR *d, const TCHAR *n)
 {
        TCHAR dsep[2] = { FSDB_DIR_SEPARATOR, 0 };
-       TCHAR *p = xmalloc (TCHAR, _tcslen (d) + 1 + _tcslen (n) + 1);
+       TCHAR *p = xmalloc (TCHAR, uaetcslen (d) + 1 + uaetcslen (n) + 1);
        _tcscpy (p, d);
        _tcscat (p, dsep);
        _tcscat (p, n);
@@ -2717,7 +2717,7 @@ TCHAR *build_nname (const TCHAR *d, const TCHAR *n)
 
 TCHAR *build_aname (const TCHAR *d, const TCHAR *n)
 {
-       TCHAR *p = xmalloc (TCHAR, _tcslen (d) + 1 + _tcslen (n) + 1);
+       TCHAR *p = xmalloc (TCHAR, uaetcslen (d) + 1 + uaetcslen (n) + 1);
        _tcscpy (p, d);
        _tcscat (p, _T("/"));
        _tcscat (p, n);
@@ -2970,7 +2970,7 @@ static a_inode *create_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int is
 static a_inode *lookup_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int *err)
 {
        a_inode *c = base->child;
-       int l0 = _tcslen (rel);
+       int l0 = uaetcslen (rel);
 
        aino_test (base);
        aino_test (c);
@@ -2981,7 +2981,7 @@ static a_inode *lookup_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int *e
        }
 
        while (c != 0) {
-               int l1 = _tcslen (c->aname);
+               int l1 = uaetcslen (c->aname);
                if (l0 <= l1 && same_aname (rel, c->aname + l1 - l0)
                        && (l0 == l1 || c->aname[l1-l0-1] == '/') && c->mountcount == unit->mountcount)
                        break;
@@ -2999,7 +2999,7 @@ static a_inode *lookup_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int *e
 static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR *rel, uae_u32 *err, uae_u64 uniq_external, struct virtualfilesysobject *vfso)
 {
        a_inode *c = base->child;
-       int l0 = _tcslen (rel);
+       int l0 = uaetcslen (rel);
        int isvirtual = unit->volflags & (MYVOLUMEINFO_ARCHIVE | MYVOLUMEINFO_CDFS);
 
        aino_test (base);
@@ -3007,7 +3007,7 @@ static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR *
 
        *err = 0;
        while (c != 0) {
-               int l1 = _tcslen (c->nname);
+               int l1 = uaetcslen (c->nname);
                /* Note: using _tcscmp here.  */
                if (l0 <= l1 && _tcscmp (rel, c->nname + l1 - l0) == 0
                        && (l0 == l1 || c->nname[l1-l0-1] == FSDB_DIR_SEPARATOR) && c->mountcount == unit->mountcount)
@@ -3771,7 +3771,7 @@ static void action_add_notify(TrapContext *ctx, Unit *unit, dpacket *packet)
        }
 #endif
 
-       p = name + _tcslen (name) - 1;
+       p = name + uaetcslen (name) - 1;
        if (p[0] == ':')
                p--;
        while (p > name && p[0] != ':' && p[0] != '/')
@@ -3896,7 +3896,7 @@ static void action_read_link_add_parent(Unit *u, a_inode *a, TCHAR *path)
                _tcscat (path, a->aname);
                _tcscat (path, _T(":"));
        } else {
-               if (path[0] && path[_tcslen (path) - 1] != ':')
+               if (path[0] && path[uaetcslen (path) - 1] != ':')
                        _tcscat (path, _T("/"));
                _tcscat (path, a->aname);
        }
@@ -3983,7 +3983,7 @@ static void action_read_link(TrapContext *ctx, Unit *unit, dpacket *packet)
                a = find_aino(ctx, unit, lock, namep, &err);
                if (err != ERROR_IS_SOFT_LINK)
                        break;
-               for (i = _tcslen (namep) - 1; i > 0; i--) {
+               for (i = uaetcslen (namep) - 1; i > 0; i--) {
                        if (namep[i] == '/') {
                                namep[i] = 0;
                                xfree (extrapath);
@@ -4205,7 +4205,7 @@ static void get_fileinfo(TrapContext *ctx, Unit *unit, dpacket *packet, uaecptr
 
        TRACE((_T("name=\"%s\"\n"), xs));
        x2 = x = ua_fs (xs, -1);
-       n = strlen (x);
+       n = uaestrlen(x);
        if (n > 107)
                n = 107;
        if (n > abs(currprefs.filesys_max_name))
@@ -4253,7 +4253,7 @@ static void get_fileinfo(TrapContext *ctx, Unit *unit, dpacket *packet, uaecptr
                if (!xs)
                        xs= _T("");
                x2 = x = ua_fs(xs, -1);
-               n = strlen(x);
+               n = uaestrlen(x);
                if (n > 78)
                        n = 78;
                put_byte_host(buf + i, n); i++;
@@ -4537,7 +4537,7 @@ static int exalldo(TrapContext *ctx, uaecptr exalldata, uae_u32 exalldatasize, u
        size2 = 4;
        if (type >= 1) {
                size2 += 4;
-               size += strlen (x) + 1;
+               size += uaestrlen(x) + 1;
                size = (size + 3) & ~3;
        }
        if (type >= 2)
@@ -4558,8 +4558,8 @@ static int exalldo(TrapContext *ctx, uaecptr exalldata, uae_u32 exalldatasize, u
                        commentx = _T("");
                else
                        commentx = aino->comment;
-               comment = ua_fs (commentx, -1);
-               size += strlen (comment) + 1;
+               comment = ua_fs(commentx, -1);
+               size += uaestrlen(comment) + 1;
                size = (size + 3) & ~3;
        }
        if (type >= 7) {
@@ -4631,7 +4631,7 @@ end:
 
 static bool filesys_name_invalid(const TCHAR *fn)
 {
-       return _tcslen (fn) > currprefs.filesys_max_name;
+       return uaetcslen (fn) > currprefs.filesys_max_name;
 }
 
 static int filesys_readdir(struct fs_dirhandle *d, TCHAR *fn, uae_u64 *uniq)
@@ -4937,7 +4937,7 @@ static void load_injected_icons(void)
 static void inject_icons_to_directory(Unit *unit, a_inode *base)
 {
        for (a_inode *aino = base->child; aino; aino = aino->sibling) {
-               int len = _tcslen(aino->aname);
+               int len = uaetcslen(aino->aname);
                if (len >= 5 && !_tcsicmp(aino->aname + len - 5, _T(".info")))
                        continue;
                TCHAR tmp[256];
@@ -5709,12 +5709,12 @@ static void action_set_comment(TrapContext *ctx, Unit * unit, dpacket *packet)
 
        if (fsdb_cando (unit)) {
                commented = bstr(ctx, unit, comment);
-               if (_tcslen (commented) > 80) {
+               if (uaetcslen (commented) > 80) {
                        PUT_PCK_RES1 (packet, DOS_FALSE);
                        PUT_PCK_RES2 (packet, ERROR_COMMENT_TOO_BIG);
                        return;
                }
-               if (_tcslen (commented) > 0) {
+               if (uaetcslen (commented) > 0) {
                        TCHAR *p = commented;
                        commented = xmalloc (TCHAR, 81);
                        _tcsncpy (commented, p, 80);
@@ -8187,8 +8187,8 @@ static TCHAR *device_dupfix (TrapContext *ctx, uaecptr expbase, TCHAR *devname)
        while (modified) {
                modified = 0;
                if (device_isdup (ctx, expbase, newname)) {
-                       if (_tcslen (newname) > 2 && newname[_tcslen (newname) - 2] == '_') {
-                               newname[_tcslen (newname) - 1]++;
+                       if (uaetcslen (newname) > 2 && newname[uaetcslen (newname) - 2] == '_') {
+                               newname[uaetcslen (newname) - 1]++;
                        } else {
                                _tcscat (newname, _T("_0"));
                        }
@@ -8210,7 +8210,7 @@ static const TCHAR *dostypes(TCHAR *dt, uae_u32 dostype)
                } else {
                        dt[j++] = '\\';
                        _stprintf (&dt[j], _T("%d"), c);
-                       j += _tcslen (&dt[j]);
+                       j += uaetcslen (&dt[j]);
                }
        }
        dt[j] = 0;
@@ -8349,7 +8349,7 @@ static void get_new_device (TrapContext *ctx, int type, uaecptr parmpacket, TCHA
        TCHAR buffer[80];
        uaecptr expbase = trap_get_long(ctx, parmpacket + PP_EXPLIB);
 
-       if (*devname == 0 || _tcslen (*devname) == 0) {
+       if (*devname == 0 || uaetcslen (*devname) == 0) {
                int un = unit_no;
                for (;;) {
                        _stprintf (buffer, type == FILESYS_CD ? _T("CD%d") : _T("DH%d"), un++);
@@ -8758,7 +8758,7 @@ static void addfakefilesys (TrapContext *ctx, uaecptr parmpacket, uae_u32 dostyp
 
 static uaecptr getfakefilesysseg (UnitInfo *uip)
 {
-       if (uip->filesysdir && _tcslen (uip->filesysdir) > 0) {
+       if (uip->filesysdir && uaetcslen (uip->filesysdir) > 0) {
                for (int i = 0; &mountinfo.ui[i] != uip; i++) {
                        UnitInfo *uip2 = &mountinfo.ui[i];
                        if (!uip2->filesysdir)
@@ -8813,11 +8813,11 @@ static int dofakefilesys (TrapContext *ctx, UnitInfo *uip, uaecptr parmpacket, s
        }
 
        tmp[0] = 0;
-       if (uip->filesysdir && _tcslen (uip->filesysdir) > 0) {
+       if (uip->filesysdir && uaetcslen (uip->filesysdir) > 0) {
                cfgfile_resolve_path_out_load(uip->filesysdir, tmp, MAX_DPATH, PATH_HDF);
        } else if ((dostype & 0xffffff00) == DISK_TYPE_DOS) {
                _tcscpy (tmp, currprefs.romfile);
-               int i = _tcslen (tmp);
+               int i = uaetcslen (tmp);
                while (i > 0 && tmp[i - 1] != '/' && tmp[i - 1] != '\\')
                        i--;
                _tcscpy (tmp + i, _T("FastFileSystem"));
@@ -9560,7 +9560,7 @@ static a_inode *restore_filesys_get_base (Unit *u, TCHAR *npath)
        /* iterate from root to last to previous path part,
        * create ainos if not already created.
        */
-       path = xcalloc(TCHAR, _tcslen (npath) + 2);
+       path = xcalloc(TCHAR, uaetcslen (npath) + 2);
        cnt = 1;
        for (;;) {
                _tcscpy (path, npath);
@@ -9625,10 +9625,10 @@ static TCHAR *makenativepath (UnitInfo *ui, TCHAR *apath)
 {
        TCHAR *pn;
        /* create native path. FIXME: handle 'illegal' characters */
-       pn = xcalloc (TCHAR, _tcslen (apath) + 1 + _tcslen (ui->rootdir) + 1);
+       pn = xcalloc (TCHAR, uaetcslen (apath) + 1 + uaetcslen (ui->rootdir) + 1);
        _stprintf (pn, _T("%s/%s"), ui->rootdir, apath);
        if (FSDB_DIR_SEPARATOR != '/') {
-               for (int i = 0; i < _tcslen (pn); i++) {
+               for (int i = 0; i < uaetcslen (pn); i++) {
                        if (pn[i] == '/')
                                pn[i] = FSDB_DIR_SEPARATOR;
                }
@@ -9809,7 +9809,7 @@ static uae_u8 *restore_notify (UnitInfo *ui, Unit *u, uae_u8 *src)
 
        n->notifyrequest = restore_u32 ();
        s = restore_string ();
-       n->fullname = xmalloc (TCHAR, _tcslen (ui->volname) + 2 + _tcslen (s) + 1);
+       n->fullname = xmalloc (TCHAR, uaetcslen (ui->volname) + 2 + uaetcslen (s) + 1);
        _stprintf (n->fullname, _T("%s:%s"), ui->volname, s);
        xfree(s);
        s = _tcsrchr (n->fullname, '/');
@@ -9880,8 +9880,8 @@ static TCHAR *getfullaname (a_inode *a)
 
        p = xcalloc (TCHAR, MAX_DPATH);
        while (a) {
-               int len = _tcslen (a->aname);
-               memmove (p + len + 1, p, (_tcslen (p) + 1) * sizeof (TCHAR));
+               int len = uaetcslen (a->aname);
+               memmove (p + len + 1, p, (uaetcslen (p) + 1) * sizeof (TCHAR));
                memcpy (p, a->aname, len * sizeof (TCHAR));
                if (!first)
                        p[len] = '/';
@@ -9961,8 +9961,8 @@ static uae_u8 *save_notify (UnitInfo *ui, uae_u8 *dst, Notify *n)
        TCHAR *s;
        save_u32 (n->notifyrequest);
        s = n->fullname;
-       if (_tcslen (s) >= _tcslen (ui->volname) && !_tcsncmp (n->fullname, ui->volname, _tcslen (ui->volname)))
-               s = n->fullname + _tcslen (ui->volname) + 1;
+       if (uaetcslen (s) >= uaetcslen (ui->volname) && !_tcsncmp (n->fullname, ui->volname, uaetcslen (ui->volname)))
+               s = n->fullname + uaetcslen (ui->volname) + 1;
        save_string (s);
        write_log (_T("FS: notify %08X '%s'\n"), n->notifyrequest, n->fullname);
        return dst;
@@ -10310,12 +10310,12 @@ static uae_u32 filesys_shellexecute2_process(int mode, TrapContext *ctx)
                        se2->file = strdup(tmp);
                }
                int size = ShellExecute2_Struct_Start + ShellExecute2_Struct_Start2;
-               size += 2 * (strlen(se2->file) + 1);
+               size += 2 * (uaestrlen(se2->file) + 1);
                if (oldks) {
-                       size += 4 + strlen(se2->currentdir) + 2; // CD_""\n
+                       size += 4 + uaestrlen(se2->currentdir) + 2; // CD_""\n
                }
-               size += strlen(se2->currentdir) + 1;
-               size += 2 * (strlen(se2->parms) + 1);
+               size += uaestrlen(se2->currentdir) + 1;
+               size += 2 * (uaestrlen(se2->parms) + 1);
                size += 32; // space for tmp_out
                size += 256; // space for out buffer
                size++;
index a0668fb9c7f362e437bddfb2a7a6f88c1764f722..d66b694340798e8d942bcc9d0ac6d9caf95c88f7 100644 (file)
@@ -1151,7 +1151,7 @@ static void fp_from_pack (fpdata *src, uae_u32 *wrd, int kfactor)
        strp[1] = strp[0];
        strp++;
        // add trailing zeros
-       i = strlen (strp);
+       i = uaestrlen(strp);
        cp = strp + i;
        while (i < ndigits) {
                *cp++ = '0';
diff --git a/ide.cpp b/ide.cpp
index 6edbdac07f14ac3ceefc5ad19266b88127c10987..8c1a52100c5e64778b93a6d82591a78491138756 100644 (file)
--- a/ide.cpp
+++ b/ide.cpp
@@ -330,8 +330,8 @@ static void ps (struct ide_hdf *ide, int offset, const TCHAR *src, int max)
        int i, len;
        char *s;
 
-       s = ua (src);
-       len = strlen (s);
+       s = ua(src);
+       len = uaestrlen(s);
        for (i = 0; i < max; i += 2) {
                char c1 = ' ';
                if (i < len)
index 835e6bbdf3aa8480f8f3aad86ec28ef73d664256..5b4dfd76eb8f86d0eb99fc5a230bcdd820947d18 100644 (file)
@@ -239,6 +239,8 @@ extern TCHAR *utf8u (const char *s);
 extern void unicode_init (void);
 extern void to_lower (TCHAR *s, int len);
 extern void to_upper (TCHAR *s, int len);
+extern int uaestrlen(const char*);
+extern int uaetcslen(const TCHAR*);
 
 #define ENUMDECL typedef enum
 #define ENUMNAME(name) name
index 0966f24b895f5770f722b972caf20e36b226d44b..fb11bc867d37401f1568827161c1b1165aedc7f8 100644 (file)
@@ -116,6 +116,7 @@ void trap_set_areg(TrapContext *ctx, int reg, uae_u32 v);
 
 void trap_put_quad(TrapContext *ctx, uaecptr addr, uae_u64 v);
 void trap_put_long(TrapContext *ctx, uaecptr addr, uae_u32 v);
+void trap_put_longt(TrapContext *ctx, uaecptr addr, size_t v);
 void trap_put_word(TrapContext *ctx, uaecptr addr, uae_u16 v);
 void trap_put_byte(TrapContext *ctx, uaecptr addr, uae_u8 v);
 
diff --git a/ini.cpp b/ini.cpp
index cc47d7cc7c9bc389262ede56807cacf8412c00b3..6528b53387dc0b1cf7a092f86f27037b81d29381 100644 (file)
--- a/ini.cpp
+++ b/ini.cpp
@@ -408,7 +408,7 @@ bool ini_getdata_multi(struct ini_data *ini, const TCHAR *section, const TCHAR *
        if (!ini_getstring_multi(ini, section, key, &out2, ctx))
                return false;
 
-       len = _tcslen(out2);
+       len = uaetcslen(out2);
        outp = xcalloc(uae_u8, len);
        if (!outp)
                goto err;
index d4811f54e65a36f9948bc0bd436b19a024f131ec..b5f44bc8dbc68d269574c9729ec988851a397f57 100644 (file)
--- a/isofs.cpp
+++ b/isofs.cpp
@@ -1061,7 +1061,7 @@ repeat:
                                int l = p[0];
                                char t = p[l];
                                p[l] = 0;
-                               au_copy (inode->i_comment + _tcslen (inode->i_comment), maxcomment + 1 - _tcslen (inode->i_comment), p + 1);
+                               au_copy (inode->i_comment + uaetcslen (inode->i_comment), maxcomment + 1 - uaetcslen (inode->i_comment), p + 1);
                                p[l] = t;
                        }
                        break;
index 2c81d191c078b29dc7f490d7329064ca38f9d4c2..d1ff678406e7c753421063ca163bb03475591301 100644 (file)
@@ -573,7 +573,7 @@ LOWFUNC(READ,NONE,3,raw_cmov_l_rr,(RW4 d, R4 s, IMM cc))
                uae_s8 *target_p = (uae_s8 *)x86_get_target() + 1;
                JCCSii(cc^1, 0);
                MOVLrr(s, d);
-               *target_p = (uintptr)x86_get_target() - ((uintptr)target_p + 1);
+               *target_p = JITPTR x86_get_target() - (JITPTR target_p + 1);
        }
 }
 
@@ -716,7 +716,7 @@ LOWFUNC(NONE,READ,5,raw_cmov_l_rm_indexed,(W4 d, IMM base, R4 index, IMM factor,
                uae_s8 *target_p = (uae_s8 *)x86_get_target() + 1;
                JCCSii(cond^1, 0);
                ADDR32 MOVLmr(base, X86_NOREG, index, factor, d);
-               *target_p = (uintptr)x86_get_target() - ((uintptr)target_p + 1);
+               *target_p = JITPTR x86_get_target() - (JITPTR target_p + 1);
        }
 }
 
@@ -728,7 +728,7 @@ LOWFUNC(NONE,READ,3,raw_cmov_l_rm,(W4 d, IMM mem, IMM cond))
                uae_s8 *target_p = (uae_s8 *)x86_get_target() + 1;
                JCCSii(cond^1, 0);
                ADDR32 MOVLmr(mem, X86_NOREG, X86_NOREG, 1, d);
-               *target_p = (uintptr)x86_get_target() - ((uintptr)target_p + 1);
+               *target_p = JITPTR x86_get_target() - (JITPTR target_p + 1);
        }
 }
 
@@ -1210,19 +1210,19 @@ static inline void raw_jnz_l_oponly(void)
 static inline void raw_jl(uae_u32 t)
 {
        raw_jcc_l_oponly(NATIVE_CC_LT);
-       emit_long(t-(uae_u32)(uintptr)target-4);
+       emit_long(t-(uae_u32)JITPTR target-4);
 }
 
 static inline void raw_jz(uae_u32 t)
 {
        raw_jz_l_oponly();
-       emit_long(t-(uae_u32)(uintptr)target-4);
+       emit_long(t-(uae_u32)JITPTR target-4);
 }
 
 static inline void raw_jnz(uae_u32 t)
 {
        raw_jnz_l_oponly();
-       emit_long(t-(uae_u32)(uintptr)target-4);
+       emit_long(t-(uae_u32)JITPTR target-4);
 }
 
 static inline void raw_jcc_b_oponly(int cc)
@@ -1368,11 +1368,11 @@ static inline void raw_flags_to_reg_FLAGREG(int r)
 {
        raw_lahf(0);  /* Most flags in AH */
        //raw_setcc(r,0); /* V flag in AL */
-       raw_setcc_m((uintptr)live.state[FLAGTMP].mem,0);
+       raw_setcc_m(JITPTR live.state[FLAGTMP].mem,0);
 
 #if 1   /* Let's avoid those nasty partial register stalls */
-       //raw_mov_b_mr((uintptr)live.state[FLAGTMP].mem,r);
-       raw_mov_b_mr(((uintptr)live.state[FLAGTMP].mem)+1,AH_INDEX);
+       //raw_mov_b_mr(JITPTR live.state[FLAGTMP].mem,r);
+       raw_mov_b_mr((JITPTR live.state[FLAGTMP].mem)+1,AH_INDEX);
        raw_flags_evicted(r);
 #endif
 }
@@ -1405,7 +1405,7 @@ static inline void raw_flags_to_reg_FLAGSTK(int r)
 {
        raw_pushfl();
        raw_pop_l_r(r);
-       raw_mov_l_mr((uintptr)live.state[FLAGTMP].mem,r);
+       raw_mov_l_mr(JITPTR live.state[FLAGTMP].mem,r);
        raw_flags_evicted(r);
 }
 
@@ -1451,9 +1451,9 @@ static inline void raw_flags_to_reg_FLAGGEN(int r)
                assert(r == 0);
                raw_setcc(r,0);                                 /* V flag in AL */
                raw_lea_l_r_scaled(0,0,8);              /* move it to its EFLAGS location */
-               raw_mov_b_mr(((uintptr)live.state[FLAGTMP].mem)+1,0);
+               raw_mov_b_mr((JITPTR live.state[FLAGTMP].mem)+1,0);
                raw_lahf(0);                                    /* most flags in AH */
-               raw_mov_b_mr((uintptr)live.state[FLAGTMP].mem,AH_INDEX);
+               raw_mov_b_mr(JITPTR live.state[FLAGTMP].mem,AH_INDEX);
                raw_flags_evicted(r);
        }
        else
@@ -1521,20 +1521,20 @@ static inline void raw_flags_init_FLAGGEN(void)
 static inline void raw_load_flagreg(uae_u32 target)
 {
        /* attention: in 64bit mode, relies on LITTE_ENDIANESS of regflags.cznv */
-       raw_mov_l_rm(target,(uintptr)live.state[FLAGTMP].mem);
+       raw_mov_l_rm(target,JITPTR live.state[FLAGTMP].mem);
 }
 
 static inline void raw_load_flagx(uae_u32 target)
 {
 #if FLAGBIT_X < 8
        if (live.nat[target].canbyte)
-               raw_mov_b_rm(target,(uintptr)live.state[FLAGX].mem);
+               raw_mov_b_rm(target,JITPTR live.state[FLAGX].mem);
        else
 #endif
        if (live.nat[target].canword)
-               raw_mov_w_rm(target,(uintptr)live.state[FLAGX].mem);
+               raw_mov_w_rm(target,JITPTR live.state[FLAGX].mem);
        else
-               raw_mov_l_rm(target,(uintptr)live.state[FLAGX].mem);
+               raw_mov_l_rm(target,JITPTR live.state[FLAGX].mem);
 }
 
 static inline void raw_dec_sp(int off)
@@ -2108,7 +2108,7 @@ LOWFUNC(NONE,WRITE,3,raw_fmovi_mrb,(MEMPTRW m, FR r, double *bounds))
        rs = stackpos(r)+1;
 
        /* Lower bound onto stack */
-       raw_fldl((uintptr) &bounds[0]); /* fld double from lower */
+       raw_fldl(JITPTR  &bounds[0]); /* fld double from lower */
 
        /* Clamp to lower */
        emit_byte(0xdb);
@@ -2119,7 +2119,7 @@ LOWFUNC(NONE,WRITE,3,raw_fmovi_mrb,(MEMPTRW m, FR r, double *bounds))
        /* Upper bound onto stack */
        emit_byte(0xdd);
        emit_byte(0xd8);        /* fstp st(0) */
-       raw_fldl((uintptr) &bounds[1]); /* fld double from upper */
+       raw_fldl(JITPTR  &bounds[1]); /* fld double from upper */
 
        /* Clamp to upper */
        emit_byte(0xdb);
@@ -2360,7 +2360,7 @@ LOWFUNC(NONE,NONE,2,raw_ftwotox_rr,(FW d, FR s))
        emit_byte(0xe1);    /* fsub frac(x) = x - int(x) */
        emit_byte(0xd9);
        emit_byte(0xf0);    /* f2xm1 (2^frac(x))-1 */
-       x86_fadd_m((uintptr) &one); /* Add '1' without using extra stack space */
+       x86_fadd_m(JITPTR  &one); /* Add '1' without using extra stack space */
        emit_byte(0xd9);
        emit_byte(0xfd);    /* fscale (2^frac(x))*2^int(x) */
        emit_byte(0xdd);
@@ -2391,7 +2391,7 @@ LOWFUNC(NONE,NONE,2,raw_fetox_rr,(FW d, FR s))
        emit_byte(0xe1);  /* subtract rounded from original */
        emit_byte(0xd9);
        emit_byte(0xf0);  /* f2xm1 */
-       x86_fadd_m((uintptr)&one);      /* Add '1' without using extra stack space */
+       x86_fadd_m(JITPTR &one);        /* Add '1' without using extra stack space */
        emit_byte(0xd9);
        emit_byte(0xfd);  /* and scale it */
        emit_byte(0xdd);
@@ -2639,7 +2639,7 @@ LOWFUNC(NONE,NONE,2,raw_ftentox_rr,(FW d, FR s))
        emit_byte(0xe1);    /* fsub x*log2(10) - int(x*log2(10))  */
        emit_byte(0xd9);
        emit_byte(0xf0);    /* f2xm1 (2^frac(x))-1 */
-       x86_fadd_m((uintptr) &one);
+       x86_fadd_m(JITPTR  &one);
        emit_byte(0xd9);
        emit_byte(0xfd);    /* fscale (2^frac(x))*2^int(x*log2(10)) */
        emit_byte(0xdd);
@@ -2937,7 +2937,7 @@ LOWFUNC(NONE,NONE,2,raw_facos_rr,(FW d, FR s))
        emit_byte(0xc9);    /* fxch swap x with sqrt(1-(x^2))  */
        emit_byte(0xd9);
        emit_byte(0xf3);    /* fpatan atan(x/sqrt(1-(x^2))) & pop */
-       raw_fldt((uintptr) &pihalf); /* fld load pi/2 from pihalf */
+       raw_fldt(JITPTR  &pihalf); /* fld load pi/2 from pihalf */
        emit_byte(0xde);
        emit_byte(0xe1);    /* fsubrp pi/2 - asin(x) & pop */
        tos_make(d);        /* store y=acos(x) */
@@ -3037,7 +3037,7 @@ LOWFUNC(NONE,NONE,2,raw_fsinh_rr,(FW d, FR s))
        emit_byte(0xe1);     /* fsub -x*log2(e) - int(-x*log2(e))  */
        emit_byte(0xd9);
        emit_byte(0xf0);     /* f2xm1 (2^frac(x))-1 */
-       x86_fadd_m((uintptr) &one);
+       x86_fadd_m(JITPTR  &one);
        emit_byte(0xd9);
        emit_byte(0xfd);     /* fscale (2^frac(x))*2^int(x*log2(e)) */
        emit_byte(0xd9);
@@ -3052,7 +3052,7 @@ LOWFUNC(NONE,NONE,2,raw_fsinh_rr,(FW d, FR s))
        emit_byte(0xe1);     /* fsub x*log2(e) - int(x*log2(e))  */
        emit_byte(0xd9);
        emit_byte(0xf0);     /* f2xm1 (2^frac(x))-1 */
-       x86_fadd_m((uintptr) &one);
+       x86_fadd_m(JITPTR  &one);
        emit_byte(0xd9);
        emit_byte(0xfd);     /* fscale (2^frac(x))*2^int(x*log2(e)) */
        emit_byte(0xdd);
@@ -3129,7 +3129,7 @@ LOWFUNC(NONE,NONE,2,raw_fcosh_rr,(FW d, FR s))
        emit_byte(0xe1);     /* fsub -x*log2(e) - int(-x*log2(e))  */
        emit_byte(0xd9);
        emit_byte(0xf0);     /* f2xm1 (2^frac(x))-1 */
-       x86_fadd_m((uintptr) &one);
+       x86_fadd_m(JITPTR  &one);
        emit_byte(0xd9);
        emit_byte(0xfd);     /* fscale (2^frac(x))*2^int(x*log2(e)) */
        emit_byte(0xd9);
@@ -3144,7 +3144,7 @@ LOWFUNC(NONE,NONE,2,raw_fcosh_rr,(FW d, FR s))
        emit_byte(0xe1);     /* fsub x*log2(e) - int(x*log2(e))  */
        emit_byte(0xd9);
        emit_byte(0xf0);     /* f2xm1 (2^frac(x))-1 */
-       x86_fadd_m((uintptr) &one);
+       x86_fadd_m(JITPTR  &one);
        emit_byte(0xd9);
        emit_byte(0xfd);     /* fscale (2^frac(x))*2^int(x*log2(e)) */
        emit_byte(0xdd);
@@ -3217,7 +3217,7 @@ LOWFUNC(NONE,NONE,2,raw_ftanh_rr,(FW d, FR s))
        emit_byte(0xe1);     /* fsub -x*log2(e) - int(-x*log2(e))  */
        emit_byte(0xd9);
        emit_byte(0xf0);     /* f2xm1 (2^frac(x))-1 */
-       x86_fadd_m((uintptr) &one);
+       x86_fadd_m(JITPTR  &one);
        emit_byte(0xd9);
        emit_byte(0xfd);     /* fscale (2^frac(x))*2^int(x*log2(e)) */
        emit_byte(0xd9);
@@ -3232,7 +3232,7 @@ LOWFUNC(NONE,NONE,2,raw_ftanh_rr,(FW d, FR s))
        emit_byte(0xe1);     /* fsub x*log2(e) - int(x*log2(e))  */
        emit_byte(0xd9);
        emit_byte(0xf0);     /* f2xm1 (2^frac(x))-1 */
-       x86_fadd_m((uintptr) &one);
+       x86_fadd_m(JITPTR  &one);
        emit_byte(0xd9);
        emit_byte(0xfd);     /* fscale (2^frac(x))*2^int(x*log2(e)) */
        emit_byte(0xdd);
index 9d0fac8fb64b48fc6d77df9e7e40c34877724af0..f3d6ff8476625764a92fdf0b9e67609d12676d92 100644 (file)
@@ -139,25 +139,25 @@ STATIC_INLINE int get_fp_value(uae_u32 opcode, uae_u16 extra)
                {
                case 6: /* byte */
                        sign_extend_8_rr(S1, reg);
-                       mov_l_mr((uintptr) temp_fp, S1);
+                       mov_l_mr(JITPTR temp_fp, S1);
                        delay2;
-                       fmovi_rm(FS1, (uintptr) temp_fp);
+                       fmovi_rm(FS1, JITPTR temp_fp);
                        return FS1;
                case 4: /* word */
                        sign_extend_16_rr(S1, reg);
-                       mov_l_mr((uintptr) temp_fp, S1);
+                       mov_l_mr(JITPTR temp_fp, S1);
                        delay2;
-                       fmovi_rm(FS1, (uintptr) temp_fp);
+                       fmovi_rm(FS1, JITPTR temp_fp);
                        return FS1;
                case 0: /* long */
-                       mov_l_mr((uintptr) temp_fp, reg);
+                       mov_l_mr(JITPTR temp_fp, reg);
                        delay2;
-                       fmovi_rm(FS1, (uintptr) temp_fp);
+                       fmovi_rm(FS1, JITPTR temp_fp);
                        return FS1;
                case 1: /* single precision */
-                       mov_l_mr((uintptr) temp_fp, reg);
+                       mov_l_mr(JITPTR temp_fp, reg);
                        delay2;
-                       fmovs_rm(FS1, (uintptr) temp_fp);
+                       fmovs_rm(FS1, JITPTR temp_fp);
                        return FS1;
                default:
                        return -1;
@@ -240,7 +240,7 @@ STATIC_INLINE int get_fp_value(uae_u32 opcode, uae_u16 extra)
                        break;
                case 2: /* d16(pc) */
                        {
-                               uae_u32 address = start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset;
+                               uae_u32 address = (uae_u32)(start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset);
                                uae_s32 PC16off = (uae_s32) (uae_s16) comp_get_iword((m68k_pc_offset += 2) - 2);
 
                                ad = S1;
@@ -251,7 +251,7 @@ STATIC_INLINE int get_fp_value(uae_u32 opcode, uae_u16 extra)
                        return -1;
                case 4: /* #imm */
                        {
-                               uae_u32 address = start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset;
+                               uae_u32 address = (uae_u32)(start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset);
 
                                ad = S1;
                                // Immediate addressing mode && Operation Length == Byte -> 
@@ -271,54 +271,54 @@ STATIC_INLINE int get_fp_value(uae_u32 opcode, uae_u16 extra)
        {
        case 0: /* long */
                readlong(ad, S2, S3);
-               mov_l_mr((uintptr) temp_fp, S2);
+               mov_l_mr(JITPTR temp_fp, S2);
                delay2;
-               fmovi_rm(FS1, (uintptr) temp_fp);
+               fmovi_rm(FS1, JITPTR temp_fp);
                break;
        case 1: /* single precision */
                readlong(ad, S2, S3);
-               mov_l_mr((uintptr) temp_fp, S2);
+               mov_l_mr(JITPTR temp_fp, S2);
                delay2;
-               fmovs_rm(FS1, (uintptr) temp_fp);
+               fmovs_rm(FS1, JITPTR temp_fp);
                break;
        case 2: /* extended precision */
                readword(ad, S2, S3);
-               mov_w_mr(((uintptr) temp_fp) + 8, S2);
+               mov_w_mr((JITPTR temp_fp) + 8, S2);
                add_l_ri(ad, 4);
                readlong(ad, S2, S3);
                // always set the explicit integer bit.
                or_l_ri(S2, 0x80000000);
-               mov_l_mr((uintptr) (temp_fp) + 4, S2);
+               mov_l_mr(JITPTR (temp_fp) + 4, S2);
                add_l_ri(ad, 4);
                readlong(ad, S2, S3);
-               mov_l_mr((uintptr) (temp_fp), S2);
+               mov_l_mr(JITPTR (temp_fp), S2);
                delay2;
-               fmov_ext_rm(FS1, (uintptr) (temp_fp));
+               fmov_ext_rm(FS1, JITPTR (temp_fp));
                break;
        case 3: /* packed decimal static */
                return -1;                                              /* Some silly "packed" stuff */
        case 4: /* word */
                readword(ad, S2, S3);
                sign_extend_16_rr(S2, S2);
-               mov_l_mr((uintptr) temp_fp, S2);
+               mov_l_mr(JITPTR temp_fp, S2);
                delay2;
-               fmovi_rm(FS1, (uintptr) temp_fp);
+               fmovi_rm(FS1, JITPTR temp_fp);
                break;
        case 5: /* double precision */
                readlong(ad, S2, S3);
-               mov_l_mr(((uintptr) temp_fp) + 4, S2);
+               mov_l_mr((JITPTR temp_fp) + 4, S2);
                add_l_ri(ad, 4);
                readlong(ad, S2, S3);
-               mov_l_mr((uintptr) (temp_fp), S2);
+               mov_l_mr(JITPTR (temp_fp), S2);
                delay2;
-               fmov_rm(FS1, (uintptr) (temp_fp));
+               fmov_rm(FS1, JITPTR (temp_fp));
                break;
        case 6: /* byte */
                readbyte(ad, S2, S3);
                sign_extend_8_rr(S2, S2);
-               mov_l_mr((uintptr) temp_fp, S2);
+               mov_l_mr(JITPTR temp_fp, S2);
                delay2;
-               fmovi_rm(FS1, (uintptr) temp_fp);
+               fmovi_rm(FS1, JITPTR temp_fp);
                break;
        default:
                return -1;
@@ -366,25 +366,25 @@ STATIC_INLINE int put_fp_value(int val, uae_u32 opcode, uae_u16 extra)
                switch (size)
                {
                case 6: /* byte */
-                       fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.b);
+                       fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.b);
                        delay;
-                       mov_b_rm(reg, (uintptr) temp_fp);
+                       mov_b_rm(reg, JITPTR temp_fp);
                        return 0;
                case 4: /* word */
-                       fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.w);
+                       fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.w);
                        delay;
-                       mov_w_rm(reg, (uintptr) temp_fp);
+                       mov_w_rm(reg, JITPTR temp_fp);
                        return 0;
                case 0: /* long */
-                       fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.l);
-                       fmovi_mr((uintptr) temp_fp, val);
+                       fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.l);
+                       fmovi_mr(JITPTR temp_fp, val);
                        delay;
-                       mov_l_rm(reg, (uintptr) temp_fp);
+                       mov_l_rm(reg, JITPTR temp_fp);
                        return 0;
                case 1: /* single precision */
-                       fmovs_mr((uintptr) temp_fp, val);
+                       fmovs_mr(JITPTR temp_fp, val);
                        delay;
-                       mov_l_rm(reg, (uintptr) temp_fp);
+                       mov_l_rm(reg, JITPTR temp_fp);
                        return 0;
                default:
                        return -1;
@@ -465,7 +465,7 @@ STATIC_INLINE int put_fp_value(int val, uae_u32 opcode, uae_u16 extra)
                        break;
                case 2: /* d16(pc) */
                        {
-                               uae_u32 address = start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset;
+                               uae_u32 address = (uae_u32)(start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset);
                                uae_s32 PC16off = (uae_s32) (uae_s16) comp_get_iword((m68k_pc_offset += 2) - 2);
 
                                ad = S1;
@@ -476,7 +476,7 @@ STATIC_INLINE int put_fp_value(int val, uae_u32 opcode, uae_u16 extra)
                        return -1;
                case 4: /* #imm */
                        {
-                               uae_u32 address = start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset;
+                               uae_u32 address = (uae_u32)(start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset);
 
                                ad = S1;
                                mov_l_ri(ad, address);
@@ -491,50 +491,50 @@ STATIC_INLINE int put_fp_value(int val, uae_u32 opcode, uae_u16 extra)
        switch (size)
        {
        case 0: /* long */
-               fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.l);
+               fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.l);
                delay;
-               mov_l_rm(S2, (uintptr) temp_fp);
+               mov_l_rm(S2, JITPTR temp_fp);
                writelong_clobber(ad, S2, S3);
                break;
        case 1: /* single precision */
-               fmovs_mr((uintptr) temp_fp, val);
+               fmovs_mr(JITPTR temp_fp, val);
                delay;
-               mov_l_rm(S2, (uintptr) temp_fp);
+               mov_l_rm(S2, JITPTR temp_fp);
                writelong_clobber(ad, S2, S3);
                break;
        case 2: /* extended precision */
-               fmov_ext_mr((uintptr) temp_fp, val);
+               fmov_ext_mr(JITPTR temp_fp, val);
                delay;
-               mov_w_rm(S2, (uintptr) temp_fp + 8);
+               mov_w_rm(S2, JITPTR temp_fp + 8);
                writeword_clobber(ad, S2, S3);
                add_l_ri(ad, 4);
-               mov_l_rm(S2, (uintptr) temp_fp + 4);
+               mov_l_rm(S2, JITPTR temp_fp + 4);
                writelong_clobber(ad, S2, S3);
                add_l_ri(ad, 4);
-               mov_l_rm(S2, (uintptr) temp_fp);
+               mov_l_rm(S2, JITPTR temp_fp);
                writelong_clobber(ad, S2, S3);
                break;
        case 3: /* packed decimal static */
                return -1;                                              /* Packed */
        case 4: /* word */
-               fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.w);
+               fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.w);
                delay;
-               mov_l_rm(S2, (uintptr) temp_fp);
+               mov_l_rm(S2, JITPTR temp_fp);
                writeword_clobber(ad, S2, S3);
                break;
        case 5: /* double precision */
-               fmov_mr((uintptr) temp_fp, val);
+               fmov_mr(JITPTR temp_fp, val);
                delay;
-               mov_l_rm(S2, (uintptr) temp_fp + 4);
+               mov_l_rm(S2, JITPTR temp_fp + 4);
                writelong_clobber(ad, S2, S3);
                add_l_ri(ad, 4);
-               mov_l_rm(S2, (uintptr) temp_fp);
+               mov_l_rm(S2, JITPTR temp_fp);
                writelong_clobber(ad, S2, S3);
                break;
        case 6: /* byte */
-               fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.b);
+               fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.b);
                delay;
-               mov_l_rm(S2, (uintptr) temp_fp);
+               mov_l_rm(S2, JITPTR temp_fp);
                writebyte(ad, S2, S3);
                break;
        default:
@@ -583,7 +583,7 @@ STATIC_INLINE int get_fp_ad(uae_u32 opcode)
                        mov_l_ri(S1, off);
                        return S1;
                case 2: /* d16(pc) */
-                       off = start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset;
+                       off = (uae_s32)(start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset);
                        off += (uae_s32) (uae_s16) comp_get_iword((m68k_pc_offset += 2) - 2);
                        mov_l_ri(S1, off);
                        return S1;
@@ -753,8 +753,8 @@ void comp_fbcc_opp(uae_u32 opcode)
        {
                off = comp_get_ilong((m68k_pc_offset += 4) - 4);
        }
-       mov_l_ri(S1, (uintptr) (comp_pc_p + off - (m68k_pc_offset - start_68k_offset)));
-       mov_l_ri(PC_P, (uintptr) comp_pc_p);
+       mov_l_ri(S1, JITPTR (comp_pc_p + off - (m68k_pc_offset - start_68k_offset)));
+       mov_l_ri(PC_P, JITPTR comp_pc_p);
 
        /* Now they are both constant. Might as well fold in m68k_pc_offset */
        add_l_ri(S1, m68k_pc_offset);
@@ -1182,16 +1182,16 @@ void comp_fpp_opp(uae_u32 opcode, uae_u16 extra)
                                        {
                                                if (list & 0x80)
                                                {
-                                                       fmov_ext_mr((uintptr) temp_fp, reg);
+                                                       fmov_ext_mr(JITPTR temp_fp, reg);
                                                        delay;
                                                        sub_l_ri(ad, 4);
-                                                       mov_l_rm(S2, (uintptr) temp_fp);
+                                                       mov_l_rm(S2, JITPTR temp_fp);
                                                        writelong_clobber(ad, S2, S3);
                                                        sub_l_ri(ad, 4);
-                                                       mov_l_rm(S2, (uintptr) temp_fp + 4);
+                                                       mov_l_rm(S2, JITPTR temp_fp + 4);
                                                        writelong_clobber(ad, S2, S3);
                                                        sub_l_ri(ad, 4);
-                                                       mov_w_rm(S2, (uintptr) temp_fp + 8);
+                                                       mov_w_rm(S2, JITPTR temp_fp + 8);
                                                        writeword_clobber(ad, S2, S3);
                                                }
                                                list <<= 1;
@@ -1202,15 +1202,15 @@ void comp_fpp_opp(uae_u32 opcode, uae_u16 extra)
                                        {
                                                if (list & 0x80)
                                                {
-                                                       fmov_ext_mr((uintptr) temp_fp, reg);
+                                                       fmov_ext_mr(JITPTR temp_fp, reg);
                                                        delay;
-                                                       mov_w_rm(S2, (uintptr) temp_fp + 8);
+                                                       mov_w_rm(S2, JITPTR temp_fp + 8);
                                                        writeword_clobber(ad, S2, S3);
                                                        add_l_ri(ad, 4);
-                                                       mov_l_rm(S2, (uintptr) temp_fp + 4);
+                                                       mov_l_rm(S2, JITPTR temp_fp + 4);
                                                        writelong_clobber(ad, S2, S3);
                                                        add_l_ri(ad, 4);
-                                                       mov_l_rm(S2, (uintptr) temp_fp);
+                                                       mov_l_rm(S2, JITPTR temp_fp);
                                                        writelong_clobber(ad, S2, S3);
                                                        add_l_ri(ad, 4);
                                                }
@@ -1269,15 +1269,15 @@ void comp_fpp_opp(uae_u32 opcode, uae_u16 extra)
                                                {
                                                        sub_l_ri(ad, 4);
                                                        readlong(ad, S2, S3);
-                                                       mov_l_mr((uintptr) (temp_fp), S2);
+                                                       mov_l_mr(JITPTR (temp_fp), S2);
                                                        sub_l_ri(ad, 4);
                                                        readlong(ad, S2, S3);
-                                                       mov_l_mr((uintptr) (temp_fp) + 4, S2);
+                                                       mov_l_mr(JITPTR (temp_fp) + 4, S2);
                                                        sub_l_ri(ad, 4);
                                                        readword(ad, S2, S3);
-                                                       mov_w_mr(((uintptr) temp_fp) + 8, S2);
+                                                       mov_w_mr((JITPTR temp_fp) + 8, S2);
                                                        delay2;
-                                                       fmov_ext_rm(reg, (uintptr) (temp_fp));
+                                                       fmov_ext_rm(reg, JITPTR (temp_fp));
                                                }
                                                list <<= 1;
                                        }
@@ -1288,16 +1288,16 @@ void comp_fpp_opp(uae_u32 opcode, uae_u16 extra)
                                                if (list & 0x80)
                                                {
                                                        readword(ad, S2, S3);
-                                                       mov_w_mr(((uintptr) temp_fp) + 8, S2);
+                                                       mov_w_mr((JITPTR temp_fp) + 8, S2);
                                                        add_l_ri(ad, 4);
                                                        readlong(ad, S2, S3);
-                                                       mov_l_mr((uintptr) (temp_fp) + 4, S2);
+                                                       mov_l_mr(JITPTR (temp_fp) + 4, S2);
                                                        add_l_ri(ad, 4);
                                                        readlong(ad, S2, S3);
-                                                       mov_l_mr((uintptr) (temp_fp), S2);
+                                                       mov_l_mr(JITPTR(temp_fp), S2);
                                                        add_l_ri(ad, 4);
                                                        delay2;
-                                                       fmov_ext_rm(reg, (uintptr) (temp_fp));
+                                                       fmov_ext_rm(reg, JITPTR (temp_fp));
                                                }
                                                list <<= 1;
                                        }
@@ -1343,9 +1343,9 @@ void comp_fpp_opp(uae_u32 opcode, uae_u16 extra)
                                {
                                        /* FPIAR: fixme; we cannot correctly return the address from compiled code */
 #ifdef UAE
-                                       mov_l_rm(opcode & 15, (uintptr)&regs.fpiar);
+                                       mov_l_rm(opcode & 15, JITPTR &regs.fpiar);
 #else
-                                       mov_l_rm(opcode & 15, (uintptr) & fpu.instruction_address);
+                                       mov_l_rm(opcode & 15, JITPTR &fpu.instruction_address);
 #endif
                                        return;
                                }
@@ -1380,9 +1380,9 @@ void comp_fpp_opp(uae_u32 opcode, uae_u16 extra)
                                {
                                        /* FPIAR: does that make sense at all? */
 #ifdef UAE
-                                       mov_l_mr((uintptr)&regs.fpiar, opcode & 15);
+                                       mov_l_mr(JITPTR &regs.fpiar, opcode & 15);
 #else
-                                       mov_l_mr((uintptr) & fpu.instruction_address, opcode & 15);
+                                       mov_l_mr(JITPTR &fpu.instruction_address, opcode & 15);
 #endif
                                }
                                return;
@@ -1422,9 +1422,9 @@ void comp_fpp_opp(uae_u32 opcode, uae_u16 extra)
                                {
                                        uae_u32 val = comp_get_ilong((m68k_pc_offset += 4) - 4);
 #ifdef UAE
-                                       mov_l_mi((uintptr)&regs.fpiar, val);
+                                       mov_l_mi(JITPTR &regs.fpiar, val);
 #else
-                                       mov_l_mi((uintptr) & fpu.instruction_address, val);
+                                       mov_l_mi(JITPTR &fpu.instruction_address, val);
 #endif
                                }
                                return;
@@ -1582,14 +1582,14 @@ void comp_fpp_opp(uae_u32 opcode, uae_u16 extra)
                                return;
                        }
                        mov_l_ri(S1, 16);                       /* Switch to "round to zero" mode */
-                       fldcw_m_indexed(S1, (uintptr) x86_fpucw);
+                       fldcw_m_indexed(S1, JITPTR x86_fpucw);
 
                        frndint_rr(reg, src);
 
                        /* restore control word */
-                       mov_l_rm(S1, (uintptr) & regs.fpcr);
+                       mov_l_rm(S1, JITPTR &regs.fpcr);
                        and_l_ri(S1, 0x000000f0);
-                       fldcw_m_indexed(S1, (uintptr) x86_fpucw);
+                       fldcw_m_indexed(S1, JITPTR x86_fpucw);
 
                        MAKE_FPSR(reg);
                        break;
index 25b0ad3e4ab334f7e3450143755bc215b01ff205..38573d873a5f5e9e0bdd99e407a513a6c766078d 100644 (file)
@@ -112,7 +112,7 @@ MIDFUNC(0,duplicate_carry,(void))
 {
        evict(FLAGX);
        make_flags_live_internal();
-       COMPCALL(setcc_m)((uintptr)live.state[FLAGX].mem, NATIVE_CC_CS);
+       COMPCALL(setcc_m)(JITPTR live.state[FLAGX].mem, NATIVE_CC_CS);
        log_vwrite(FLAGX);
 }
 
@@ -172,7 +172,7 @@ MIDFUNC(6, setcc_for_cntzero, (RR4 /* cnt */, RR4 data, RR4 odata, int obit, int
        branchadd2 = get_target();
        skip_byte();
 
-       *branchadd4 = (uintptr)get_target() - ((uintptr)branchadd4 + 1);
+       *branchadd4 = JITPTR get_target() - (JITPTR branchadd4 + 1);
        // Shift count: zero, same or larger than data size
        // Need to update C, N and Z.
        raw_popfl();
@@ -200,20 +200,20 @@ MIDFUNC(6, setcc_for_cntzero, (RR4 /* cnt */, RR4 data, RR4 odata, int obit, int
        // Non-zero shift count.
        // Do not modify C, N and Z.
        // C -> X
-       *branchadd2 = (uintptr)get_target() - ((uintptr)branchadd2 + 1);
+       *branchadd2 = JITPTR get_target() - (JITPTR branchadd2 + 1);
        raw_popfl();
        // Execute "duplicate_carry()"
-       COMPCALL(setcc_m)((uintptr)live.state[FLAGX].mem, NATIVE_CC_CS);
+       COMPCALL(setcc_m)(JITPTR live.state[FLAGX].mem, NATIVE_CC_CS);
        log_vwrite(FLAGX);
        raw_jmp_b_oponly();
        branchadd3 = get_target();
        skip_byte();
 
        // Zero shift count after CNZ adjustments
-       *branchadd1 = (uintptr)get_target() - ((uintptr)branchadd1 + 1);
+       *branchadd1 = JITPTR get_target() - (JITPTR branchadd1 + 1);
        raw_popfl();
 
-       *branchadd3 = (uintptr)get_target() - ((uintptr)branchadd3 + 1);
+       *branchadd3 = JITPTR get_target() - (JITPTR branchadd3 + 1);
 }
 
 /*
@@ -2885,7 +2885,7 @@ static inline void write_jmp_target(uae_u32 *jmpaddr, cpuop_func* a) {
 }
 
 static inline void emit_jmp_target(uae_u32 a) {
-       emit_long(a-((uintptr)target+4));
+       emit_long(a-(JITPTR target+4));
 }
 
 
index c3b85fbfe594e7b7ef9d64513bdf839c859448d2..35e08e70d5860c26ffeac9f529f81acc614fce65 100644 (file)
@@ -116,7 +116,7 @@ static void build_comp(void);
 #define vm_protect(address, size, protect) uae_vm_protect(address, size, protect)
 #define vm_release(address, size) uae_vm_free(address, size)
 
-static inline void *vm_acquire(size_t size, int options = VM_MAP_DEFAULT)
+static inline void *vm_acquire(uae_u32 size, int options = VM_MAP_DEFAULT)
 {
        assert(options == (VM_MAP_DEFAULT | VM_MAP_32BIT));
        return uae_vm_alloc(size, UAE_VM_32BIT, UAE_VM_READ_WRITE);
@@ -1518,7 +1518,7 @@ static inline void do_load_reg(int n, int r)
        else if (r == FLAGX)
                raw_load_flagx(n);
        else
-               compemu_raw_mov_l_rm(n, (uintptr) live.state[r].mem);
+               compemu_raw_mov_l_rm(n, JITPTR  live.state[r].mem);
 }
 
 #if 0
@@ -1634,9 +1634,9 @@ static void tomem(int r)
 
        if (live.state[r].status==DIRTY) {
                switch (live.state[r].dirtysize) {
-               case 1: compemu_raw_mov_b_mr((uintptr)live.state[r].mem,rr); break;
-               case 2: compemu_raw_mov_w_mr((uintptr)live.state[r].mem,rr); break;
-               case 4: compemu_raw_mov_l_mr((uintptr)live.state[r].mem,rr); break;
+               case 1: compemu_raw_mov_b_mr(JITPTR live.state[r].mem,rr); break;
+               case 2: compemu_raw_mov_w_mr(JITPTR live.state[r].mem,rr); break;
+               case 4: compemu_raw_mov_l_mr(JITPTR live.state[r].mem,rr); break;
                default: abort();
                }
                log_vwrite(r);
@@ -1663,7 +1663,7 @@ static inline void writeback_const(int r)
                jit_abort("Trying to write back constant NF_HANDLER!");
        }
 
-       compemu_raw_mov_l_mi((uintptr)live.state[r].mem,live.state[r].val);
+       compemu_raw_mov_l_mi(JITPTR live.state[r].mem,live.state[r].val);
        log_vwrite(r);
        live.state[r].val=0;
        set_status(r,INMEM);
@@ -1796,7 +1796,7 @@ static int alloc_reg_hinted(int r, int size, int willclobber, int hint)
                if (size==4 && live.state[r].validsize==2) {
                        log_isused(bestreg);
                        log_visused(r);
-                       compemu_raw_mov_l_rm(bestreg,(uintptr)live.state[r].mem);
+                       compemu_raw_mov_l_rm(bestreg, JITPTR live.state[r].mem);
                        compemu_raw_bswap_32(bestreg);
                        compemu_raw_zero_extend_16_rr(rr,rr);
                        compemu_raw_zero_extend_16_rr(bestreg,bestreg);
@@ -2829,11 +2829,11 @@ void compemu_enter_super(int sr)
        uae_u8 *branchadd = get_target();
        skip_byte();
 #endif
-       mov_l_mr((uintptr)&regs.usp, SP_REG);
+       mov_l_mr(JITPTR &regs.usp, SP_REG);
        mov_l_rm(SP_REG, uae_p32(&regs.isp));
        mov_b_mi(uae_p32(&regs.s), 1);
 #if defined(CPU_i386) || defined(CPU_x86_64)
-       *branchadd = get_target() - (branchadd + 1);
+       *branchadd = JITPTR get_target() - (JITPTR branchadd + 1);
 #elif defined(CPU_arm)
        *((uae_u32 *)branchadd - 3) = get_target() - (branchadd + 1);
 #endif
@@ -3034,7 +3034,7 @@ static void init_comp(void)
        }
        live.state[PC_P].mem=(uae_u32*)&(regs.pc_p);
        live.state[PC_P].needflush=NF_TOMEM;
-       set_const(PC_P,(uintptr)comp_pc_p);
+       set_const(PC_P, JITPTR comp_pc_p);
 
        live.state[FLAGX].mem=(uae_u32*)&(regflags.x);
        live.state[FLAGX].needflush=NF_TOMEM;
@@ -3114,7 +3114,7 @@ void flush_reg(int reg)
                case INMEM:
                        if (live.state[reg].val)
                        {
-                               compemu_raw_add_l_mi((uintptr)live.state[reg].mem, live.state[reg].val);
+                               compemu_raw_add_l_mi(JITPTR live.state[reg].mem, live.state[reg].val);
                                log_vwrite(reg);
                                live.state[reg].val = 0;
                        }
@@ -3619,7 +3619,7 @@ int get_cache_state(void)
 uae_u32 get_jitted_size(void)
 {
        if (compiled_code)
-               return current_compile_p-compiled_code;
+               return JITPTR current_compile_p - JITPTR compiled_code;
        return 0;
 }
 
@@ -4037,15 +4037,15 @@ static void prepare_block(blockinfo* bi)
        set_target(current_compile_p);
        align_target(align_jumps);
        bi->direct_pen=(cpuop_func*)get_target();
-       compemu_raw_mov_l_rm(0,(uintptr)&(bi->pc_p));
-       compemu_raw_mov_l_mr((uintptr)&regs.pc_p,0);
-       compemu_raw_jmp((uintptr)popall_execute_normal);
+       compemu_raw_mov_l_rm(0, JITPTR &(bi->pc_p));
+       compemu_raw_mov_l_mr(JITPTR &regs.pc_p,0);
+       compemu_raw_jmp(JITPTR popall_execute_normal);
 
        align_target(align_jumps);
        bi->direct_pcc=(cpuop_func*)get_target();
-       compemu_raw_mov_l_rm(0,(uintptr)&(bi->pc_p));
-       compemu_raw_mov_l_mr((uintptr)&regs.pc_p,0);
-       compemu_raw_jmp((uintptr)popall_check_checksum);
+       compemu_raw_mov_l_rm(0, JITPTR &(bi->pc_p));
+       compemu_raw_mov_l_mr(JITPTR &regs.pc_p,0);
+       compemu_raw_jmp(JITPTR popall_check_checksum);
        flush_cpu_icache((void *)current_compile_p, (void *)target);
        current_compile_p=get_target();
 
@@ -4156,7 +4156,7 @@ static struct {
        { "ftst", &jit_disable.ftst },
 };
 
-static bool read_fpu_opcode(const char *p, int len)
+static bool read_fpu_opcode(const char *p, size_t len)
 {
        unsigned int i;
        
@@ -4182,7 +4182,7 @@ static bool merge_blacklist2(const char *blacklist)
        if (blacklist[0] != '\0') {
                const char *p = blacklist;
                for (;;) {
-                       int len;
+                       size_t len;
                        if (*p == 0)
                                return true;
 
@@ -4190,7 +4190,7 @@ static bool merge_blacklist2(const char *blacklist)
                        if (endp) {
                                len = endp - p;
                        } else {
-                               len = strlen(p);
+                               len = uaestrlen(p);
                        }
 
                        TCHAR *s = au(p);
@@ -4790,7 +4790,7 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                                optlev++;
                        bi->count=optcount[optlev]-1;
                }
-               current_block_pc_p=(uintptr)pc_hist[0].location;
+               current_block_pc_p= JITPTR pc_hist[0].location;
 
                remove_deps(bi); /* We are about to create new code */
                bi->optlevel=optlev;
@@ -4811,7 +4811,7 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                        if (follow_const_jumps && is_const_jump(op)) {
                                checksum_info *csi = alloc_checksum_info();
                                csi->start_p = (uae_u8 *)min_pcp;
-                               csi->length = max_pcp - min_pcp + LONGEST_68K_INST;
+                               csi->length = JITPTR max_pcp - JITPTR min_pcp + LONGEST_68K_INST;
                                csi->next = bi->csi;
                                bi->csi = csi;
                                max_pcp = (uintptr)currpcp;
@@ -4840,7 +4840,7 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
 #if USE_CHECKSUM_INFO
                checksum_info *csi = alloc_checksum_info();
                csi->start_p = (uae_u8 *)min_pcp;
-               csi->length = max_pcp - min_pcp + LONGEST_68K_INST;
+               csi->length = JITPTR max_pcp - JITPTR min_pcp + LONGEST_68K_INST;
                csi->next = bi->csi;
                bi->csi = csi;
 #endif
@@ -4853,19 +4853,19 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                bi->direct_handler=(cpuop_func*)get_target();
                set_dhtu(bi,bi->direct_handler);
                bi->status=BI_COMPILING;
-               current_block_start_target=(uintptr)get_target();
+               current_block_start_target= JITPTR get_target();
        
                log_startblock();
 
                if (bi->count>=0) { /* Need to generate countdown code */
-                       compemu_raw_mov_l_mi((uintptr)&regs.pc_p,(uintptr)pc_hist[0].location);
-                       compemu_raw_sub_l_mi((uintptr)&(bi->count),1);
-                       compemu_raw_jl((uintptr)popall_recompile_block);
+                       compemu_raw_mov_l_mi(JITPTR &regs.pc_p, JITPTR pc_hist[0].location);
+                       compemu_raw_sub_l_mi(JITPTR &(bi->count),1);
+                       compemu_raw_jl(JITPTR popall_recompile_block);
                }
                if (optlev==0) { /* No need to actually translate */
                        /* Execute normally without keeping stats */
-                       compemu_raw_mov_l_mi((uintptr)&regs.pc_p,(uintptr)pc_hist[0].location);
-                       compemu_raw_jmp((uintptr)popall_exec_nostats);
+                       compemu_raw_mov_l_mi(JITPTR &regs.pc_p, JITPTR pc_hist[0].location);
+                       compemu_raw_jmp(JITPTR popall_exec_nostats);
                }
                else {
                        reg_alloc_run=0;
@@ -5032,10 +5032,9 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
 #if USE_NORMAL_CALLING_CONVENTION
                                        raw_push_l_r(REG_PAR1);
 #endif
-                                       compemu_raw_mov_l_mi((uintptr)&regs.pc_p,
-                                               (uintptr)pc_hist[i].location);
+                                       compemu_raw_mov_l_mi(JITPTR &regs.pc_p, JITPTR pc_hist[i].location);
                                        raw_dec_sp(STACK_SHADOW_SPACE);
-                                       compemu_raw_call((uintptr)cputbl[opcode]);
+                                       compemu_raw_call(JITPTR cputbl[opcode]);
                                        raw_inc_sp(STACK_SHADOW_SPACE);
 #ifdef PROFILE_UNTRANSLATED_INSNS
                                        // raw_cputbl_count[] is indexed with plain opcode (in m68k order)
@@ -5049,7 +5048,7 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                                                uae_u8* branchadd;
 
                                                /* if (SPCFLAGS_TEST(SPCFLAG_ALL)) popall_do_nothing() */
-                                               compemu_raw_mov_l_rm(0, (uintptr)specflags);
+                                               compemu_raw_mov_l_rm(0, JITPTR specflags);
                                                compemu_raw_test_l_rr(0,0);
 #if defined(USE_DATA_BUFFER)
                                                data_check_end(8, 64);  // just a pessimistic guess...
@@ -5060,8 +5059,8 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
 #ifdef UAE
                                                raw_sub_l_mi(uae_p32(&countdown),scaled_cycles(totcycles));
 #endif
-                                               compemu_raw_jmp((uintptr)popall_do_nothing);
-                                               *branchadd = get_target() - (branchadd + 1);
+                                               compemu_raw_jmp(JITPTR popall_do_nothing);
+                                               *branchadd = JITPTR get_target() - (JITPTR branchadd + 1);
                                        }
                                }
                        }
@@ -5131,11 +5130,11 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                                compemu_raw_jcc_l_oponly(NATIVE_CC_EQ);
 #endif
                                tba=(uae_u32*)get_target();
-                               emit_jmp_target(get_handler(t1));
-                               compemu_raw_mov_l_mi((uintptr)&regs.pc_p,t1);
+                               emit_jmp_target(JITPTR get_handler(t1));
+                               compemu_raw_mov_l_mi(JITPTR &regs.pc_p, JITPTR t1);
                                flush_reg_count();
-                               compemu_raw_jmp((uintptr)popall_do_nothing);
-                               create_jmpdep(bi,0,tba,t1);
+                               compemu_raw_jmp(JITPTR popall_do_nothing);
+                               create_jmpdep(bi,0,tba, JITPTR t1);
 
                                align_target(align_jumps);
                                /* not-predicted outcome */
@@ -5153,11 +5152,11 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                                compemu_raw_jcc_l_oponly(NATIVE_CC_EQ);
 #endif
                                tba=(uae_u32*)get_target();
-                               emit_jmp_target(get_handler(t2));
-                               compemu_raw_mov_l_mi((uintptr)&regs.pc_p,t2);
+                               emit_jmp_target(JITPTR get_handler(t2));
+                               compemu_raw_mov_l_mi(JITPTR &regs.pc_p, JITPTR t2);
                                flush_reg_count();
-                               compemu_raw_jmp((uintptr)popall_do_nothing);
-                               create_jmpdep(bi,1,tba,t2);
+                               compemu_raw_jmp(JITPTR popall_do_nothing);
+                               create_jmpdep(bi,1,tba, JITPTR t2);
                        }
                        else
                        {
@@ -5171,10 +5170,10 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                                        r=live.state[PC_P].realreg;
                                        compemu_raw_and_l_ri(r,TAGMASK);
                                        int r2 = (r==0) ? 1 : 0;
-                                       compemu_raw_mov_l_ri(r2,(uintptr)popall_do_nothing);
+                                       compemu_raw_mov_l_ri(r2, JITPTR popall_do_nothing);
 #ifdef UAE
                                        raw_sub_l_mi(uae_p32(&countdown),scaled_cycles(totcycles));
-                                       raw_cmov_l_rm_indexed(r2,(uintptr)cache_tags,r,sizeof(void *),NATIVE_CC_PL);
+                                       raw_cmov_l_rm_indexed(r2, JITPTR cache_tags,r,sizeof(void *),NATIVE_CC_PL);
 #else
                                        compemu_raw_cmp_l_mi8((uintptr)specflags,0);
                                        compemu_raw_cmov_l_rm_indexed(r2,(uintptr)cache_tags,r,sizeof(void *),NATIVE_CC_EQ);
@@ -5197,20 +5196,20 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                                        compemu_raw_jcc_l_oponly(NATIVE_CC_EQ);
 #endif
                                        tba=(uae_u32*)get_target();
-                                       emit_jmp_target(get_handler(v));
-                                       compemu_raw_mov_l_mi((uintptr)&regs.pc_p,v);
-                                       compemu_raw_jmp((uintptr)popall_do_nothing);
-                                       create_jmpdep(bi,0,tba,v);
+                                       emit_jmp_target(JITPTR get_handler(v));
+                                       compemu_raw_mov_l_mi(JITPTR &regs.pc_p, JITPTR v);
+                                       compemu_raw_jmp(JITPTR popall_do_nothing);
+                                       create_jmpdep(bi,0,tba, JITPTR v);
                                }
                                else {
                                        r=REG_PC_TMP;
-                                       compemu_raw_mov_l_rm(r,(uintptr)&regs.pc_p);
+                                       compemu_raw_mov_l_rm(r,JITPTR &regs.pc_p);
                                        compemu_raw_and_l_ri(r,TAGMASK);
                                        int r2 = (r==0) ? 1 : 0;
-                                       compemu_raw_mov_l_ri(r2,(uintptr)popall_do_nothing);
+                                       compemu_raw_mov_l_ri(r2, JITPTR popall_do_nothing);
 #ifdef UAE
                                        raw_sub_l_mi(uae_p32(&countdown),scaled_cycles(totcycles));
-                                       raw_cmov_l_rm_indexed(r2,(uintptr)cache_tags,r,sizeof(void *),NATIVE_CC_PL);
+                                       raw_cmov_l_rm_indexed(r2, JITPTR cache_tags,r,sizeof(void *),NATIVE_CC_PL);
 #else
                                        compemu_raw_cmp_l_mi8((uintptr)specflags,0);
                                        compemu_raw_cmov_l_rm_indexed(r2,(uintptr)cache_tags,r,sizeof(void *),NATIVE_CC_EQ);
@@ -5262,7 +5261,7 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                }
 #endif
 
-               current_cache_size += get_target() - current_compile_p;
+               current_cache_size += JITPTR get_target() - JITPTR current_compile_p;
 
 #ifdef JIT_DEBUG
                bi->direct_handler_size = get_target() - (uae_u8 *)current_block_start_target;
@@ -5294,8 +5293,8 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                /* This is the non-direct handler */
                bi->handler=
                        bi->handler_to_use=(cpuop_func *)get_target();
-               compemu_raw_cmp_l_mi((uintptr)&regs.pc_p,(uintptr)pc_hist[0].location);
-               compemu_raw_jnz((uintptr)popall_cache_miss);
+               compemu_raw_cmp_l_mi(JITPTR &regs.pc_p, JITPTR pc_hist[0].location);
+               compemu_raw_jnz(JITPTR popall_cache_miss);
                comp_pc_p=(uae_u8*)pc_hist[0].location;
 
                bi->status=BI_FINALIZING;
@@ -5303,7 +5302,7 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
                match_states(bi);
                flush(1);
 
-               compemu_raw_jmp((uintptr)bi->direct_handler);
+               compemu_raw_jmp(JITPTR bi->direct_handler);
 
                flush_cpu_icache((void *)current_block_start_target, (void *)target);
                current_compile_p=get_target();
index d8bda976fb7cbc18756d617dd41c8ff695491fa9..9de9e2d743ae7eb9478f91b90a3c5ee467ee556a 100644 (file)
@@ -470,7 +470,7 @@ static int handle_access(uintptr_t fault_addr, CONTEXT_T context)
                }
        }
        for (int i = 0; i < 5; i++) {
-               raw_mov_b_mi(CONTEXT_PC(context) + i, vecbuf[i]);
+               raw_mov_b_mi(JITPTR CONTEXT_PC(context) + i, vecbuf[i]);
        }
        raw_mov_l_mi(uae_p32(&in_handler), 0);
        raw_jmp(uae_p32(CONTEXT_PC(context)) + len);
index 84f2c045f5e9ebd8cb7fb750452988278d79e656..c58a44a807873b1df40589fcffe2b88dc8735a1c 100644 (file)
@@ -95,7 +95,7 @@ static int l_uae_write_config(lua_State *L)
     const char *s = luaL_checkstring(L, 1);
        TCHAR *ts = au(s);
        TCHAR out[MAX_DPATH];
-       cfgfile_modify(-1, ts, _tcslen(ts), out, sizeof out / sizeof(TCHAR));
+       cfgfile_modify(-1, ts, uaetcslen(ts), out, sizeof out / sizeof(TCHAR));
        char *c = ua(out);
        lua_pushstring(L, c);
        xfree(c);
index 2e30fae6e5f1009d7522da0d288847cbc4650f32..e8e956fabce9ed7e64704e10f4ee92389123322f 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -91,13 +91,13 @@ uae_u32 uaerandgetseed (void)
        return randseed;
 }
 
-void my_trim (TCHAR *s)
+void my_trim(TCHAR *s)
 {
        int len;
-       while (_tcslen (s) > 0 && _tcscspn (s, _T("\t \r\n")) == 0)
-               memmove (s, s + 1, (_tcslen (s + 1) + 1) * sizeof (TCHAR));
-       len = _tcslen (s);
-       while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
+       while (uaetcslen(s) > 0 && _tcscspn(s, _T("\t \r\n")) == 0)
+               memmove (s, s + 1, (uaetcslen(s + 1) + 1) * sizeof (TCHAR));
+       len = uaetcslen(s);
+       while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0)
                s[--len] = '\0';
 }
 
@@ -108,13 +108,13 @@ TCHAR *my_strdup_trim (const TCHAR *s)
 
        if (s[0] == 0)
                return my_strdup(s);
-       while (_tcscspn (s, _T("\t \r\n")) == 0)
+       while (_tcscspn(s, _T("\t \r\n")) == 0)
                s++;
-       len = _tcslen (s);
-       while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
+       len = uaetcslen(s);
+       while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0)
                len--;
-       out = xmalloc (TCHAR, len + 1);
-       memcpy (out, s, len * sizeof (TCHAR));
+       out = xmalloc(TCHAR, len + 1);
+       memcpy(out, s, len * sizeof (TCHAR));
        out[len] = 0;
        return out;
 }
index ece5003ce74d3b31a1d06b4703870fa1b5391220..c5da8e20c2674e688464c8d1a4b66610471d5f55 100644 (file)
@@ -143,6 +143,7 @@ struct d3d9overlay
 
 struct d3dstruct
 {
+       int num;
        int psEnabled, psActive;
        struct shaderdata shaders[MAX_SHADERS];
        LPDIRECT3DTEXTURE9 lpPostTempTexture;
@@ -346,7 +347,7 @@ static TCHAR *D3DX_ErrorString (HRESULT hr, LPD3DXBUFFER Errors)
 
        if (Errors)
                s = au ((char*)Errors->GetBufferPointer ());
-       size = (s == NULL ? 0 : _tcslen (s)) + 1000;
+       size = (s == NULL ? 0 : uaetcslen (s)) + 1000;
        if (size + 1000 > buffersize) {
                xfree (buffer);
                buffer = xmalloc (TCHAR, size);
@@ -932,7 +933,7 @@ static bool psEffect_LoadEffect (struct d3dstruct *d3d, const TCHAR *shaderfile,
                }
                if (FAILED (hr)) {
                        const char *str = d3d->psEnabled ? fx20 : fx10;
-                       int len = strlen (str);
+                       int len = uaestrlen(str);
                        if (!existsfile && plugin_path) {
                                struct zfile *z = zfile_fopen (tmp, _T("w"));
                                if (z) {
@@ -1416,13 +1417,13 @@ static void updateleds (struct d3dstruct *d3d)
 
        for (int y = 0; y < d3d->ledheight; y++) {
                uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch;
-               statusline_single_erase(d3d - d3ddata, buf, 32 / 8, y, d3d->ledwidth);
+               statusline_single_erase(d3d->num, buf, 32 / 8, y, d3d->ledwidth);
        }
-       statusline_render(d3d - d3ddata, (uae_u8*)locked.pBits, 32 / 8, locked.Pitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a);
+       statusline_render(d3d->num, (uae_u8*)locked.pBits, 32 / 8, locked.Pitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a);
 
        for (int y = 0; y < d3d->ledheight; y++) {
                uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch;
-               draw_status_line_single(d3d - d3ddata, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a);
+               draw_status_line_single(d3d->num, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a);
        }
 
        d3d->ledtexture->UnlockRect (0);
@@ -1537,7 +1538,7 @@ struct uae_image
 struct png_cb
 {
        uae_u8 *ptr;
-       int size;
+       size_t size;
 };
 
 static void __cdecl readcallback(png_structp png_ptr, png_bytep out, png_size_t count)
@@ -2006,7 +2007,7 @@ static int createmasktexture (struct d3dstruct *d3d, const TCHAR *filename, stru
        D3DXIMAGE_INFO dinfo;
        TCHAR tmp[MAX_DPATH];
        int maskwidth, maskheight;
-       int idx = sd - &d3d->shaders[0];
+       int idx = (int)(sd - &d3d->shaders[0]);
 
        if (filename[0] == 0)
                return 0;
@@ -2142,7 +2143,7 @@ static bool xD3D_getscalerect(int monid, float *mx, float *my, float *sx, float
 
 static void setupscenecoords (struct d3dstruct *d3d, bool normalrender)
 {
-       int monid = d3d - d3ddata;
+       int monid = d3d->num;
        struct vidbuf_description *vidinfo = &adisplays[monid].gfxvidinfo;
        RECT sr, dr, zr;
        float w, h;
@@ -2691,7 +2692,7 @@ static int getd3dadapter (IDirect3D9 *id3d)
 
 static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv)
 {
-       int monid = d3d - d3ddata;
+       int monid = d3d->num;
        struct amigadisplay *ad = &adisplays[monid];
        HRESULT ret, hr;
        static TCHAR errmsg[300] = { 0 };
@@ -2990,7 +2991,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w
 
        d3d->dmultxh = mmulth;
        d3d->dmultxv = mmultv;
-       d3d->dmult = S2X_getmult(d3d - d3ddata);
+       d3d->dmult = S2X_getmult(d3d->num);
 
        d3d->window_w = w_w;
        d3d->window_h = w_h;
@@ -3734,7 +3735,7 @@ static void D3D_render2(struct d3dstruct *d3d, int mode)
                }
                if (d3d->ledtexture && (((currprefs.leds_on_screen & STATUSLINE_RTG) && WIN32GFX_IsPicassoScreen(mon)) || ((currprefs.leds_on_screen & STATUSLINE_CHIPSET) && !WIN32GFX_IsPicassoScreen(mon)))) {
                        int slx, sly;
-                       statusline_getpos(d3d - d3ddata, &slx, &sly, d3d->window_w, d3d->window_h);
+                       statusline_getpos(d3d->num, &slx, &sly, d3d->window_w, d3d->window_h);
                        v.x = (float)slx;
                        v.y = (float)sly;
                        v.z = 0.0f;
@@ -4289,6 +4290,9 @@ static bool xD3D_extoverlay(struct extoverlay *ext)
 
 void d3d9_select(void)
 {
+       for (int i = 0; i < MAX_AMIGAMONITORS; i++) {
+               d3ddata[i].num = i;
+       }
        D3D_free = xD3D_free;
        D3D_init = xD3D_init;
        D3D_alloctexture = xD3D_alloctexture;
index 9396b52cf04b72d6fff06273476cd95d46c273cc..b5d9bfc8296d764fca060d3038a5e24dbdd08f94 100644 (file)
@@ -209,6 +209,7 @@ struct d3doverlay
 
 struct d3d11struct
 {
+       int num;
        IDXGISwapChain1 *m_swapChain;
        ID3D11Device *m_device;
        ID3D11DeviceContext *m_deviceContext;
@@ -871,7 +872,7 @@ static bool islf(char c)
 static bool fxneedconvert(char *s)
 {
        char *t = s;
-       int len = strlen(s);
+       int len = uaestrlen(s);
        while (len > 0) {
                if (t != s && isws(t[-1]) && (!strnicmp(t, "technique10", 11) || !strnicmp(t, "technique11", 11)) && isws(t[11])) {
                        return false;
@@ -887,7 +888,7 @@ static void fxspecials(char *s, char *dst)
        char *t = s;
        char *d = dst;
        *d = 0;
-       int len = strlen(s);
+       int len = uaestrlen(s);
        while (len > 0) {
                bool found = false;
                if (t != s && !strnicmp(t, "minfilter", 9) && (isws(t[9]) || t[9] == '=') && isws(t[-1])) {
@@ -897,12 +898,12 @@ static void fxspecials(char *s, char *dst)
                        while (!islf(*t) && len > 0) {
                                if (!strnicmp(t, "point", 5)) {
                                        strcpy(d, "Filter=MIN_MAG_MIP_POINT");
-                                       d += strlen(d);
+                                       d += uaestrlen(d);
                                        write_log("FX: 'minfilter' -> 'Filter=MIN_MAG_MIP_POINT'\n");
                                }
                                if (!strnicmp(t, "linear", 6)) {
                                        strcpy(d, "Filter=MIN_MAG_MIP_LINEAR");
-                                       d += strlen(d);
+                                       d += uaestrlen(d);
                                        write_log("FX: 'minfiler' -> 'Filter=MIN_MAG_MIP_LINEAR'\n");
                                }
                                t++;
@@ -921,12 +922,12 @@ static void fxconvert(char *s, char *dst, const char **convert1, const char **co
 {
        char *t = s;
        char *d = dst;
-       int len = strlen(s);
+       int len = uaestrlen(s);
        while (len > 0) {
                bool found = false;
                for (int i = 0; convert1[i]; i++) {
-                       int slen = strlen(convert1[i]);
-                       int dlen = strlen(convert2[i]);
+                       int slen = uaestrlen(convert1[i]);
+                       int dlen = uaestrlen(convert2[i]);
                        if (len > slen && !strnicmp(t, convert1[i], slen)) {
                                if ((t == s || isws(t[-1])) && isws(t[slen])) {
                                        memcpy(d, convert2[i], dlen);
@@ -950,11 +951,11 @@ static void fxremoveline(char *s, char *dst, const char **lines)
 {
        char *t = s;
        char *d = dst;
-       int len = strlen(s);
+       int len = uaestrlen(s);
        while (len > 0) {
                bool found = false;
                for (int i = 0; lines[i]; i++) {
-                       int slen = strlen(lines[i]);
+                       int slen = uaestrlen(lines[i]);
                        if (len > slen && !strnicmp(t, lines[i], slen)) {
                                d--;
                                while (d != dst) {
@@ -1530,7 +1531,7 @@ static void setupscenecoords(struct d3d11struct *d3d, bool normalrender)
        if (!normalrender)
                return;
 
-       getfilterrect2(d3d - d3d11data, &dr, &sr, &zr, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth / d3d->dmult, d3d->m_bitmapHeight / d3d->dmult, d3d->dmult, d3d->m_bitmapWidth, d3d->m_bitmapHeight);
+       getfilterrect2(d3d->num, &dr, &sr, &zr, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth / d3d->dmult, d3d->m_bitmapHeight / d3d->dmult, d3d->dmult, d3d->m_bitmapWidth, d3d->m_bitmapHeight);
 
        if (!memcmp(&sr, &d3d->sr2, sizeof RECT) && !memcmp(&dr, &d3d->dr2, sizeof RECT) && !memcmp(&zr, &d3d->zr2, sizeof RECT)) {
                return;
@@ -1607,7 +1608,7 @@ static void updateleds(struct d3d11struct *d3d)
        if (!d3d->osd.texture || d3d != d3d11data)
                return;
 
-       statusline_getpos(d3d - d3d11data, &osdx, &osdy, d3d->m_screenWidth, d3d->m_screenHeight);
+       statusline_getpos(d3d->num, &osdx, &osdy, d3d->m_screenWidth, d3d->m_screenHeight);
        d3d->osd.x = (float)osdx;
        d3d->osd.y = (float)osdy;
 
@@ -1618,13 +1619,13 @@ static void updateleds(struct d3d11struct *d3d)
        }
        for (int y = 0; y < d3d->osd.height; y++) {
                uae_u8 *buf = (uae_u8*)map.pData + y * map.RowPitch;
-               statusline_single_erase(d3d - d3d11data, buf, 32 / 8, y, d3d->ledwidth);
+               statusline_single_erase(d3d->num, buf, 32 / 8, y, d3d->ledwidth);
        }
-       statusline_render(d3d - d3d11data, (uae_u8*)map.pData, 32 / 8, map.RowPitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a);
+       statusline_render(d3d->num, (uae_u8*)map.pData, 32 / 8, map.RowPitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a);
 
        for (int y = 0; y < d3d->osd.height; y++) {
                uae_u8 *buf = (uae_u8*)map.pData + y * map.RowPitch;
-               draw_status_line_single(d3d - d3d11data, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a);
+               draw_status_line_single(d3d->num, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a);
        }
 
        d3d->m_deviceContext->Unmap(d3d->osd.texture, 0);
@@ -1960,20 +1961,20 @@ err:
 static void erasetexture(struct d3d11struct *d3d)
 {
        int pitch;
-       uae_u8 *p = D3D_locktexture(d3d - &d3d11data[0], &pitch, NULL, true);
+       uae_u8 *p = D3D_locktexture(d3d->num, &pitch, NULL, true);
        if (p) {
                for (int i = 0; i < d3d->m_bitmapHeight; i++) {
                        memset(p, 255, d3d->m_bitmapWidth * d3d->texdepth / 8);
                        p += pitch;
                }
-               D3D_unlocktexture(d3d - &d3d11data[0], -1, -1);
+               D3D_unlocktexture(d3d->num, -1, -1);
        }
 }
 #endif
 
 static bool CreateTexture(struct d3d11struct *d3d)
 {
-       struct AmigaMonitor *mon = &AMonitors[d3d - d3d11data];
+       struct AmigaMonitor *mon = &AMonitors[d3d->num];
        D3D11_TEXTURE2D_DESC desc;
        D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
        HRESULT hr;
@@ -2119,12 +2120,13 @@ static bool allocshadertex(struct d3d11struct *d3d, struct shadertex *t, int w,
 
 static bool allocextratextures(struct d3d11struct *d3d, struct shaderdata11 *s, int w, int h)
 {
-       if (!allocshadertex(d3d, &s->lpWorkTexture1, w, h, s - &d3d->shaders[0]))
+       int scnt = (int)(s - &d3d->shaders[0]);
+       if (!allocshadertex(d3d, &s->lpWorkTexture1, w, h, scnt))
                return false;
-       if (!allocshadertex(d3d, &s->lpWorkTexture2, w, h, s - &d3d->shaders[0]))
+       if (!allocshadertex(d3d, &s->lpWorkTexture2, w, h, scnt))
                return false;
 
-       write_log(_T("D3D11 %d*%d working texture:%d\n"), w, h, s - &d3d->shaders[0]);
+       write_log(_T("D3D11 %d*%d working texture:%d\n"), w, h, scnt);
        return true;
 }
 
@@ -2166,7 +2168,7 @@ static bool createextratextures(struct d3d11struct *d3d, int ow, int oh, int win
                        }
                        d3d->shaders[i].targettex_width = w2;
                        d3d->shaders[i].targettex_height = h2;
-                       if (!allocshadertex(d3d, &s->lpTempTexture, w2, h2, s - &d3d->shaders[0]))
+                       if (!allocshadertex(d3d, &s->lpTempTexture, w2, h2, (int)(s - &d3d->shaders[0])))
                                return false;
                        write_log(_T("D3D11 %d*%d temp texture:%d:%d\n"), w2, h2, i, d3d->shaders[i].type);
                        d3d->shaders[i].worktex_width = w;
@@ -2305,7 +2307,7 @@ struct uae_image
 struct png_cb
 {
        uae_u8 *ptr;
-       int size;
+       size_t size;
 };
 
 static void __cdecl readcallback(png_structp png_ptr, png_bytep out, png_size_t count)
@@ -2520,7 +2522,7 @@ static uae_u8 dimming(uae_u8 v)
 
 static int createmask2texture(struct d3d11struct *d3d, const TCHAR *filename)
 {
-       struct AmigaMonitor *mon = &AMonitors[d3d - d3d11data];
+       struct AmigaMonitor *mon = &AMonitors[d3d->num];
        struct zfile *zf;
        TCHAR tmp[MAX_DPATH];
        ID3D11Texture2D *tx = NULL;
@@ -3170,7 +3172,7 @@ static bool initd3d(struct d3d11struct *d3d)
 
 static void setswapchainmode(struct d3d11struct *d3d, int fs)
 {
-       struct amigadisplay *ad = &adisplays[d3d - d3d11data];
+       struct amigadisplay *ad = &adisplays[d3d->num];
        struct apmode *apm = ad->picasso_on ? &currprefs.gfx_apmode[APMODE_RTG] : &currprefs.gfx_apmode[APMODE_NATIVE];
        // It is recommended to always use the tearing flag when it is supported.
        d3d->swapChainDesc.Flags &= ~DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
@@ -3317,7 +3319,7 @@ static void do_black(struct d3d11struct *d3d)
 
 static void do_present(struct d3d11struct *d3d)
 {
-       struct amigadisplay *ad = &adisplays[d3d - d3d11data];
+       struct amigadisplay *ad = &adisplays[d3d->num];
        struct apmode *apm = ad->picasso_on ? &currprefs.gfx_apmode[APMODE_RTG] : &currprefs.gfx_apmode[APMODE_NATIVE];
        HRESULT hr;
        UINT presentFlags = 0;
@@ -3326,7 +3328,7 @@ static void do_present(struct d3d11struct *d3d)
        UINT syncinterval = d3d->vblankintervals;
        // only if no vsync or low latency vsync
        if (d3d->m_tearingSupport && (d3d->swapChainDesc.Flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) && (!vsync || apm->gfx_vsyncmode)) {
-               if (apm->gfx_vsyncmode || d3d - d3d11data > 0 || currprefs.turbo_emulation || currprefs.gfx_variable_sync) {
+               if (apm->gfx_vsyncmode || d3d->num > 0 || currprefs.turbo_emulation || currprefs.gfx_variable_sync) {
                        presentFlags |= DXGI_PRESENT_ALLOW_TEARING;
                        syncinterval = 0;
                }
@@ -4852,7 +4854,7 @@ static bool D3D11_resize_do(struct d3d11struct *d3d)
                hr = d3d->m_swapChain->SetFullscreenState(TRUE, d3d->outputAdapter);
                if (FAILED(hr)) {
                        write_log(_T("SetFullscreenState(TRUE) failed %08X\n"), hr);
-                       toggle_fullscreen(d3d - d3d11data, 10);
+                       toggle_fullscreen(d3d->num, 10);
                } else {
                        d3d->fsmode = 0;
                }
@@ -4893,11 +4895,11 @@ static bool recheck(struct d3d11struct *d3d)
        }
        if (!d3d->delayedfs)
                return r;
-       xD3D11_free(d3d - d3d11data, true);
+       xD3D11_free(d3d->num, true);
        d3d->delayedfs = 0;
        ShowWindow(d3d->ahwnd, SW_SHOWNORMAL);
        int freq = 0;
-       if (!xxD3D11_init2(d3d->ahwnd, d3d - d3d11data, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth2, d3d->m_bitmapHeight2, 32, &freq, d3d->dmultxh, d3d->dmultxv))
+       if (!xxD3D11_init2(d3d->ahwnd, d3d->num, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth2, d3d->m_bitmapHeight2, 32, &freq, d3d->dmultxh, d3d->dmultxv))
                d3d->invalidmode = true;
        return false;
 }
@@ -5045,11 +5047,11 @@ static void resizemode(struct d3d11struct *d3d)
                }
                if (!d3d->invalidmode) {
                        if (!initd3d(d3d)) {
-                               xD3D11_free(d3d - d3d11data, true);
+                               xD3D11_free(d3d->num, true);
                                gui_message(_T("D3D11 Resize failed."));
                                d3d->invalidmode = true;
                        } else {
-                               xD3D11_alloctexture(d3d - d3d11data, d3d->m_bitmapWidth, d3d->m_bitmapHeight);
+                               xD3D11_alloctexture(d3d->num, d3d->m_bitmapWidth, d3d->m_bitmapHeight);
                        }
                }
                write_log(_T("D3D11 resizemode end\n"));
@@ -5094,7 +5096,7 @@ static void xD3D11_guimode(int monid, int guion)
        write_log(_T("fs guimode %d\n"), guion);
        d3d->guimode = guion;
        if (guion > 0) {
-               xD3D11_free(d3d - d3d11data, true);
+               xD3D11_free(d3d->num, true);
                ShowWindow(d3d->ahwnd, SW_HIDE);
        } else if (guion == 0) {
                d3d->delayedfs = 1;
@@ -5410,6 +5412,9 @@ void d3d11_select(void)
 
 void d3d_select(struct uae_prefs *p)
 {
+       for (int i = 0; i < MAX_AMIGAMONITORS; i++) {
+               d3d11data[i].num = i;
+       }
        if (p->gfx_api >= 2)
                d3d11_select();
        else
index 2d7d16d14d0b519cd22e410add0aa4d204d11425..8152c12821bd993c1fc15eb9b3049621ac3803f4 100644 (file)
@@ -326,14 +326,23 @@ int same_aname (const TCHAR *an1, const TCHAR *an2)
 void to_lower(TCHAR *s, int len)
 {
        if (len < 0) {
-               len = _tcslen(s);
+               len = uaetcslen(s);
        }
        CharLowerBuff(s, len);
 }
 void to_upper(TCHAR *s, int len)
 {
        if (len < 0) {
-               len = _tcslen(s);
+               len = uaetcslen(s);
        }
        CharUpperBuff(s, len);
-}
\ No newline at end of file
+}
+
+int uaestrlen(const char* s)
+{
+       return (int)strlen(s);
+}
+int uaetcslen(const TCHAR* s)
+{
+       return (int)_tcslen(s);
+}
index 876284d74b6468298c5f257e9fc0b3350d25073e..dd30291ef9de3b1fbdd3853bd256064d83d83381 100644 (file)
@@ -22776,7 +22776,7 @@ void gui_led (int led, int on, int brightness)
                else
                        _stprintf (ptr , _T("%02d"), gui_data.drives[led - 1].drive_track);
                p = gui_data.drives[led - 1].df;
-               j = _tcslen (p) - 1;
+               j = uaetcslen(p) - 1;
                if (j < 0)
                        j = 0;
                while (j > 0) {
@@ -22786,7 +22786,7 @@ void gui_led (int led, int on, int brightness)
                }
                tt = dfx[led - 1];
                tt[0] = 0;
-               if (_tcslen (p + j) > 0)
+               if (uaetcslen(p + j) > 0)
                        _stprintf (tt, _T("%s [CRC=%08X]"), p + j, gui_data.drives[led - 1].crc32);
                center = 1;
                if (gui_data.drives[led - 1].drive_writing)
index 5a2d4df8bd8b172abb8e6b5fa2551f4f04bc99f1..0aff01cadfbb5caad4d1ddba8c60dab9578cf102 100644 (file)
 static void check_blit(int32_t addr, uint32_t mask, int pitch, int width, int *height, int depth, int dir)
 {
        int h = *height;
+    int maskp1 = mask + 1;
        int32_t off;
        if (!h || !width || (!addr && !mask))
                return;
@@ -187,9 +188,9 @@ static void check_blit(int32_t addr, uint32_t mask, int pitch, int width, int *h
        } else {
                off -= width * (depth / 8);
        }
-       if (off > mask + 1) {
+       if (off > maskp1) {
                if (pitch)
-                       h -= (off - (mask + 1) + pitch - 1) / pitch;
+                       h -= (off - maskp1 + pitch - 1) / pitch;
                else
                        h = 0;
        } else if (off < 0) {
@@ -1173,10 +1174,10 @@ static void cirrus_get_resolution(VGACommonState *s, int *pwidth, int *pheight)
  *
  ***************************************/
 
-static void cirrus_update_bank_ptr(CirrusVGAState * s, unsigned bank_index)
+static void cirrus_update_bank_ptr(CirrusVGAState * s, uint32_t bank_index)
 {
-    unsigned offset;
-    unsigned limit;
+    int32_t offset;
+    int32_t limit;
 
     if ((s->vga.gr[0x0b] & 0x01) != 0) /* dual bank */
        offset = s->vga.gr[0x09 + bank_index];
@@ -2123,7 +2124,7 @@ static void cirrus_vga_mem_write(void *opaque,
                return;
 
     if ((s->vga.sr[0x07] & 0x01) == 0) {
-        vga_mem_writeb(&s->vga, addr, mem_value);
+        vga_mem_writeb(&s->vga, addr, (uint32_t)mem_value);
         return;
     }
 
@@ -2148,18 +2149,18 @@ static void cirrus_vga_mem_write(void *opaque,
                bank_offset &= s->cirrus_addr_mask;
                mode = s->vga.gr[0x05] & 0x7;
                if (mode < 4 || mode > 5 || ((s->vga.gr[0x0B] & 0x4) == 0)) {
-                   *(s->vga.vram_ptr + bank_offset) = mem_value;
+                   *(s->vga.vram_ptr + bank_offset) = (uint8_t)mem_value;
                     linear_memory_region_set_dirty(&s->vga.vram, bank_offset,
                                             sizeof(mem_value));
                } else {
                    if ((s->vga.gr[0x0B] & 0x14) != 0x14) {
                        cirrus_mem_writeb_mode4and5_8bpp(s, mode,
                                                         bank_offset,
-                                                        mem_value);
+                                                        (uint32_t)mem_value);
                    } else {
                        cirrus_mem_writeb_mode4and5_16bpp(s, mode,
                                                          bank_offset,
-                                                         mem_value);
+                                                         (uint32_t)mem_value);
                    }
                }
            }
@@ -2167,7 +2168,7 @@ static void cirrus_vga_mem_write(void *opaque,
     } else if (addr >= 0x18000 && addr < 0x18100) {
        /* memory-mapped I/O */
        if ((s->vga.sr[0x17] & 0x44) == 0x04) {
-           cirrus_mmio_blt_write(s, addr & 0xff, mem_value);
+           cirrus_mmio_blt_write(s, addr & 0xff, (uint8_t)mem_value);
        }
     } else {
 #ifdef DEBUG_CIRRUS
@@ -2410,10 +2411,11 @@ static uint64_t cirrus_linear_read(void *opaque, hwaddr addr,
 }
 
 static void cirrus_linear_write(void *opaque, hwaddr addr,
-                                uint64_t val, unsigned size)
+                                uint64_t val64, unsigned size)
 {
     CirrusVGAState *s = (CirrusVGAState*)opaque;
     unsigned mode;
+    uint32_t val = (uint32_t)val64;
 
     addr &= s->cirrus_addr_mask;
 
@@ -2668,12 +2670,13 @@ static uint64_t cirrus_vga_ioport_read(void *opaque, hwaddr addr,
     return val;
 }
 
-static void cirrus_vga_ioport_write(void *opaque, hwaddr addr, uint64_t val,
+static void cirrus_vga_ioport_write(void *opaque, hwaddr addr, uint64_t val64,
                                     unsigned size)
 {
     CirrusVGAState *c = (CirrusVGAState*)opaque;
     VGACommonState *s = &c->vga;
     int index;
+    uint32_t val = (uint32_t)val64;
 
     qemu_flush_coalesced_mmio_buffer();
     addr += 0x3b0;
@@ -2814,7 +2817,7 @@ static void cirrus_mmio_write(void *opaque, hwaddr addr,
     CirrusVGAState *s = (CirrusVGAState*)opaque;
 
     if (addr >= 0x100) {
-       cirrus_mmio_blt_write(s, addr - 0x100, val);
+       cirrus_mmio_blt_write(s, addr - 0x100, (uint8_t)val);
     } else {
         cirrus_vga_ioport_write(s, addr + 0x10, val, size);
     }
index 163379e9ae162b8ae0341e78c14b09aedb70368d..5d1eeffacf35a1e95bca8d5b4255dbb56390f197 100644 (file)
@@ -968,9 +968,10 @@ static uint64_t es1370_read(void *opaque, hwaddr addr,
     }
 }
 
-static void es1370_write(void *opaque, hwaddr addr, uint64_t val,
+static void es1370_write(void *opaque, hwaddr addr, uint64_t val64,
                       unsigned size)
 {
+    uint32_t val = (uint32_t)val64;
     switch (size) {
     case 1:
         es1370_writeb(opaque, addr, val);
index 8a1e8f18c4269ecb5138cc03f1d556d2cade553c..cb51a963972791d1fdbbfefea0a0d163f5e1cf03 100644 (file)
@@ -522,7 +522,7 @@ bool esp_dreq(DeviceState *dev)
 
 static int handle_ti(ESPState *s)
 {
-    uint32_t dmalen, minlen;
+    int32_t dmalen, minlen;
 
        s->fifo_on = 1;
        s->transfer_complete = 0;
@@ -776,9 +776,10 @@ void fas408_write_fifo(void *opaque, uint64_t val)
 }
 
 
-void esp_reg_write(void *opaque, uint32_t saddr, uint64_t val)
+void esp_reg_write(void *opaque, uint32_t saddr, uint64_t val64)
 {
        ESPState *s = (ESPState*)opaque;
+    uint32_t val = (uint32_t)val64;
 
        if ((s->fas4xxextra & 1) && (s->wregs[ESP_RES3] & 0x80)) {
                saddr += ESP_REGS;
index 45bf27a9df2627dfaf860c4b4c586288be6f1394..b93435bfebcdff280c5794cd4caf5d6777cb3dd5 100644 (file)
@@ -227,7 +227,7 @@ typedef struct {
     uint32_t dsa;
     uint32_t temp;
     uint32_t dnad;
-    uint32_t dbc;
+    int32_t dbc;
     uint8_t istat;
     uint8_t dcmd;
     uint8_t dstat;
@@ -2160,7 +2160,7 @@ void lsi710_mmio_write(void *opaque, hwaddr addr,
 {
     LSIState710 *s = (LSIState710*)opaque;
 
-    lsi_reg_writeb(s, addr & 0xff, val);
+    lsi_reg_writeb(s, addr & 0xff, (uint8_t)val);
 }
 
 uint64_t lsi710_mmio_read(void *opaque, hwaddr addr,
index 6fae0f3e01a7f26cfe3268c3c3cd177b8b55e958..d6d70a5bd2904546d0d9dd848aea9c1c5321ed47 100644 (file)
@@ -221,7 +221,7 @@ typedef struct {
     uint32_t dsa;
     uint32_t temp;
     uint32_t dnad;
-    uint32_t dbc;
+    int32_t dbc;
     uint8_t istat0;
     uint8_t istat1;
     uint8_t dcmd;
@@ -1925,7 +1925,7 @@ void lsi_mmio_write(void *opaque, hwaddr addr,
 {
     LSIState *s = (LSIState*)opaque;
 
-    lsi_reg_writeb(s, addr & 0xff, val);
+    lsi_reg_writeb(s, addr & 0xff, (uint8_t)val);
 }
 
 uint64_t lsi_mmio_read(void *opaque, hwaddr addr,
index d5aaef7c20933623358e5218d84e72c73cf3b487..3316162b0ebb35b446b8185d4def1a56a7112538 100644 (file)
@@ -330,7 +330,7 @@ static bool ne2000_canreceive(NetClientState *nc, const uint8_t *buf)
 static ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
 {
     NE2000State *s = qemu_get_nic_opaque(nc);
-    int size = size_;
+    int size = (int)size_;
     uint8_t *p;
     unsigned int total_len, next, avail, len, index;
     uint8_t buf1[60];
@@ -414,7 +414,7 @@ static ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t siz
     s->isr |= ENISR_RX;
     ne2000_update_irq(s);
 
-    return size_;
+    return (ssize_t)size_;
 }
 
 static void ne2000_ioport_write(void *opaque, uint32_t addr, uint32_t val)
@@ -1001,9 +1001,10 @@ static uint64_t ne2000_read(void *opaque, hwaddr addr, unsigned size)
        return v;
 }
 
-static void ne2000_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)
+static void ne2000_write(void *opaque, hwaddr addr, uint64_t data64, unsigned size)
 {
     NE2000State *s = (NE2000State*)opaque;
+       uint32_t data = (uint32_t)data64;
 
 #if defined(DEBUG_NE2000)
        write_log(_T("NE2000_WRITE %08x %08x %d\n"), addr, (uae_u32)data, size);
@@ -1208,17 +1209,17 @@ static void REGPARAM2 ne2000_lput(struct pci_board_state *pcibs, uaecptr addr, u
 }
 static uae_u32 REGPARAM2 ne2000_bget(struct pci_board_state *pcibs, uaecptr addr)
 {
-       uae_u32 v = ne2000_read(ncs.ne2000state, addr, 1);
+       uae_u32 v = (uae_u32)ne2000_read(ncs.ne2000state, addr, 1);
        return v;
 }
 static uae_u32 REGPARAM2 ne2000_wget(struct pci_board_state *pcibs, uaecptr addr)
 {
-       uae_u32 v = ne2000_read(ncs.ne2000state, addr, 2);
+       uae_u32 v = (uae_u32)ne2000_read(ncs.ne2000state, addr, 2);
        return v;
 }
 static uae_u32 REGPARAM2 ne2000_lget(struct pci_board_state *pcibs, uaecptr addr)
 {
-       uae_u32 v = ne2000_read(ncs.ne2000state, addr, 4);
+       uae_u32 v = (uae_u32)ne2000_read(ncs.ne2000state, addr, 4);
        return v;
 }
 
index 6e61256092d3e91ab44fac2f239ee5a17d3d47f5..2e88f19053123aae532166097cac3e95f0ded8c9 100644 (file)
@@ -272,8 +272,8 @@ struct CirrusVGAState {
     uint32_t cirrus_bank_base[2];
     uint32_t cirrus_bank_limit[2];
     uint8_t cirrus_hidden_palette[48];
-    uint32_t hw_cursor_x;
-    uint32_t hw_cursor_y;
+    int32_t hw_cursor_x;
+    int32_t hw_cursor_y;
     int cirrus_blt_pixelwidth;
     int cirrus_blt_width;
     int cirrus_blt_height;
index fa090e3df5ac89454863802ec93f7f620c033542..c0428f735834e48dc4e1652260ed0a7f7eaecc4d 100644 (file)
@@ -24,7 +24,7 @@ struct ESPState {
     uint8_t tchi_has_id;
     int32_t ti_size;
        int32_t dma_len;
-    uint32_t ti_rptr, ti_wptr;
+    int32_t ti_rptr, ti_wptr;
     uint32_t status;
     uint32_t dma;
     uint8_t ti_buf[TI_BUFSZ];
@@ -40,13 +40,13 @@ struct ESPState {
        uint32_t dma_pending; // fakedma pending count
     /* The size of the current DMA transfer.  Zero if no transfer is in
        progress.  */
-    uint32_t dma_counter;
+    int32_t dma_counter;
     int dma_enabled;
        int pio_on;
        int fifo_on;
        int transfer_complete;
 
-    uint32_t async_len;
+    int32_t async_len;
     uint8_t *async_buf;
 
     ESPDMAMemoryReadWriteFunc dma_memory_read;
index 59e1b1021944e0b9799e5773cb8c3734c65134f5..942db1760b354fedb3b99d0a240ea4bc5bf5495d 100644 (file)
@@ -324,7 +324,7 @@ static uint8_t vga_precise_retrace(VGACommonState *s)
 
         cur_tick = qemu_get_clock_ns(vm_clock);
 
-        cur_char = (cur_tick / r->ticks_per_char) % r->total_chars;
+        cur_char = (int)((cur_tick / r->ticks_per_char) % r->total_chars);
         cur_line = cur_char / r->htotal;
 
         if (cur_line >= r->vstart && cur_line <= r->vend) {
@@ -1985,8 +1985,8 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
                uint32_t r2sz = s->cr[0x34] | (((s->cr[0x36] >> 2) & 3) << 8);
                uint32_t r2adjust = (s->cr[0x5d] >> 4) & 3;
                uint32_t r2dsz = s->cr[0x35] | (((s->cr[0x36] >> 4) & 3) << 8);
-               uint32_t wvs = s->cr[0x37] | (((s->cr[0x39] >> 0) & 3) << 8);
-               uint32_t wve = s->cr[0x38] | (((s->cr[0x39] >> 2) & 3) << 8);
+               int32_t wvs = s->cr[0x37] | (((s->cr[0x39] >> 0) & 3) << 8);
+               int32_t wve = s->cr[0x38] | (((s->cr[0x39] >> 2) & 3) << 8);
                bool occlusion = ((s->cr[0x3e] >> 7) & 1) != 0 && bits < 24;
                uint32_t region1size = 32 * r1sz / gfxbpp + (r1adjust * 8 / gfxbpp);
                uint32_t region2size = 32 * r2sz / gfxbpp + (r2adjust * 8 / gfxbpp);
@@ -2401,7 +2401,7 @@ static void vga_mem_write(void *opaque, hwaddr addr,
 {
     VGACommonState *s = (VGACommonState*)opaque;
 
-    return vga_mem_writeb(s, addr, data);
+    return vga_mem_writeb(s, addr, (uint32_t)data);
 }
 
 const MemoryRegionOps vga_mem_ops = {
index 71236ce33421dade58d250d6c7cb3d19a8e86872..13509c7fd3fff4697bedd71456036ada0b7376d8 100644 (file)
@@ -142,13 +142,13 @@ typedef struct VGACommonState {
     uint8_t double_scan;
        uint8_t double_scan2;
     uint32_t line_offset;
-    uint32_t line_compare;
+    int32_t line_compare;
     uint32_t start_addr;
     uint32_t plane_updated;
     uint32_t last_line_offset;
     uint8_t last_cw, last_ch;
-    uint32_t last_width, last_height; /* in chars or pixels */
-    uint32_t last_scr_width, last_scr_height; /* in pixels */
+    int32_t last_width, last_height; /* in chars or pixels */
+    int32_t last_scr_width, last_scr_height; /* in pixels */
     uint32_t last_depth; /* in bits */
     uint8_t cursor_start, cursor_end;
     bool cursor_visible_phase;
index 1942100d9da27b0d459df2fc7f40aba0d16621f4..126f25458f28cb68a77f73611e48cb5fc907bb95 100644 (file)
@@ -57,14 +57,14 @@ static inline void glue(vga_draw_glyph_line_, DEPTH)(uint8_t *d,
         ((uint32_t *)d)[2] = (dmask4[(font_data >> 2) & 3] & xorcol) ^ bgcol;
         ((uint32_t *)d)[3] = (dmask4[(font_data >> 0) & 3] & xorcol) ^ bgcol;
 #else
-        ((uint32_t *)d)[0] = (-((font_data >> 7)) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[1] = (-((font_data >> 6) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[2] = (-((font_data >> 5) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[3] = (-((font_data >> 4) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[4] = (-((font_data >> 3) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[5] = (-((font_data >> 2) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[6] = (-((font_data >> 1) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[7] = (-((font_data >> 0) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[0] = (0-((font_data >> 7)) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[1] = (0-((font_data >> 6) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[2] = (0-((font_data >> 5) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[3] = (0-((font_data >> 4) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[4] = (0-((font_data >> 3) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[5] = (0-((font_data >> 2) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[6] = (0-((font_data >> 1) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[7] = (0-((font_data >> 0) & 1) & xorcol) ^ bgcol;
 #endif
 }
 
@@ -132,14 +132,14 @@ static void glue(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,
         else
             ((uint16_t *)d)[8] = bgcol;
 #else
-        ((uint32_t *)d)[0] = (-((font_data >> 7)) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[1] = (-((font_data >> 6) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[2] = (-((font_data >> 5) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[3] = (-((font_data >> 4) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[4] = (-((font_data >> 3) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[5] = (-((font_data >> 2) & 1) & xorcol) ^ bgcol;
-        ((uint32_t *)d)[6] = (-((font_data >> 1) & 1) & xorcol) ^ bgcol;
-        v = (-((font_data >> 0) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[0] = (0-((font_data >> 7)) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[1] = (0-((font_data >> 6) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[2] = (0-((font_data >> 5) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[3] = (0-((font_data >> 4) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[4] = (0-((font_data >> 3) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[5] = (0-((font_data >> 2) & 1) & xorcol) ^ bgcol;
+        ((uint32_t *)d)[6] = (0-((font_data >> 1) & 1) & xorcol) ^ bgcol;
+        v = (0-((font_data >> 0) & 1) & xorcol) ^ bgcol;
         ((uint32_t *)d)[7] = v;
         if (dup9)
             ((uint32_t *)d)[8] = v;
index 44dd69ba7f3610767e348b1b573efeff860eb428..66432d612dbe6c594e5fb32aa47d425c0b1b1e71 100644 (file)
@@ -1171,22 +1171,22 @@ void addkeyfile (const TCHAR *path)
        zfile_fclose (f);
 }
 
-void addkeydir (const TCHAR *path)
+void addkeydir(const TCHAR *path)
 {
        TCHAR tmp[MAX_DPATH];
 
-       _tcscpy (tmp, path);
-       if (zfile_exists (tmp)) {
+       _tcscpy(tmp, path);
+       if (zfile_exists(tmp)) {
                int i;
-               for (i = _tcslen (tmp) - 1; i > 0; i--) {
+               for (i = uaetcslen(tmp) - 1; i > 0; i--) {
                        if (tmp[i] == '\\' || tmp[i] == '/')
                                break;
                }
                tmp[i] = 0;
        }
-       _tcscat (tmp, _T("/"));
-       _tcscat (tmp, _T("rom.key"));
-       addkeyfile (tmp);
+       _tcscat(tmp, _T("/"));
+       _tcscat(tmp, _T("rom.key"));
+       addkeyfile(tmp);
 }
 
 int get_keyring (void)
@@ -2081,7 +2081,7 @@ struct zfile *read_rom_name_guess (const TCHAR *filename, TCHAR *out)
        struct zfile *f;
        const TCHAR *name;
 
-       for (i = _tcslen (filename) - 1; i >= 0; i--) {
+       for (i = uaetcslen(filename) - 1; i >= 0; i--) {
                if (filename[i] == '/' || filename[i] == '\\')
                        break;
        }
@@ -2091,13 +2091,13 @@ struct zfile *read_rom_name_guess (const TCHAR *filename, TCHAR *out)
 
        for (i = 0; i < romlist_cnt; i++) {
                TCHAR *n = rl[i].path;
-               for (j = _tcslen (n) - 1; j >= 0; j--) {
+               for (j = uaetcslen(n) - 1; j >= 0; j--) {
                        if (n[j] == '/' || n[j] == '\\')
                                break;
                }
                if (j < 0)
                        continue;
-               if (!_tcsicmp (name, n + j)) {
+               if (!_tcsicmp(name, n + j)) {
                        struct romdata *rd = rl[i].rd;
                        f = read_rom (rd);
                        if (f) {
index 222583133016dbf6b5b54c92eef56ae74d537136..6d52f70de99c29eafbabfbee02c76cb42a99a3d6 100644 (file)
--- a/sana2.cpp
+++ b/sana2.cpp
@@ -433,7 +433,7 @@ static uae_u32 REGPARAM2 dev_open_2 (TrapContext *ctx)
        if (i == MAX_OPEN_DEVICES)
                return openfail(ctx, ioreq, IOERR_UNITBUSY);
 
-       trap_put_long(ctx, ioreq + 24, pdev - pdevst);
+       trap_put_longt(ctx, ioreq + 24, pdev - pdevst);
        pdev->unit = unit;
        pdev->flags = flags;
        pdev->inuse = 1;
index 1c6e6a7f13577d577741f06e925605f5186048f2..ed444e6b4b22040a25aedaacf73c58e40c0656fa 100644 (file)
@@ -264,7 +264,7 @@ TCHAR *restore_string_func (uae_u8 **dstp)
        char *top, *to;
        TCHAR *s;
 
-       len = strlen ((char*)dst) + 1;
+       len = uaestrlen((char*)dst) + 1;
        top = to = xmalloc (char, len);
        do {
                v = *dst++;
@@ -1262,7 +1262,7 @@ int save_state (const TCHAR *filename, const TCHAR *description)
 
 void savestate_quick (int slot, int save)
 {
-       int i, len = _tcslen (savestate_fname);
+       int i, len = uaetcslen(savestate_fname);
        i = len - 1;
        while (i >= 0 && savestate_fname[i] != '_')
                i--;
index bfc71da197c14c93ab791fc93cf6c9b225b51647..ee41c5798ac37f03e4adde7c9b27a1241a2c6ed6 100644 (file)
@@ -228,7 +228,7 @@ static uae_u32 REGPARAM2 dev_open_2(TrapContext *ctx, int type)
                pdev->unit = unit;
                pdev->flags = flags;
                pdev->inuse = 1;
-               trap_put_long(ctx, ioreq + 24, pdev - pdevst);
+               trap_put_longt(ctx, ioreq + 24, pdev - pdevst);
                start_thread (dev);
        } else {
                for (i = 0; i < MAX_OPEN_DEVICES; i++) {
@@ -237,7 +237,7 @@ static uae_u32 REGPARAM2 dev_open_2(TrapContext *ctx, int type)
                }
                if (i == MAX_OPEN_DEVICES)
                        return openfail(ctx, ioreq, IOERR_OPENFAIL);
-               trap_put_long(ctx, ioreq + 24, pdev - pdevst);
+               trap_put_longt(ctx, ioreq + 24, pdev - pdevst);
        }
        dev->opencnt++;
 
index 60fb7198f2ad15ee0f1906a889a1c1288c6acd39..1f51aa986778bfa09d739d0c41ef1227e694313d 100644 (file)
--- a/traps.cpp
+++ b/traps.cpp
@@ -1063,6 +1063,16 @@ void trap_put_long(TrapContext *ctx, uaecptr addr, uae_u32 v)
                put_long(addr, v);
        }
 }
+void trap_put_longt(TrapContext* ctx, uaecptr addr, size_t v)
+{
+       if (trap_is_indirect_null(ctx)) {
+               call_hardware_trap_back(ctx, TRAPCMD_PUT_LONG, addr, (uae_u32)v, 0, 0);
+       }
+       else {
+               put_long(addr, (uae_u32)v);
+       }
+}
+
 void trap_put_word(TrapContext *ctx, uaecptr addr, uae_u16 v)
 {
        if (trap_is_indirect_null(ctx)) {
index eb606269e9f111f0715b700c7ffca346873debe1..9493c75e07fd5e1ff551439ed181faa890da9762 100644 (file)
--- a/zfile.cpp
+++ b/zfile.cpp
@@ -1646,13 +1646,13 @@ static struct zfile *openzip (const TCHAR *pname)
 
        zippath[0] = 0;
        _tcscpy (name, pname);
-       i = _tcslen (name) - 2;
+       i = uaetcslen (name) - 2;
        while (i > 0) {
                if ((name[i] == '/' || name[i] == '\\') && i > 4) {
                        v = name[i];
                        name[i] = 0;
                        for (j = 0; plugins_7z[j]; j++) {
-                               int len = _tcslen (plugins_7z[j]);
+                               int len = uaetcslen (plugins_7z[j]);
                                if (name[i - len - 1] == '.' && !strcasecmp (name + i - len, plugins_7z[j])) {
                                        struct zfile *f = zfile_fopen_nozip (name, _T("rb"));
                                        if (f) {
@@ -2378,9 +2378,9 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z)
                        p++;
                }
                *p = 0;
-               if (size > strlen (s2) + 1)
-                       size = strlen (s2) + 1;
-               au_copy (s, size, s2);
+               if (size > uaestrlen(s2) + 1)
+                       size = uaestrlen(s2) + 1;
+               au_copy(s, size, s2);
                return s + size;
        } else {
                bool alloc = false;
@@ -2401,9 +2401,9 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z)
                        }
                        return NULL;
                }
-               if (size > strlen (s2) + 1)
-                       size = strlen (s2) + 1;
-               au_copy (s, size, s2);
+               if (size > uaestrlen(s2) + 1)
+                       size = uaestrlen(s2) + 1;
+               au_copy(s, size, s2);
                if (alloc) {
                        xfree(s2);
                }
@@ -2523,7 +2523,7 @@ TCHAR *zfile_getfilename (struct zfile *f)
        int i;
        if (f->name == NULL)
                return NULL;
-       for (i = _tcslen (f->name) - 1; i >= 0; i--) {
+       for (i = uaetcslen(f->name) - 1; i >= 0; i--) {
                if (f->name[i] == '\\' || f->name[i] == '/' || f->name[i] == ':') {
                        i++;
                        return &f->name[i];
@@ -2591,11 +2591,11 @@ static struct znode *znode_alloc (struct znode *parent, const TCHAR *name)
                        if (ext && ext > tmpname + 2 && ext[-2] == '.') {
                                ext[-1]++;
                        } else if (ext) {
-                               memmove (ext + 2, ext, (_tcslen (ext) + 1) * sizeof (TCHAR));
+                               memmove (ext + 2, ext, (uaetcslen(ext) + 1) * sizeof (TCHAR));
                                ext[0] = '.';
                                ext[1] = '1';
                        } else {
-                               int len = _tcslen (tmpname);
+                               int len = uaetcslen(tmpname);
                                tmpname[len] = '.';
                                tmpname[len + 1] = '1';
                                tmpname[len + 2] = 0;
@@ -2687,7 +2687,7 @@ static struct zvolume *zvolume_alloc_2 (const TCHAR *name, struct zfile *z, unsi
        i = 0;
        if (name[0] != '/' && name[0] != '\\' && _tcsncmp(name, _T(".\\"), 2) != 0 && _tcsncmp(name, _T("..\\"), 3) != 0) {
                if (_tcschr (name, ':') == 0) {
-                       for (i = _tcslen (name) - 1; i > 0; i--) {
+                       for (i = uaetcslen (name) - 1; i > 0; i--) {
                                if (name[i] == FSDB_DIR_SEPARATOR) {
                                        i++;
                                        break;
@@ -2982,8 +2982,8 @@ static struct znode *get_znode (struct zvolume *zv, const TCHAR *ppath, int recu
                        if (!_tcsicmp (zpath, path))
                                return zn;
                } else {
-                       int len = _tcslen (zpath);
-                       if (_tcslen (path) >= len && (path[len] == 0 || path[len] == FSDB_DIR_SEPARATOR) && !_tcsnicmp (zpath, path, len)) {
+                       int len = uaetcslen(zpath);
+                       if (uaetcslen(path) >= len && (path[len] == 0 || path[len] == FSDB_DIR_SEPARATOR) && !_tcsnicmp (zpath, path, len)) {
                                if (path[len] == 0)
                                        return zn;
                                if (zn->vchild) {
index 4a4a8dd34bae638a5eb0c3f5f949baa71ab2c147..761233bb8d7394b2f513f7fdde8bc9a4a3d9c979 100644 (file)
@@ -1056,7 +1056,7 @@ struct zvolume *archive_directory_plain (struct zfile *z)
                char *an = ua (zai.name);
                char *data = xmalloc (char, 1 + strlen (an) + 1 + 1 + 1);
                sprintf (data, "\"%s\"\n", an);
-               zn = addfile (zv, z, _T("s/startup-sequence"), (uae_u8*)data, strlen (data));
+               zn = addfile (zv, z, _T("s/startup-sequence"), (uae_u8*)data, uaestrlen (data));
                xfree (data);
                xfree (an);
        }