]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - fatfs/source/ffunicode.c
Import fatfs R0.15
[z180-stamp.git] / fatfs / source / ffunicode.c
index 7b4b9964bfbb6d12ca5a5f28b2187cc3bed00441..54ad526710595e64716d0bc6d01e8461e1b3821d 100644 (file)
@@ -1,13 +1,13 @@
 /*------------------------------------------------------------------------*/\r
-/* Unicode handling functions for FatFs R0.13b                            */\r
+/* Unicode Handling Functions for FatFs R0.13 and Later                   */\r
+/*------------------------------------------------------------------------*/\r
+/* This module will occupy a huge memory in the .rodata section when the  */\r
+/* FatFs is configured for LFN with DBCS. If the system has a Unicode     */\r
+/* library for the code conversion, this module should be modified to use */\r
+/* it to avoid silly memory consumption.                                  */\r
 /*------------------------------------------------------------------------*/\r
-/* This module will occupy a huge memory in the .const section when the    /\r
-/  FatFs is configured for LFN with DBCS. If the system has any Unicode    /\r
-/  utilitiy for the code conversion, this module should be modified to use /\r
-/  that function to avoid silly memory consumption.                        /\r
-/-------------------------------------------------------------------------*/\r
 /*\r
-/ Copyright (C) 2018, ChaN, all right reserved.\r
+/ Copyright (C) 2022, ChaN, all right reserved.\r
 /\r
 / FatFs module is an open source software. Redistribution and use of FatFs in\r
 / source and binary forms, with or without modification, are permitted provided\r
 \r
 #include "ff.h"\r
 \r
-#if FF_USE_LFN /* This module is blanked when non-LFN configuration */\r
-\r
-#if FF_DEFINED != 63463        /* Revision ID */\r
-#error Wrong include file (ff.h).\r
-#endif\r
+#if FF_USE_LFN != 0    /* This module will be blanked if in non-LFN configuration */\r
 \r
 #define MERGE2(a, b) a ## b\r
 #define CVTBL(tbl, cp) MERGE2(tbl, cp)\r
