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

char* icy2utf8 ( const char ,
int   
)

Definition at line 376 of file icy2utf8.c.

Referenced by mpg123_icy2utf8(), and mpg123_store_utf8().

{
    const uint8_t *s = (const uint8_t *)src;
    size_t srclen, dstlen, i, k;
    uint8_t ch, *d;
    char *dst;

    /* Some funny streams from Apple/iTunes give ICY info in UTF-8 already.
       So, be prepared and don't try to re-encode such. Unless forced. */
    if(!force && is_utf8(src)) return (strdup(src));

    srclen = strlen(src) + 1;
    /* allocate conservatively */
    if ((d = malloc(srclen * 3)) == NULL)
        return (NULL);

    i = 0;
    dstlen = 0;
    while (i < srclen) {
        ch = s[i++];
        k = tblofs[ch];
        while (k < tblofs[ch + 1])
            d[dstlen++] = cp1252_utf8[k++];
    }

    /* dstlen includes trailing NUL since srclen also does */
    if ((dst = realloc(d, dstlen)) == NULL) {
        free(d);
        return (NULL);
    }
    return (dst);
}

Generated on Fri May 25 2012 05:54:51 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.