source/AccessorySDK/Support/utfconv.c
static uint16_t
ucs_to_sfm(uint16_t ucs_ch, int lastchar)
{
	/* The last character of filename cannot be a space or period. */
	if (lastchar) {
		if (ucs_ch == 0x20)
			return (0xf028);
		else if (ucs_ch == 0x2e)
			return (0xf029);
	}
	/* 0x01 - 0x1f is simple transformation. */
	if (ucs_ch <= 0x1f) {
		return ((uint16_t)(ucs_ch | 0xf000));
	} else /* 0x20 - 0x7f */ {
		uint16_t lsb;

		lsb = mac2sfm[ucs_ch - 0x0020];
		if (lsb != ucs_ch)
			return((uint16_t)(0xf000 | lsb)); 
	}
	return (ucs_ch);
}
/*
 * Encode illegal NTFS filename characters into SFM Private Unicode characters
 *
 * Assumes non-zero ASCII input.
 */
Encode illegal NTFS filename characters into SFM Private Unicode characters
Assumes non-zero ASCII input.
Encode illegal NTFS filename characters into SFM Private Unicode characters Assumes non - zero ASCII input .
static uint16_t
ucs_to_sfm(uint16_t ucs_ch, int lastchar)
{
	if (lastchar) {
		if (ucs_ch == 0x20)
			return (0xf028);
		else if (ucs_ch == 0x2e)
			return (0xf029);
	}
	if (ucs_ch <= 0x1f) {
		return ((uint16_t)(ucs_ch | 0xf000));
	} else  {
		uint16_t lsb;
		lsb = mac2sfm[ucs_ch - 0x0020];
		if (lsb != ucs_ch)
			return((uint16_t)(0xf000 | lsb)); 
	}
	return (ucs_ch);
}
static uint16_t ucs_to_sfm ( uint16_t ucs_ch , int lastchar ) { if ( lastchar ) { if ( ucs_ch == 0x20 ) return ( 0xf028 ) ; else if ( ucs_ch == 0x2e ) return ( 0xf029 ) ; } if ( ucs_ch <= 0x1f ) { return ( ( uint16_t ) ( ucs_ch | 0xf000 ) ) ; } else { uint16_t lsb ; lsb = mac2sfm [ ucs_ch - 0x0020 ] ; if ( lsb != ucs_ch ) return ( ( uint16_t ) ( 0xf000 | lsb ) ) ; } return ( ucs_ch ) ; }
Encode illegal NTFS filename characters into SFM Private Unicode characters
 Assumes non-zero ASCII input.
Encode illegal NTFS filename characters into SFM Private Unicode characters Assumes non - zero ASCII input .
/* The last character of filename cannot be a space or period. */ /* 0x01 - 0x1f is simple transformation. */ /* 0x20 - 0x7f */