fatfs/src/ff.c
FRESULT f_setcp (
	WORD cp		/* Value to be set as active code page */
)
{
	static const WORD       validcp[] = {  437,   720,   737,   771,   775,   850,   852,   857,   860,   861,   862,   863,   864,   865,   866,   869,   932,   936,   949,   950, 0};
	static const BYTE* const tables[] = {Ct437, Ct720, Ct737, Ct771, Ct775, Ct850, Ct852, Ct857, Ct860, Ct861, Ct862, Ct863, Ct864, Ct865, Ct866, Ct869, Dc932, Dc936, Dc949, Dc950, 0};
	UINT i;


	for (i = 0; validcp[i] != 0 && validcp[i] != cp; i++) ;	/* Find the code page */
	if (validcp[i] != cp) return FR_INVALID_PARAMETER;	/* Not found? */

	CodePage = cp;
	if (cp >= 900) {	/* DBCS */
		ExCvt = 0;
		DbcTbl = tables[i];
	} else {			/* SBCS */
		ExCvt = tables[i];
		DbcTbl = 0;
	}
	return FR_OK;
}
/*-----------------------------------------------------------------------*/
/* Set Active Codepage for the Path Name                                 */
/*-----------------------------------------------------------------------*/
Set Active Codepage for the Path Name
Set Active Codepage for the Path Name
FRESULT f_setcp (
	WORD cp		
)
{
	static const WORD       validcp[] = {  437,   720,   737,   771,   775,   850,   852,   857,   860,   861,   862,   863,   864,   865,   866,   869,   932,   936,   949,   950, 0};
	static const BYTE* const tables[] = {Ct437, Ct720, Ct737, Ct771, Ct775, Ct850, Ct852, Ct857, Ct860, Ct861, Ct862, Ct863, Ct864, Ct865, Ct866, Ct869, Dc932, Dc936, Dc949, Dc950, 0};
	UINT i;
	for (i = 0; validcp[i] != 0 && validcp[i] != cp; i++) ;	
	if (validcp[i] != cp) return FR_INVALID_PARAMETER;	
	CodePage = cp;
	if (cp >= 900) {	
		ExCvt = 0;
		DbcTbl = tables[i];
	} else {			
		ExCvt = tables[i];
		DbcTbl = 0;
	}
	return FR_OK;
}
FRESULT f_setcp ( WORD cp ) { static const WORD validcp [ ] = { 437 , 720 , 737 , 771 , 775 , 850 , 852 , 857 , 860 , 861 , 862 , 863 , 864 , 865 , 866 , 869 , 932 , 936 , 949 , 950 , 0 } ; static const BYTE * const tables [ ] = { Ct437 , Ct720 , Ct737 , Ct771 , Ct775 , Ct850 , Ct852 , Ct857 , Ct860 , Ct861 , Ct862 , Ct863 , Ct864 , Ct865 , Ct866 , Ct869 , Dc932 , Dc936 , Dc949 , Dc950 , 0 } ; UINT i ; for ( i = 0 ; validcp [ i ] != 0 && validcp [ i ] != cp ; i ++ ) ; if ( validcp [ i ] != cp ) return FR_INVALID_PARAMETER ; CodePage = cp ; if ( cp >= 900 ) { ExCvt = 0 ; DbcTbl = tables [ i ] ; } else { ExCvt = tables [ i ] ; DbcTbl = 0 ; } return FR_OK ; }
Set Active Codepage for the Path Name
Set Active Codepage for the Path Name
/* Value to be set as active code page */ /* Find the code page */ /* Not found? */ /* DBCS */ /* SBCS */