tizen 2.4 release
[framework/base/tizen-locale.git] / iconvdata / johab.c
index 58cb5bc..e52fc24 100644 (file)
@@ -1,5 +1,5 @@
 /* Mapping tables for JOHAB handling.
-   Copyright (C) 1998, 1999, 2000-2002, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1998-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jungshik Shin <jshin@pantheon.yale.edu>
    and Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -15,9 +15,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <dlfcn.h>
 #include <stdint.h>
@@ -93,7 +92,7 @@ static const int init_to_bit[19] =
 
 static const int mid_to_bit[21] =
 {
-          0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0,
+         0x0060, 0x0080, 0x00a0, 0x00c0, 0x00e0,
   0x0140, 0x0160, 0x0180, 0x01a0, 0x01c0, 0x1e0,
   0x0240, 0x0260, 0x0280, 0x02a0, 0x02c0, 0x02e0,
   0x0340, 0x0360, 0x0380, 0x03a0
@@ -132,7 +131,7 @@ static const uint16_t jamo_from_ucs_table[51] =
 };
 
 
-static inline uint32_t
+static uint32_t
 johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
 {
   if (idx <= 0xdefe)
@@ -151,6 +150,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
 #define MIN_NEEDED_FROM                1
 #define MAX_NEEDED_FROM                2
 #define MIN_NEEDED_TO          4
+#define ONE_DIRECTION          0
 
 
 /* First define the conversion function from JOHAB to UCS4.  */
@@ -193,7 +193,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
            uint32_t ch2;                                                     \
            uint_fast32_t idx;                                                \
                                                                              \
-           if (__builtin_expect (inptr + 1 >= inend, 0))                     \
+           if (__glibc_unlikely (inptr + 1 >= inend))                        \
              {                                                               \
                /* The second character is not available.  Store the          \
                   intermediate result.  */                                   \
@@ -203,7 +203,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
                                                                              \
            ch2 = inptr[1];                                                   \
            idx = ch * 256 + ch2;                                             \
-           if (__builtin_expect (ch <= 0xd3, 1))                             \
+           if (__glibc_likely (ch <= 0xd3))                                  \
              {                                                               \
                /* Hangul */                                                  \
                int_fast32_t i, m, f;                                         \
@@ -255,7 +255,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
                                                   + ch2 - (ch2 > 0x90        \
                                                            ? 0x43 : 0x31)];  \
                       else                                                   \
-                        ch = __ksc5601_hanja_to_ucs[(ch - 0xe0) *192         \
+                        ch = __ksc5601_hanja_to_ucs[(ch - 0xe0) *192         \
                                                     + ch2 -  (ch2 > 0x90     \
                                                               ?0x43 : 0x31)];\
                    */                                                        \
@@ -263,7 +263,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
              }                                                               \
          }                                                                   \
                                                                              \
-       if (__builtin_expect (ch == 0, 0))                                    \
+       if (__glibc_unlikely (ch == 0))                                       \
          {                                                                   \
            /* This is an illegal character.  */                              \
            STANDARD_FROM_LOOP_ERR_HANDLER (2);                               \
@@ -314,7 +314,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
       {                                                                              \
        if (ch >= 0xac00 && ch <= 0xd7a3)                                     \
          {                                                                   \
-           if (__builtin_expect (outptr + 2 > outend, 0))                    \
+           if (__glibc_unlikely (outptr + 2 > outend))                       \
              {                                                               \
                result = __GCONV_FULL_OUTPUT;                                 \
                break;                                                        \
@@ -335,7 +335,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
          {                                                                   \
            ch = jamo_from_ucs_table[ch - 0x3131];                            \
                                                                              \
-           if (__builtin_expect (outptr + 2 > outend, 0))                    \
+           if (__glibc_unlikely (outptr + 2 > outend))                       \
              {                                                               \
                result = __GCONV_FULL_OUTPUT;                                 \
                break;                                                        \
@@ -356,7 +356,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
                result = __GCONV_FULL_OUTPUT;                                 \
                break;                                                        \
              }                                                               \
-           if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0))        \
+           if (__glibc_unlikely (written == __UNKNOWN_10646_CHAR))           \
              {                                                               \
                STANDARD_TO_LOOP_ERR_HANDLER (4);                             \
              }                                                               \