|
|
@@ -0,0 +1,145 @@ |
|
|
diff -crB idn-0.0.2/ext/idna.c idn-0.0.2.patched/ext/idna.c |
|
|
*** idn-0.0.2/ext/idna.c 2005-09-26 02:23:45.000000000 +0200 |
|
|
--- idn-0.0.2.patched/ext/idna.c 2010-09-04 14:38:37.000000000 +0200 |
|
|
*************** |
|
|
*** 85,91 **** |
|
|
flags = 0x0000; |
|
|
} |
|
|
|
|
|
! rc = idna_to_ascii_8z(RSTRING(str)->ptr, &buf, flags); |
|
|
|
|
|
if (rc != IDNA_SUCCESS) { |
|
|
xfree(buf); |
|
|
--- 85,91 ---- |
|
|
flags = 0x0000; |
|
|
} |
|
|
|
|
|
! rc = idna_to_ascii_8z(RSTRING_PTR(str), &buf, flags); |
|
|
|
|
|
if (rc != IDNA_SUCCESS) { |
|
|
xfree(buf); |
|
|
*************** |
|
|
*** 125,131 **** |
|
|
flags = 0x0000; |
|
|
} |
|
|
|
|
|
! rc = idna_to_unicode_8z8z(RSTRING(str)->ptr, &buf, flags); |
|
|
|
|
|
if (rc != IDNA_SUCCESS) { |
|
|
xfree(buf); |
|
|
--- 125,131 ---- |
|
|
flags = 0x0000; |
|
|
} |
|
|
|
|
|
! rc = idna_to_unicode_8z8z(RSTRING_PTR(str), &buf, flags); |
|
|
|
|
|
if (rc != IDNA_SUCCESS) { |
|
|
xfree(buf); |
|
|
diff -crB idn-0.0.2/ext/punycode.c idn-0.0.2.patched/ext/punycode.c |
|
|
*** idn-0.0.2/ext/punycode.c 2005-09-26 02:23:45.000000000 +0200 |
|
|
--- idn-0.0.2.patched/ext/punycode.c 2010-09-04 14:12:04.000000000 +0200 |
|
|
*************** |
|
|
*** 66,72 **** |
|
|
VALUE retv; |
|
|
|
|
|
str = rb_check_convert_type(str, T_STRING, "String", "to_s"); |
|
|
! ustr = stringprep_utf8_to_ucs4(RSTRING(str)->ptr, RSTRING(str)->len, &len); |
|
|
|
|
|
while (1) { |
|
|
buf = realloc(buf, buflen); |
|
|
--- 66,72 ---- |
|
|
VALUE retv; |
|
|
|
|
|
str = rb_check_convert_type(str, T_STRING, "String", "to_s"); |
|
|
! ustr = stringprep_utf8_to_ucs4(RSTRING_PTR(str), RSTRING_LEN(str), &len); |
|
|
|
|
|
while (1) { |
|
|
buf = realloc(buf, buflen); |
|
|
*************** |
|
|
*** 116,122 **** |
|
|
|
|
|
str = rb_check_convert_type(str, T_STRING, "String", "to_s"); |
|
|
|
|
|
! len = RSTRING(str)->len; |
|
|
ustr = malloc(len * sizeof(punycode_uint)); |
|
|
|
|
|
if (ustr == NULL) { |
|
|
--- 116,122 ---- |
|
|
|
|
|
str = rb_check_convert_type(str, T_STRING, "String", "to_s"); |
|
|
|
|
|
! len = RSTRING_LEN(str); |
|
|
ustr = malloc(len * sizeof(punycode_uint)); |
|
|
|
|
|
if (ustr == NULL) { |
|
|
*************** |
|
|
*** 124,130 **** |
|
|
return Qnil; |
|
|
} |
|
|
|
|
|
! rc = punycode_decode(RSTRING(str)->len, RSTRING(str)->ptr, |
|
|
&len, ustr, NULL); |
|
|
|
|
|
if (rc != PUNYCODE_SUCCESS) { |
|
|
--- 124,130 ---- |
|
|
return Qnil; |
|
|
} |
|
|
|
|
|
! rc = punycode_decode(RSTRING_LEN(str), RSTRING_PTR(str), |
|
|
&len, ustr, NULL); |
|
|
|
|
|
if (rc != PUNYCODE_SUCCESS) { |
|
|
diff -crB idn-0.0.2/ext/stringprep.c idn-0.0.2.patched/ext/stringprep.c |
|
|
*** idn-0.0.2/ext/stringprep.c 2006-02-11 16:46:43.000000000 +0100 |
|
|
--- idn-0.0.2.patched/ext/stringprep.c 2010-09-04 14:16:37.000000000 +0200 |
|
|
*************** |
|
|
*** 64,70 **** |
|
|
VALUE retv; |
|
|
|
|
|
str = rb_check_convert_type(str, T_STRING, "String", "to_s"); |
|
|
! rc = stringprep_profile(RSTRING(str)->ptr, &buf, profile, 0); |
|
|
|
|
|
if (rc != STRINGPREP_OK) { |
|
|
rb_raise(eStringprepError, "%s (%d)", stringprep_strerror(rc), rc); |
|
|
--- 64,70 ---- |
|
|
VALUE retv; |
|
|
|
|
|
str = rb_check_convert_type(str, T_STRING, "String", "to_s"); |
|
|
! rc = stringprep_profile(RSTRING_PTR(str), &buf, profile, 0); |
|
|
|
|
|
if (rc != STRINGPREP_OK) { |
|
|
rb_raise(eStringprepError, "%s (%d)", stringprep_strerror(rc), rc); |
|
|
*************** |
|
|
*** 135,141 **** |
|
|
static VALUE with_profile(VALUE self, VALUE str, VALUE profile) |
|
|
{ |
|
|
profile = rb_check_convert_type(profile, T_STRING, "String", "to_s"); |
|
|
! return stringprep_internal(str, RSTRING(profile)->ptr); |
|
|
} |
|
|
|
|
|
/* |
|
|
--- 135,141 ---- |
|
|
static VALUE with_profile(VALUE self, VALUE str, VALUE profile) |
|
|
{ |
|
|
profile = rb_check_convert_type(profile, T_STRING, "String", "to_s"); |
|
|
! return stringprep_internal(str, RSTRING_PTR(profile)); |
|
|
} |
|
|
|
|
|
/* |
|
|
*************** |
|
|
*** 153,159 **** |
|
|
VALUE retv; |
|
|
|
|
|
str = rb_check_convert_type(str, T_STRING, "String", "to_s"); |
|
|
! buf = stringprep_utf8_nfkc_normalize(RSTRING(str)->ptr, RSTRING(str)->len); |
|
|
|
|
|
retv = rb_str_new2(buf); |
|
|
xfree(buf); |
|
|
--- 153,159 ---- |
|
|
VALUE retv; |
|
|
|
|
|
str = rb_check_convert_type(str, T_STRING, "String", "to_s"); |
|
|
! buf = stringprep_utf8_nfkc_normalize(RSTRING_PTR(str), RSTRING_LEN(str)); |
|
|
|
|
|
retv = rb_str_new2(buf); |
|
|
xfree(buf); |