Rizin
unix-like reverse engineering framework and cli tools
idna.h File Reference

Go to the source code of this file.

Functions

unsigned uv__utf8_decode1 (const char **p, const char *pe)
 
long uv__idna_toascii (const char *s, const char *se, char *d, char *de)
 

Function Documentation

◆ uv__idna_toascii()

long uv__idna_toascii ( const char *  s,
const char *  se,
char *  d,
char *  de 
)

Definition at line 250 of file idna.c.

250  {
251  const char* si;
252  const char* st;
253  unsigned c;
254  char* ds;
255  int rc;
256 
257  ds = d;
258 
259  for (si = s; si < se; /* empty */) {
260  st = si;
261  c = uv__utf8_decode1(&si, se);
262 
263  if (c != '.')
264  if (c != 0x3002) /* 。 */
265  if (c != 0xFF0E) /* . */
266  if (c != 0xFF61) /* 。 */
267  continue;
268 
269  rc = uv__idna_toascii_label(s, st, &d, de);
270 
271  if (rc < 0)
272  return rc;
273 
274  if (d < de)
275  *d++ = '.';
276 
277  s = si;
278  }
279 
280  if (s < se) {
281  rc = uv__idna_toascii_label(s, se, &d, de);
282 
283  if (rc < 0)
284  return rc;
285  }
286 
287  if (d < de)
288  *d++ = '\0';
289 
290  return d - ds; /* Number of bytes written. */
291 }
si
unsigned uv__utf8_decode1(const char **p, const char *pe)
Definition: idna.c:88
static int uv__idna_toascii_label(const char *s, const char *se, char **d, char *de)
Definition: idna.c:102
static RzSocket * s
Definition: rtr.c:28
#define d(i)
Definition: sha256.c:44
#define c(i)
Definition: sha256.c:43

References c, d, s, si, uv__idna_toascii_label(), and uv__utf8_decode1().

Referenced by uv_getaddrinfo().

◆ uv__utf8_decode1()

unsigned uv__utf8_decode1 ( const char **  p,
const char *  pe 
)

Definition at line 88 of file idna.c.

88  {
89  unsigned a;
90 
91  a = (unsigned char) *(*p)++;
92 
93  if (a < 128)
94  return a; /* ASCII, common case. */
95 
96  return uv__utf8_decode1_slow(p, pe, a);
97 }
static unsigned uv__utf8_decode1_slow(const char **p, const char *pe, unsigned a)
Definition: idna.c:24
void * p
Definition: libc.cpp:67
#define a(i)
Definition: sha256.c:41

References a, p, and uv__utf8_decode1_slow().

Referenced by uv__idna_toascii().