ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

XSLTPUBFUN int XSLTCALL xsltGetUTF8Char ( const unsigned char utf,
int len 
)

xsltGetUTF8Char: : a sequence of UTF-8 encoded bytes : a pointer to len

Read one UTF8 Char from Function copied from libxml2 xmlGetUTF8Char() ... to discard ultimately and use the original API

Returns the char value or -1 in case of error and update with the number of bytes used

Definition at line 246 of file xsltutils.c.

                                                    {
    unsigned int c;

    if (utf == NULL)
    goto error;
    if (len == NULL)
    goto error;
    if (*len < 1)
    goto error;

    c = utf[0];
    if (c & 0x80) {
    if (*len < 2)
        goto error;
    if ((utf[1] & 0xc0) != 0x80)
        goto error;
    if ((c & 0xe0) == 0xe0) {
        if (*len < 3)
        goto error;
        if ((utf[2] & 0xc0) != 0x80)
        goto error;
        if ((c & 0xf0) == 0xf0) {
        if (*len < 4)
            goto error;
        if ((c & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80)
            goto error;
        *len = 4;
        /* 4-byte code */
        c = (utf[0] & 0x7) << 18;
        c |= (utf[1] & 0x3f) << 12;
        c |= (utf[2] & 0x3f) << 6;
        c |= utf[3] & 0x3f;
        } else {
          /* 3-byte code */
        *len = 3;
        c = (utf[0] & 0xf) << 12;
        c |= (utf[1] & 0x3f) << 6;
        c |= utf[2] & 0x3f;
        }
    } else {
      /* 2-byte code */
        *len = 2;
        c = (utf[0] & 0x1f) << 6;
        c |= utf[1] & 0x3f;
    }
    } else {
    /* 1-byte code */
    *len = 1;
    }
    return(c);

error:
    if (len != NULL)
    *len = 0;
    return(-1);
}

Generated on Sat May 26 2012 04:49:06 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.