X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Funistr%2Fu16-mbtouc-unsafe.c;h=b393397afa13f1634364cd7fe4e5518587774593;hb=ce38c27828c6a3286e99e312d50fe140a1ec334b;hp=2a6a06c934e32680644e719627c52cbb0ec8871a;hpb=ac5cf7982cea8a4bb17680b6b9925f301cfa4220;p=gnulib.git diff --git a/lib/unistr/u16-mbtouc-unsafe.c b/lib/unistr/u16-mbtouc-unsafe.c index 2a6a06c93..b393397af 100644 --- a/lib/unistr/u16-mbtouc-unsafe.c +++ b/lib/unistr/u16-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify it @@ -17,6 +17,12 @@ #include +#if defined IN_LIBUNISTRING +/* Tell unistr.h to declare u16_mbtouc_unsafe as 'extern', not + 'static inline'. */ +# include "unistring-notinline.h" +#endif + /* Specification. */ #include "unistr.h" @@ -37,20 +43,20 @@ u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n) #endif { if (n >= 2) - { + { #if CONFIG_UNICODE_SAFETY - if (s[1] >= 0xdc00 && s[1] < 0xe000) + if (s[1] >= 0xdc00 && s[1] < 0xe000) #endif - { - *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); - return 2; - } - /* invalid multibyte character */ - } + { + *puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); + return 2; + } + /* invalid multibyte character */ + } else - { - /* incomplete multibyte character */ - } + { + /* incomplete multibyte character */ + } } /* invalid multibyte character */ *puc = 0xfffd;