X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/b01142c8b93edb04463006a6d127e43788147882..7aaec0f97677b451e024ef5d1cd2b675a914d440:/fatfs/source/ffunicode.c diff --git a/fatfs/source/ffunicode.c b/fatfs/source/ffunicode.c index 7c552a6..e3225d9 100644 --- a/fatfs/source/ffunicode.c +++ b/fatfs/source/ffunicode.c @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------*/ -/* Unicode handling functions for FatFs R0.13b */ +/* Unicode Handling Functions for FatFs R0.13 and Later */ +/*------------------------------------------------------------------------*/ +/* This module will occupy a huge memory in the .rodata section when the */ +/* FatFs is configured for LFN with DBCS. If the system has a Unicode */ +/* library for the code conversion, this module should be modified to use */ +/* it to avoid silly memory consumption. */ /*------------------------------------------------------------------------*/ -/* This module will occupy a huge memory in the .const section when the / -/ FatFs is configured for LFN with DBCS. If the system has any Unicode / -/ utilitiy for the code conversion, this module should be modified to use / -/ that function to avoid silly memory consumption. / -/-------------------------------------------------------------------------*/ /* -/ Copyright (C) 2018, ChaN, all right reserved. +/ Copyright (C) 2022, ChaN, all right reserved. / / FatFs module is an open source software. Redistribution and use of FatFs in / source and binary forms, with or without modification, are permitted provided @@ -25,11 +25,7 @@ #include "ff.h" -#if FF_USE_LFN /* This module is blanked when non-LFN configuration */ - -#if FF_DEFINED != 63463 /* Revision ID */ -#error Wrong include file (ff.h). -#endif +#if FF_USE_LFN != 0 /* This module will be blanked if in non-LFN configuration */ #if defined(__GNUC__) && defined(__FLASH) #define FLASH __flash @@ -15224,8 +15220,8 @@ static const FLASH WCHAR uc869[] = { /* CP869(Greek 2) to Unicode conversion ta /*------------------------------------------------------------------------*/ -/* OEM <==> Unicode conversions for static code page configuration */ -/* SBCS fixed code page */ +/* OEM <==> Unicode Conversions for Static Code Page Configuration with */ +/* SBCS Fixed Code Page */ /*------------------------------------------------------------------------*/ #if FF_CODE_PAGE != 0 && FF_CODE_PAGE < 900 @@ -15235,7 +15231,7 @@ WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */ ) { WCHAR c = 0; - const FLASH WCHAR *p = CVTBL(uc, FF_CODE_PAGE); + const FLASH WCHAR* p = CVTBL(uc, FF_CODE_PAGE); if (uni < 0x80) { /* ASCII? */ @@ -15251,13 +15247,13 @@ WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */ return c; } -WCHAR ff_oem2uni ( /* Returns Unicode character, zero on error */ +WCHAR ff_oem2uni ( /* Returns Unicode character in UTF-16, zero on error */ WCHAR oem, /* OEM code to be converted */ WORD cp /* Code page for the conversion */ ) { WCHAR c = 0; - const FLASH WCHAR *p = CVTBL(uc, FF_CODE_PAGE); + const FLASH WCHAR* p = CVTBL(uc, FF_CODE_PAGE); if (oem < 0x80) { /* ASCII? */ @@ -15277,8 +15273,8 @@ WCHAR ff_oem2uni ( /* Returns Unicode character, zero on error */ /*------------------------------------------------------------------------*/ -/* OEM <==> Unicode conversions for static code page configuration */ -/* DBCS fixed code page */ +/* OEM <==> Unicode Conversions for Static Code Page Configuration with */ +/* DBCS Fixed Code Page */ /*------------------------------------------------------------------------*/ #if FF_CODE_PAGE >= 900 @@ -15287,7 +15283,7 @@ WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */ WORD cp /* Code page for the conversion */ ) { - const FLASH WCHAR *p; + const FLASH WCHAR* p; WCHAR c = 0, uc; UINT i = 0, n, li, hi; @@ -15318,12 +15314,12 @@ WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */ } -WCHAR ff_oem2uni ( /* Returns Unicode character, zero on error */ +WCHAR ff_oem2uni ( /* Returns Unicode character in UTF-16, zero on error */ WCHAR oem, /* OEM code to be converted */ WORD cp /* Code page for the conversion */ ) { - const FLASH WCHAR *p; + const FLASH WCHAR* p; WCHAR c = 0; UINT i = 0, n, li, hi; @@ -15356,7 +15352,7 @@ WCHAR ff_oem2uni ( /* Returns Unicode character, zero on error */ /*------------------------------------------------------------------------*/ -/* OEM <==> Unicode conversions for dynamic code page configuration */ +/* OEM <==> Unicode Conversions for Dynamic Code Page Configuration */ /*------------------------------------------------------------------------*/ #if FF_CODE_PAGE == 0 @@ -15370,7 +15366,7 @@ WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */ WORD cp /* Code page for the conversion */ ) { - const FLASH WCHAR *p; + const FLASH WCHAR* p; WCHAR c = 0, uc; UINT i, n, li, hi; @@ -15417,12 +15413,12 @@ WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */ } -WCHAR ff_oem2uni ( /* Returns Unicode character, zero on error */ +WCHAR ff_oem2uni ( /* Returns Unicode character in UTF-16, zero on error */ WCHAR oem, /* OEM code to be converted (DBC if >=0x100) */ WORD cp /* Code page for the conversion */ ) { - const FLASH WCHAR *p; + const FLASH WCHAR* p; WCHAR c = 0; UINT i, n, li, hi; @@ -15468,14 +15464,14 @@ WCHAR ff_oem2uni ( /* Returns Unicode character, zero on error */ /*------------------------------------------------------------------------*/ -/* Unicode up-case conversion */ +/* Unicode Up-case Conversion */ /*------------------------------------------------------------------------*/ DWORD ff_wtoupper ( /* Returns up-converted code point */ DWORD uni /* Unicode code point to be up-converted */ ) { - const FLASH WORD *p; + const FLASH WORD* p; WORD uc, bc, nc, cmd; static const FLASH WORD cvt1[] = { /* Compressed up conversion table for U+0000 - U+0FFF */ /* Basic Latin */ @@ -15600,4 +15596,4 @@ DWORD ff_wtoupper ( /* Returns up-converted code point */ } -#endif /* #if FF_USE_LFN */ +#endif /* #if FF_USE_LFN != 0 */