ReactOS  0.4.14-dev-342-gdc047f9
icy2utf8.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

charicy2utf8 (const char *, int)
 

Function Documentation

◆ icy2utf8()

char* icy2utf8 ( const char ,
int   
)

Definition at line 378 of file icy2utf8.c.

379 {
380  const uint8_t *s = (const uint8_t *)src;
381  size_t srclen, dstlen, i, k;
382  uint8_t ch, *d;
383  char *dst;
384 
385  /* Some funny streams from Apple/iTunes give ICY info in UTF-8 already.
386  So, be prepared and don't try to re-encode such. Unless forced. */
387  if(!force && is_utf8(src)) return (compat_strdup(src));
388 
389  srclen = strlen(src) + 1;
390  /* allocate conservatively */
391  if ((d = malloc(srclen * 3)) == NULL)
392  return (NULL);
393 
394  i = 0;
395  dstlen = 0;
396  while (i < srclen) {
397  ch = s[i++];
398  k = tblofs[ch];
399  while (k < tblofs[ch + 1])
400  d[dstlen++] = cp1252_utf8[k++];
401  }
402 
403  /* dstlen includes trailing NUL since srclen also does */
404  if ((dst = realloc(d, dstlen)) == NULL) {
405  free(d);
406  return (NULL);
407  }
408  return (dst);
409 }
#define realloc
Definition: debug_ros.c:6
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define free
Definition: debug_ros.c:5
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define d
Definition: ke_i.h:81
static const uint8_t cp1252_utf8[]
Definition: icy2utf8.c:39
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
BYTE uint8_t
Definition: msvideo1.c:66
static int is_utf8(const char *src)
Definition: icy2utf8.c:336
#define compat_strdup
Definition: intsym.h:11
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340
#define malloc
Definition: debug_ros.c:4
static const uint16_t tblofs[257]
Definition: icy2utf8.c:298
int k
Definition: mpi.c:3369