]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
cyrillic charset support and fix
authorToni Wilen <twilen@winuae.net>
Fri, 26 Feb 2010 17:22:27 +0000 (19:22 +0200)
committerToni Wilen <twilen@winuae.net>
Fri, 26 Feb 2010 17:22:27 +0000 (19:22 +0200)
filesys.cpp
include/fsdb.h
od-win32/fsdb_mywin32.cpp
od-win32/fsdb_win32.cpp
od-win32/unicode.cpp

index 7bef42e701f70350a134369fd4e146c88f232ac6..69eb53b5b223ef645970ca527cee13370b4542ea 100644 (file)
@@ -936,18 +936,21 @@ static TCHAR *bstr (Unit *unit, uaecptr addr)
 static TCHAR *bstr_cut (Unit *unit, uaecptr addr)
 {
        TCHAR *p = unit->tmpbuf3;
-       int i, colon_seen = 0;
+       int i, colon_seen = 0, off;
        int n = get_byte (addr);
+       uae_char buf[257];
 
+       off = 0;
        addr++;
        for (i = 0; i < n; i++, addr++) {
                uae_u8 c = get_byte (addr);
-               unit->tmpbuf3[i] = c;
+               buf[i] = c;
                if (c == '/' || (c == ':' && colon_seen++ == 0))
-                       p = unit->tmpbuf3 + i + 1;
+                       off = i + 1;
        }
-       unit->tmpbuf3[i] = 0;
-       return p;
+       buf[i] = 0;
+       au_fs_copy (unit->tmpbuf3, sizeof (unit->tmpbuf3) / sizeof (TCHAR), buf);
+       return &p[off];
 }
 
 static Unit *units = 0;
@@ -1733,7 +1736,7 @@ static TCHAR *get_aname (Unit *unit, a_inode *base, TCHAR *rel)
        return my_strdup (rel);
 }
 
-static void init_child_aino_tree(Unit *unit, a_inode *base, a_inode *aino)
+static void init_child_aino_tree (Unit *unit, a_inode *base, a_inode *aino)
 {
        /* Update tree structure */
        aino->parent = base;
index 197733b30bbdf6bd9034e4753bbf1e76ef1be161..87bbf163962783aea7544ae6d688915b96d96d7a 100644 (file)
@@ -109,11 +109,7 @@ extern int fsdb_used_as_nname (a_inode *base, const TCHAR *);
 extern a_inode *fsdb_lookup_aino_aname (a_inode *base, const TCHAR *);
 extern a_inode *fsdb_lookup_aino_nname (a_inode *base, const TCHAR *);
 extern int fsdb_exists (TCHAR *nname);
-
-STATIC_INLINE int same_aname (const TCHAR *an1, const TCHAR *an2)
-{
-    return strcasecmp (an1, an2) == 0;
-}
+extern int same_aname (const TCHAR *an1, const TCHAR *an2);
 
 /* Filesystem-dependent functions.  */
 extern int fsdb_name_invalid (const TCHAR *n);
index 30662da82106b28a7aea0606670f5f5ced14383c..1e67e55cf54c5e406a56d17a2b2bcfa8dc935129 100644 (file)
@@ -395,4 +395,3 @@ FILE *my_opentext (const TCHAR *name)
        }
        return _tfopen (name, L"r");
 }
