Back to index

glibc  2.9
Classes | Defines | Enumerations | Functions
utf-32.c File Reference
#include <byteswap.h>
#include <dlfcn.h>
#include <gconv.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <iconv/loop.c>
#include <iconv/skeleton.c>

Go to the source code of this file.

Classes

struct  utf32_data

Defines

#define BOM   0x0000feffu
#define BOM_OE   0xfffe0000u
#define FROM_LOOP   from_utf32_loop
#define TO_LOOP   to_utf32_loop
#define DEFINE_INIT   0
#define DEFINE_FINI   0
#define MIN_NEEDED_FROM   4
#define MIN_NEEDED_TO   4
#define FROM_DIRECTION   (dir == from_utf32)
#define PREPARE_LOOP
#define EXTRA_LOOP_ARGS   , var, swap
#define MIN_NEEDED_INPUT   MIN_NEEDED_TO
#define MIN_NEEDED_OUTPUT   MIN_NEEDED_FROM
#define LOOPFCT   TO_LOOP
#define BODY
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS   , enum variant var, int swap
#define MIN_NEEDED_INPUT   MIN_NEEDED_FROM
#define MIN_NEEDED_OUTPUT   MIN_NEEDED_TO
#define LOOPFCT   FROM_LOOP
#define BODY
#define LOOP_NEED_FLAGS
#define EXTRA_LOOP_DECLS   , enum variant var, int swap

Enumerations

enum  direction {
  illegal_dir, to_iso2022jp, from_iso2022jp, illegal_dir,
  to_iso646, from_iso646, illegal_dir, to_unicode,
  from_unicode, illegal_dir, to_utf16, from_utf16,
  illegal_dir, to_utf32, from_utf32
}
enum  variant {
  illegal_var, iso2022jp, iso2022jp2, illegal_var,
  GB, CA, CA2, DE,
  DK, ES, ES2, CN,
  IT, JP, JP_OCR_B, YU,
  KR, HU, CU, FR,
  FR1, NO, NO2, PT,
  PT2, SE, SE2, illegal_var,
  UTF_16, UTF_16LE, UTF_16BE, illegal_var,
  UTF_32, UTF_32LE, UTF_32BE
}

Functions

int gconv_init (struct __gconv_step *step)
void gconv_end (struct __gconv_step *data)

Class Documentation

struct utf32_data

Definition at line 95 of file utf-32.c.


Define Documentation

#define BODY
Value:
{                                                                    \
    uint32_t c = get32 (inptr);                                             \
                                                                     \
    if (__builtin_expect (c >= 0x110000, 0))                                \
      {                                                                     \
       STANDARD_TO_LOOP_ERR_HANDLER (4);                             \
      }                                                                     \
    else if (__builtin_expect (c >= 0xd800 && c < 0xe000, 0))               \
      {                                                                     \
       /* Surrogate characters in UCS-4 input are not valid.                \
          We must catch this.  If we let surrogates pass through,           \
          attackers could make a security hole exploit by                   \
          generating "irregular UTF-32" sequences.  */                      \
       result = __GCONV_ILLEGAL_INPUT;                                      \
       if (! ignore_errors_p ())                                     \
         break;                                                      \
       inptr += 4;                                                   \
       ++*irreversible;                                              \
       continue;                                                     \
      }                                                                     \
                                                                     \
    if (swap)                                                        \
      put32 (outptr, bswap_32 (c));                                         \
    else								      \
      put32 (outptr, c);                                             \
                                                                     \
    outptr += 4;                                                     \
    inptr += 4;                                                             \
  }

Definition at line 233 of file utf-32.c.

#define BODY
Value:
{                                                                    \
    uint32_t u1 = get32 (inptr);                                     \
                                                                     \
    if (swap)                                                        \
      u1 = bswap_32 (u1);                                            \
                                                                     \
    if (__builtin_expect (u1 >= 0x110000, 0))                               \
      {                                                                     \
       /* This is illegal.  */                                              \
       STANDARD_FROM_LOOP_ERR_HANDLER (4);                                  \
      }                                                                     \
									      \
    put32 (outptr, u1);                                                     \
    inptr += 4;                                                             \
    outptr += 4;                                                     \
  }

Definition at line 233 of file utf-32.c.

#define BOM   0x0000feffu

Definition at line 29 of file utf-32.c.

#define BOM_OE   0xfffe0000u

Definition at line 31 of file utf-32.c.

#define DEFINE_FINI   0

Definition at line 38 of file utf-32.c.

#define DEFINE_INIT   0

Definition at line 37 of file utf-32.c.

#define EXTRA_LOOP_ARGS   , var, swap

Definition at line 76 of file utf-32.c.

#define EXTRA_LOOP_DECLS   , enum variant var, int swap

Definition at line 251 of file utf-32.c.

#define EXTRA_LOOP_DECLS   , enum variant var, int swap

Definition at line 251 of file utf-32.c.

#define FROM_DIRECTION   (dir == from_utf32)

Definition at line 41 of file utf-32.c.

#define FROM_LOOP   from_utf32_loop

Definition at line 35 of file utf-32.c.

#define LOOP_NEED_FLAGS

Definition at line 250 of file utf-32.c.

#define LOOP_NEED_FLAGS

Definition at line 250 of file utf-32.c.

#define LOOPFCT   TO_LOOP

Definition at line 232 of file utf-32.c.

#define LOOPFCT   FROM_LOOP

Definition at line 232 of file utf-32.c.

#define MIN_NEEDED_FROM   4

Definition at line 39 of file utf-32.c.

Definition at line 230 of file utf-32.c.

Definition at line 230 of file utf-32.c.

Definition at line 231 of file utf-32.c.

Definition at line 231 of file utf-32.c.

#define MIN_NEEDED_TO   4

Definition at line 40 of file utf-32.c.

#define PREPARE_LOOP

Definition at line 42 of file utf-32.c.

#define TO_LOOP   to_utf32_loop

Definition at line 36 of file utf-32.c.


Enumeration Type Documentation

enum direction
Enumerator:
illegal_dir 
to_iso2022jp 
from_iso2022jp 
illegal_dir 
to_iso646 
from_iso646 
illegal_dir 
to_unicode 
from_unicode 
illegal_dir 
to_utf16 
from_utf16 
illegal_dir 
to_utf32 
from_utf32 

Definition at line 80 of file utf-32.c.

enum variant
Enumerator:
illegal_var 
iso2022jp 
iso2022jp2 
illegal_var 
GB 
CA 
CA2 
DE 
DK 
ES 
ES2 
CN 
IT 
JP 
JP_OCR_B 
YU 
KR 
HU 
CU 
FR 
FR1 
NO 
NO2 
PT 
PT2 
SE 
SE2 
illegal_var 
UTF_16 
UTF_16LE 
UTF_16BE 
illegal_var 
UTF_32 
UTF_32LE 
UTF_32BE 

Definition at line 87 of file utf-32.c.


Function Documentation

void gconv_end ( struct __gconv_step data)
int gconv_init ( struct __gconv_step step)