2 * Copyright (c) 2000-2015 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * Copyright (c) 1997-2000 Apple Inc. All Rights Reserved
32 #ifndef _HFS_ENCODINGS_H_
33 #define _HFS_ENCODINGS_H_
37 #include <sys/appleapiopts.h>
39 #ifdef __APPLE_API_UNSTABLE
41 #define CTL_HFS_NAMES { \
43 { "encodingbias", CTLTYPE_INT }, \
49 * HFS Filename Encoding Converters Interface
51 * Private Interface for adding hfs filename
52 * encoding converters. These are not needed
53 * for HFS Plus volumes (since they already
54 * have Unicode filenames).
56 * Used by HFS Encoding Converter Kernel Modules
57 * to register their encoding conversion routines.
60 typedef int (* hfs_to_unicode_func_t
)(const uint8_t hfs_str
[32], uint16_t *uni_str
,
61 u_int32_t maxCharLen
, u_int32_t
*usedCharLen
);
63 typedef int (* unicode_to_hfs_func_t
)(uint16_t *uni_str
, u_int32_t unicodeChars
,
66 int hfs_relconverter (u_int32_t encoding
);
67 int hfs_getconverter(u_int32_t encoding
, hfs_to_unicode_func_t
*get_unicode
,
68 unicode_to_hfs_func_t
*get_hfsname
);
69 int hfs_addconverter(int kmod_id
, u_int32_t encoding
,
70 hfs_to_unicode_func_t get_unicode
,
71 unicode_to_hfs_func_t get_hfsname
);
72 int hfs_remconverter(int kmod_id
, u_int32_t encoding
);
74 u_int32_t
hfs_pickencoding(const u_int16_t
*src
, int len
);
75 u_int32_t
hfs_getencodingbias(void);
76 void hfs_setencodingbias(u_int32_t bias
);
77 int mac_roman_to_utf8(const uint8_t hfs_str
[32], uint32_t maxDstLen
, uint32_t *actualDstLen
,
78 unsigned char* dstStr
);
79 int utf8_to_mac_roman(uint32_t srcLen
, const unsigned char* srcStr
, uint8_t dstStr
[32]);
80 int mac_roman_to_unicode(const uint8_t hfs_str
[32], uint16_t *uni_str
, u_int32_t maxCharLen
, u_int32_t
*usedCharLen
);
81 int unicode_to_mac_roman(uint16_t *uni_str
, u_int32_t unicodeChars
, uint8_t hfs_str
[32]);
85 #endif /* __APPLE_API_UNSTABLE */
87 #endif // !TARGET_OS_IPHONE
89 #endif /* ! _HFS_ENCODINGS_H_ */