summaryrefslogtreecommitdiffstats
path: root/contrib/gcclibs/libcpp/charset.c
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-01-12 21:16:26 +0000
committerpfg <pfg@FreeBSD.org>2014-01-12 21:16:26 +0000
commitf630f6f40f740cb8f2ee6f8b7ca4b87afe4549ed (patch)
tree1583542d675d7245df1abbe37fe4624d8013d8b1 /contrib/gcclibs/libcpp/charset.c
parentd54137712a89d020593dfb73ef2e0814051f5387 (diff)
downloadFreeBSD-src-f630f6f40f740cb8f2ee6f8b7ca4b87afe4549ed.zip
FreeBSD-src-f630f6f40f740cb8f2ee6f8b7ca4b87afe4549ed.tar.gz
MFC r260310:
libcpp: misc fixes from Apple's GCC. Fixes some bugs detected by Apple: #error with unmatched quotes pragma mark Obtained from: Apple GCC 4.2 - 5553
Diffstat (limited to 'contrib/gcclibs/libcpp/charset.c')
-rw-r--r--contrib/gcclibs/libcpp/charset.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/contrib/gcclibs/libcpp/charset.c b/contrib/gcclibs/libcpp/charset.c
index 009106b..079bacc 100644
--- a/contrib/gcclibs/libcpp/charset.c
+++ b/contrib/gcclibs/libcpp/charset.c
@@ -1597,6 +1597,17 @@ _cpp_convert_input (cpp_reader *pfile, const char *input_charset,
input_cset = init_iconv_desc (pfile, SOURCE_CHARSET, input_charset);
if (input_cset.func == convert_no_conversion)
{
+ /* APPLE LOCAL begin UTF-8 BOM 5774975 */
+ /* Eat the UTF-8 BOM. */
+ if (len >= 3
+ && input[0] == 0xef
+ && input[1] == 0xbb
+ && input[2] == 0xbf)
+ {
+ memmove (&input[0], &input[3], size-3);
+ len -= 3;
+ }
+ /* APPLE LOCAL end UTF-8 BOM 5774975 */
to.text = input;
to.asize = size;
to.len = len;
OpenPOWER on IntegriCloud