-
-
Save chopachom/860495 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Retreive the patch file and name it idn.patch | |
| $ wget http://rubyforge.org/frs/download.php/8555/idn-0.0.2.tar.gz | |
| $ tar -zxvf idn-0.0.2.tar.gz | |
| x idn-0.0.2/ | |
| x idn-0.0.2/README | |
| x idn-0.0.2/CHANGES | |
| x idn-0.0.2/LICENSE | |
| x idn-0.0.2/NOTICE | |
| x idn-0.0.2/Rakefile | |
| x idn-0.0.2/ext/ | |
| x idn-0.0.2/ext/idn.c | |
| x idn-0.0.2/ext/idna.c | |
| x idn-0.0.2/ext/punycode.c | |
| x idn-0.0.2/ext/stringprep.c | |
| x idn-0.0.2/ext/idn.h | |
| x idn-0.0.2/ext/extconf.rb | |
| x idn-0.0.2/test/ | |
| x idn-0.0.2/test/tc_Idna.rb | |
| x idn-0.0.2/test/tc_Punycode.rb | |
| x idn-0.0.2/test/tc_Stringprep.rb | |
| x idn-0.0.2/test/ts_IDN.rb | |
| $ cd idn-0.0.2 | |
| $ patch -p1 -i ../idn.patch | |
| patching file ext/idna.c | |
| patching file ext/punycode.c | |
| patching file ext/stringprep.c | |
| $ rake install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment