diff options
author | pfg <pfg@FreeBSD.org> | 2014-01-05 00:32:38 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-01-05 00:32:38 +0000 |
commit | c5e9a8143da358a2c480a64c9782d5eedda3b002 (patch) | |
tree | 41352df67b0bde40419570461e43784752e49325 /contrib/gcclibs/libcpp/charset.c | |
parent | 8da5238e28e25a3d2976ca05168766d942eaf703 (diff) | |
download | FreeBSD-src-c5e9a8143da358a2c480a64c9782d5eedda3b002.zip FreeBSD-src-c5e9a8143da358a2c480a64c9782d5eedda3b002.tar.gz |
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
MFC after: 1 week
Diffstat (limited to 'contrib/gcclibs/libcpp/charset.c')
-rw-r--r-- | contrib/gcclibs/libcpp/charset.c | 11 |
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; |