-
index 73d79a10575a2a36ca11f9d2af667360953db30b..a8118c8b5e100f1bd0f4b0dbbb48ea7dbfe35a33 100644 (file)
@@ -91,9 +91,9 @@ static int read_uaefsdb (const TCHAR *dir, const TCHAR *name, uae_u8 *fsdb)
                        if (fsdb_debug) {
                                TCHAR *an, *nn, *co;
                                write_log (L"->ok\n");
-                               an = aucp ((char*)fsdb + 5, currprefs.win32_fscodepage);
-                               nn = aucp ((char*)fsdb + 262, currprefs.win32_fscodepage);
-                               co = aucp ((char*)fsdb + 519, currprefs.win32_fscodepage);
+                               an = au_fs ((char*)fsdb + 5);
+                               nn = au_fs ((char*)fsdb + 262);
+                               co = au_fs ((char*)fsdb + 519);
                                write_log (L"v=%02x flags=%08x an='%s' nn='%s' c='%s'\n",
                                        fsdb[0], ((uae_u32*)(fsdb+1))[0], an, nn, co);
                                xfree (co);
@@ -148,9 +148,9 @@ static int write_uaefsdb (const TCHAR *dir, uae_u8 *fsdb)
                NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
        if (fsdb_debug) {
                TCHAR *an, *nn, *co;
-               an = aucp ((char*)fsdb + 5, currprefs.win32_fscodepage);
-               nn = aucp ((char*)fsdb + 262, currprefs.win32_fscodepage);
-               co = aucp ((char*)fsdb + 519, currprefs.win32_fscodepage);
+               an = au_fs ((char*)fsdb + 5);
+               nn = au_fs ((char*)fsdb + 262);
+               co = au_fs ((char*)fsdb + 519);
                write_log (L"write_uaefsdb '%s' = %x\n", p, h);
                write_log (L"v=%02x flags=%08x an='%s' nn='%s' c='%s'\n",
                        fsdb[0], ((uae_u32*)(fsdb+1))[0], an, nn, co);
@@ -205,16 +205,16 @@ static void create_uaefsdb (a_inode *aino, uae_u8 *buf, int winmode)
        char *s;
        buf[0] = 1;
        do_put_mem_long ((uae_u32 *)(buf + 1), aino->amigaos_mode);
-       s = uacp (aino->aname, currprefs.win32_fscodepage);
+       s = ua_fs (aino->aname, -1);
        strncpy ((char*)buf + 5, s, 256);
        buf[5 + 256] = '\0';
        xfree (s);
        nn = nname_begin (aino->nname);
-       s = uacp (nn, currprefs.win32_fscodepage);
+       s = ua_fs (nn, -1);
        strncpy ((char*)buf + 5 + 257, s, 256);
        buf[5 + 257 + 256] = '\0';
        xfree (s);
-       s = uacp (aino->comment ? aino->comment : L"", currprefs.win32_fscodepage);
+       s = ua_fs (aino->comment ? aino->comment : L"", -1);
        strncpy ((char*)buf + 5 + 2 * 257, s, 80);
        buf[5 + 2 * 257 + 80] = '\0';
        xfree (s);
@@ -237,14 +237,14 @@ static a_inode *aino_from_buf (a_inode *base, uae_u8 *buf, int *winmode)
        if (buf2[0]) {
                aino->aname = my_strdup ((TCHAR*)buf2);
        } else {
-               aino->aname = aucp ((char*)buf, currprefs.win32_fscodepage);
+               aino->aname = au_fs ((char*)buf);
        }
        buf += 257;
        buf2 += 257 * 2;
        if (buf2[0]) {
                aino->nname = build_nname (base->nname, (TCHAR*)buf2);
        } else {
-               s = aucp ((char*)buf, currprefs.win32_fscodepage);
+               s = au_fs ((char*)buf);
                aino->nname = build_nname (base->nname, s);
                xfree (s);
        }
@@ -292,7 +292,7 @@ static int fsdb_name_invalid_2 (const TCHAR *n)
        if (a == 'C' && b == 'O' && c == 'N') ll = 3; /* CON  */
        if (a == 'P' && b == 'R' && c == 'N') ll = 3; /* PRN  */
        if (a == 'N' && b == 'U' && c == 'L') ll = 3; /* NUL  */
-       if (a == 'L' && b == 'P' && c == 'T'  && (d >= '0' && d <= '9')) ll = 4;  /* LPT# */
+       if (a == 'L' && b == 'P' && c == 'T'  && (d >= '0' && d <= '9')) ll = 4; /* LPT# */
        if (a == 'C' && b == 'O' && c == 'M'  && (d >= '0' && d <= '9')) ll = 4; /* COM# */
        /* AUX.anything, CON.anything etc.. are also illegal names */
        if (ll && (l == ll || (l > ll && n[ll] == '.')))
@@ -317,7 +317,7 @@ static int fsdb_name_invalid_2 (const TCHAR *n)
        s2[0] = 0;
        ua_fs_copy (s1, MAX_DPATH, n, -1);
        au_fs_copy (s2, MAX_DPATH, s1);
-       if (_tcsicmp (s2, n) != 0)
+       if (_tcscmp (s2, n) != 0)
                return 1;
 
        return 0; /* the filename passed all checks, now it should be ok */
index e7d643f7bd4299514755db88f3d893afbb2e7619..f61940edfa617490e57b933cacd1e180b1513020 100644 (file)
@@ -317,3 +317,8 @@ void unicode_init (void)
        }               
        write_log (L"End\n");
 }
+
+int same_aname (const TCHAR *an1, const TCHAR *an2)
+{
+       return CompareString (LOCALE_INVARIANT, NORM_IGNORECASE, an1, -1, an2, -1) == CSTR_EQUAL;
+}