@@ -15218,8 +15214,8 @@ static const WCHAR uc869[] = {  /*  CP869(Greek 2) to Unicode conversion table */
 \r
 \r
 /*------------------------------------------------------------------------*/\r
-/* OEM <==> Unicode conversions for static code page configuration        */\r
-/* SBCS fixed code page                                                   */\r
+/* OEM <==> Unicode Conversions for Static Code Page Configuration with   */\r
+/* SBCS Fixed Code Page                                                   */\r
 /*------------------------------------------------------------------------*/\r
 \r
 #if FF_CODE_PAGE != 0 && FF_CODE_PAGE < 900\r
@@ -15229,7 +15225,7 @@ WCHAR ff_uni2oem (      /* Returns OEM code character, zero on error */
 )\r
 {\r
        WCHAR c = 0;\r
-       const WCHAR *p = CVTBL(uc, FF_CODE_PAGE);\r
+       const WCHARp = CVTBL(uc, FF_CODE_PAGE);\r
 \r
 \r
        if (uni < 0x80) {       /* ASCII? */\r
@@ -15245,13 +15241,13 @@ WCHAR ff_uni2oem (    /* Returns OEM code character, zero on error */
        return c;\r
 }\r
 \r
-WCHAR ff_oem2uni (     /* Returns Unicode character, zero on error */\r
+WCHAR ff_oem2uni (     /* Returns Unicode character in UTF-16, zero on error */\r
        WCHAR   oem,    /* OEM code to be converted */\r
        WORD    cp              /* Code page for the conversion */\r
 )\r
 {\r
        WCHAR c = 0;\r
-       const WCHAR *p = CVTBL(uc, FF_CODE_PAGE);\r
+       const WCHARp = CVTBL(uc, FF_CODE_PAGE);\r
 \r
 \r
        if (oem < 0x80) {       /* ASCII? */\r
@@ -15271,8 +15267,8 @@ WCHAR ff_oem2uni (      /* Returns Unicode character, zero on error */
 \r
 \r
 /*------------------------------------------------------------------------*/\r
-/* OEM <==> Unicode conversions for static code page configuration        */\r
-/* DBCS fixed code page                                                   */\r
+/* OEM <==> Unicode Conversions for Static Code Page Configuration with   */\r
+/* DBCS Fixed Code Page                                                   */\r
 /*------------------------------------------------------------------------*/\r
 \r
 #if FF_CODE_PAGE >= 900\r
@@ -15281,7 +15277,7 @@ WCHAR ff_uni2oem (      /* Returns OEM code character, zero on error */
        WORD    cp              /* Code page for the conversion */\r
 )\r
 {\r
-       const WCHAR *p;\r
+       const WCHARp;\r
        WCHAR c = 0, uc;\r
        UINT i = 0, n, li, hi;\r
 \r
@@ -15312,12 +15308,12 @@ WCHAR ff_uni2oem (    /* Returns OEM code character, zero on error */
 }\r
 \r
 \r
-WCHAR ff_oem2uni (     /* Returns Unicode character, zero on error */\r
+WCHAR ff_oem2uni (     /* Returns Unicode character in UTF-16, zero on error */\r
        WCHAR   oem,    /* OEM code to be converted */\r
        WORD    cp              /* Code page for the conversion */\r
 )\r
 {\r
-       const WCHAR *p;\r
+       const WCHARp;\r
        WCHAR c = 0;\r
        UINT i = 0, n, li, hi;\r
 \r
@@ -15350,7 +15346,7 @@ WCHAR ff_oem2uni (      /* Returns Unicode character, zero on error */
 \r
 \r
 /*------------------------------------------------------------------------*/\r
-/* OEM <==> Unicode conversions for dynamic code page configuration       */\r
+/* OEM <==> Unicode Conversions for Dynamic Code Page Configuration       */\r
 /*------------------------------------------------------------------------*/\r
 \r
 #if FF_CODE_PAGE == 0\r
@@ -15364,7 +15360,7 @@ WCHAR ff_uni2oem (      /* Returns OEM code character, zero on error */
        WORD    cp              /* Code page for the conversion */\r
 )\r
 {\r
-       const WCHAR *p;\r
+       const WCHARp;\r
        WCHAR c = 0, uc;\r
        UINT i, n, li, hi;\r
 \r
@@ -15411,12 +15407,12 @@ WCHAR ff_uni2oem (    /* Returns OEM code character, zero on error */
 }\r
 \r
 \r
-WCHAR ff_oem2uni (     /* Returns Unicode character, zero on error */\r
+WCHAR ff_oem2uni (     /* Returns Unicode character in UTF-16, zero on error */\r
        WCHAR   oem,    /* OEM code to be converted (DBC if >=0x100) */\r
        WORD    cp              /* Code page for the conversion */\r
 )\r
 {\r
-       const WCHAR *p;\r
+       const WCHARp;\r
        WCHAR c = 0;\r
        UINT i, n, li, hi;\r
 \r
@@ -15462,14 +15458,14 @@ WCHAR ff_oem2uni (    /* Returns Unicode character, zero on error */
 \r
 \r
 /*------------------------------------------------------------------------*/\r
-/* Unicode up-case conversion                                             */\r
+/* Unicode Up-case Conversion                                             */\r
 /*------------------------------------------------------------------------*/\r
 \r
 DWORD ff_wtoupper (    /* Returns up-converted code point */\r
        DWORD uni               /* Unicode code point to be up-converted */\r
 )\r
 {\r
-       const WORD *p;\r
+       const WORDp;\r
        WORD uc, bc, nc, cmd;\r
        static const WORD cvt1[] = {    /* Compressed up conversion table for U+0000 - U+0FFF */\r
                /* Basic Latin */\r
@@ -15594,4 +15590,4 @@ DWORD ff_wtoupper (     /* Returns up-converted code point */
 }\r
 \r
 \r
-#endif /* #if FF_USE_LFN */\r
+#endif /* #if FF_USE_LFN != 0 */\r