X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funistr%2Fu16-uctomb-aux.c;h=9ec1e7bcae08b9c56451c95d3416382a2e9e53ad;hb=368777cd04f76f7a3b242006fdf6c1e6b77381de;hp=7ea56a18baa156b34dedac2750c49f2862f2ce36;hpb=6b78d03bdd89f7c8dec8756bf296b75b156b90f3;p=gnulib.git diff --git a/lib/unistr/u16-uctomb-aux.c b/lib/unistr/u16-uctomb-aux.c index 7ea56a18b..9ec1e7bca 100644 --- a/lib/unistr/u16-uctomb-aux.c +++ b/lib/unistr/u16-uctomb-aux.c @@ -1,21 +1,19 @@ /* Conversion UCS-4 to UTF-16. - Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2002. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. */ + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #include @@ -32,29 +30,29 @@ u16_uctomb_aux (uint16_t *s, ucs4_t uc, int n) else if (uc < 0x10000) { if (uc >= 0xe000) - { - if (n >= 1) - { - s[0] = uc; - return 1; - } - } + { + if (n >= 1) + { + s[0] = uc; + return 1; + } + } else - return -1; + return -1; } else { if (uc < 0x110000) - { - if (n >= 2) - { - s[0] = 0xd800 + ((uc - 0x10000) >> 10); - s[1] = 0xdc00 + ((uc - 0x10000) & 0x3ff); - return 2; - } - } + { + if (n >= 2) + { + s[0] = 0xd800 + ((uc - 0x10000) >> 10); + s[1] = 0xdc00 + ((uc - 0x10000) & 0x3ff); + return 2; + } + } else - return -1; + return -1; } return -2; }