<<< Date Index >>>     <<< Thread Index >>>

[patch] make IDNA code more readable



Trivial patch, to replace numerical constants by names.

diff -r 6fac57b97bf1 mutt_idna.c
--- a/mutt_idna.c       Thu Mar 19 10:36:04 2009 +0100
+++ b/mutt_idna.c       Thu Mar 19 12:57:42 2009 +0100
@@ -62,7 +62,7 @@ static int mutt_idna_to_local (const cha
     goto notrans;
 
   /* Is this the right function?  Interesting effects with some bad 
identifiers! */
-  if (idna_to_unicode_8z8z (in, out, 1) != IDNA_SUCCESS)
+  if (idna_to_unicode_8z8z (in, out, IDNA_ALLOW_UNASSIGNED) != IDNA_SUCCESS)
     goto notrans;
 
   /* we don't want charset-hook effects, so we set flags to 0 */
@@ -83,7 +83,7 @@ static int mutt_idna_to_local (const cha
     /* we don't want charset-hook effects, so we set flags to 0 */
     if (mutt_convert_string (&tmp, Charset, "utf-8", 0) == -1)
       irrev = 1;
-    if (!irrev && idna_to_ascii_8z (tmp, &t2, 1) != IDNA_SUCCESS)
+    if (!irrev && idna_to_ascii_8z (tmp, &t2, IDNA_ALLOW_UNASSIGNED) != 
IDNA_SUCCESS)
       irrev = 1;
     if (!irrev && ascii_strcasecmp (t2, in))
     {
@@ -122,7 +122,7 @@ static int mutt_local_to_idna (const cha
   /* we don't want charset-hook effects, so we set flags to 0 */
   if (mutt_convert_string (&tmp, Charset, "utf-8", 0) == -1)
     rv = -1;
-  if (!rv && idna_to_ascii_8z (tmp, out, 1) != IDNA_SUCCESS)
+  if (!rv && idna_to_ascii_8z (tmp, out, IDNA_ALLOW_UNASSIGNED) != 
IDNA_SUCCESS)
     rv = -2;
   
   FREE (&tmp);