Received: by mail.netbsd.org (Postfix, from userid 605) id 2802F84DA2; Sun, 14 Feb 2021 14:59:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 604F484D9B for ; Sun, 14 Feb 2021 14:59:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id Eh0YOZGcqPV0 for ; Sun, 14 Feb 2021 14:59:38 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 9DD0C84CED for ; Sun, 14 Feb 2021 14:59:38 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 95319FA95; Sun, 14 Feb 2021 14:59:38 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_161331477870300" MIME-Version: 1.0 Date: Sun, 14 Feb 2021 14:59:38 +0000 From: "Takahiro Kambe" Subject: CVS commit: pkgsrc/graphics/ruby-gd To: pkgsrc-changes@NetBSD.org Reply-To: taca@netbsd.org X-Mailer: log_accum Message-Id: <20210214145938.95319FA95@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_161331477870300 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: taca Date: Sun Feb 14 14:59:38 UTC 2021 Modified Files: pkgsrc/graphics/ruby-gd: distinfo pkgsrc/graphics/ruby-gd/patches: patch-aa Log Message: graphics/ruby-gd: fix build problem with Ruby 3.0 Use more modern Ruby API. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 pkgsrc/graphics/ruby-gd/distinfo cvs rdiff -u -r1.2 -r1.3 pkgsrc/graphics/ruby-gd/patches/patch-aa Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_161331477870300 Content-Disposition: inline Content-Length: 25118 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/graphics/ruby-gd/distinfo diff -u pkgsrc/graphics/ruby-gd/distinfo:1.8 pkgsrc/graphics/ruby-gd/distinfo:1.9 --- pkgsrc/graphics/ruby-gd/distinfo:1.8 Tue Nov 3 21:34:19 2015 +++ pkgsrc/graphics/ruby-gd/distinfo Sun Feb 14 14:59:38 2021 @@ -1,7 +1,7 @@ -$NetBSD: distinfo,v 1.8 2015/11/03 21:34:19 agc Exp $ +$NetBSD: distinfo,v 1.9 2021/02/14 14:59:38 taca Exp $ SHA1 (ruby-gd-0.8.0.gem) = a38a2eaa786afd1ad1fe56961ff7168e8fab7996 RMD160 (ruby-gd-0.8.0.gem) = 73369970a3ae17feda1b428c19e0bc8bb52d05dc SHA512 (ruby-gd-0.8.0.gem) = c108ab54a88e52599bcb8189230db0c7291297f5361e7ac55d3eaf82e3ab1330b06421bb87e206eec5e3ef21464d525f738481775dab5e17f12570a78b0b00c0 Size (ruby-gd-0.8.0.gem) = 41984 bytes -SHA1 (patch-aa) = eb761593b7fbbe04df46eac8e868f6f4d301345f +SHA1 (patch-aa) = b6d022408ee70de53fb5aad87b6cbc673978e840 Index: pkgsrc/graphics/ruby-gd/patches/patch-aa diff -u pkgsrc/graphics/ruby-gd/patches/patch-aa:1.2 pkgsrc/graphics/ruby-gd/patches/patch-aa:1.3 --- pkgsrc/graphics/ruby-gd/patches/patch-aa:1.2 Mon Mar 17 14:12:10 2014 +++ pkgsrc/graphics/ruby-gd/patches/patch-aa Sun Feb 14 14:59:38 2021 @@ -1,34 +1,22 @@ -$NetBSD: patch-aa,v 1.2 2014/03/17 14:12:10 taca Exp $ +$NetBSD: patch-aa,v 1.3 2021/02/14 14:59:38 taca Exp $ -Support both Ruby 1.8 and Ruby 1.9. +Support modern Ruby API. ---- GD.c.orig 2014-03-11 11:19:58.000000000 +0000 +--- GD.c.orig 2021-01-11 07:41:51.880067934 +0000 +++ GD.c -@@ -11,7 +11,23 @@ +@@ -11,6 +11,9 @@ **************************************************************/ #include "ruby.h" -+#ifdef HAVE_RUBY_IO_H /* Ruby 1.9 and later */ -+ +-#include "rubyio.h" +-#include "version.h" +#include "ruby/io.h" +#include "ruby/version.h" + +#define RB_IO_PATH(iot) (RSTRING_PTR((iot)->pathv)) +#define RB_IO_FILE(iot) rb_io_stdio_file((iot)) -+ -+#else /* Ruby 1.8.x */ -+ - #include "rubyio.h" - #include "version.h" -+#define rb_io_stdio_file(iot) ((iot)->f) -+#define RB_IO_PATH(iot) ((iot)->path) -+#define RB_IO_FILE(iot) (((iot)->f2)? (iot)->f2: (iot)->f) -+ -+#endif -+ #include "gd.h" - #include "gdfontg.h" /* giant */ -@@ -63,17 +79,17 @@ img_from_pngfname(klass, fname) +@@ -63,17 +66,17 @@ img_from_pngfname(klass, fname) { VALUE f; - OpenFile *fptr; @@ -50,14 +38,14 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid PNG File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -85,5 +101,5 @@ img_from_png(klass, f) +@@ -85,5 +88,5 @@ img_from_png(klass, f) VALUE klass, f; { - OpenFile *fptr; + rb_io_t *fptr; gdImagePtr iptr; -@@ -93,7 +109,7 @@ img_from_png(klass, f) +@@ -93,7 +96,7 @@ img_from_png(klass, f) rb_io_check_readable(fptr); - iptr = gdImageCreateFromPng(fptr->f); @@ -67,7 +55,7 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid PNG File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -106,17 +122,17 @@ img_from_giffname(klass, fname) +@@ -106,17 +109,17 @@ img_from_giffname(klass, fname) { VALUE f; - OpenFile *fptr; @@ -89,14 +77,14 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid GIF File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -127,5 +143,5 @@ img_from_gif(klass, f) +@@ -127,5 +130,5 @@ img_from_gif(klass, f) VALUE klass, f; { - OpenFile *fptr; + rb_io_t *fptr; gdImagePtr iptr; -@@ -135,7 +151,7 @@ img_from_gif(klass, f) +@@ -135,7 +138,7 @@ img_from_gif(klass, f) rb_io_check_readable(fptr); - iptr = gdImageCreateFromGif(fptr->f); @@ -106,7 +94,7 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid GIF File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -148,17 +164,17 @@ img_from_gdfname(klass, fname) +@@ -148,17 +151,17 @@ img_from_gdfname(klass, fname) { VALUE f; - OpenFile *fptr; @@ -128,14 +116,14 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid Gd File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -169,5 +185,5 @@ img_from_gd(klass, f) +@@ -169,5 +172,5 @@ img_from_gd(klass, f) VALUE klass, f; { - OpenFile *fptr; + rb_io_t *fptr; gdImagePtr iptr; -@@ -177,7 +193,7 @@ img_from_gd(klass, f) +@@ -177,7 +180,7 @@ img_from_gd(klass, f) rb_io_check_readable(fptr); - iptr = gdImageCreateFromGd(fptr->f); @@ -145,7 +133,7 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid Gd File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); } -@@ -188,17 +204,17 @@ img_from_gd2fname(klass, fname) +@@ -188,17 +191,17 @@ img_from_gd2fname(klass, fname) { VALUE f; - OpenFile *fptr; @@ -167,14 +155,14 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid Gd2 File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -209,5 +225,5 @@ img_from_gd2(klass, f) +@@ -209,5 +212,5 @@ img_from_gd2(klass, f) VALUE klass, f; { - OpenFile *fptr; + rb_io_t *fptr; gdImagePtr iptr; -@@ -217,7 +233,7 @@ img_from_gd2(klass, f) +@@ -217,7 +220,7 @@ img_from_gd2(klass, f) rb_io_check_readable(fptr); - iptr = gdImageCreateFromGd2(fptr->f); @@ -184,7 +172,7 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid Gd2 File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -229,18 +245,18 @@ img_from_gd2_partfname(klass, fname, src +@@ -229,18 +232,18 @@ img_from_gd2_partfname(klass, fname, src { VALUE f; - OpenFile *fptr; @@ -207,14 +195,14 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid Gd2 File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -251,5 +267,5 @@ img_from_gd2_part(klass, f, srcx, srcy, +@@ -251,5 +254,5 @@ img_from_gd2_part(klass, f, srcx, srcy, VALUE klass, f, srcx, srcy, w, h; { - OpenFile *fptr; + rb_io_t *fptr; gdImagePtr iptr; -@@ -259,8 +275,8 @@ img_from_gd2_part(klass, f, srcx, srcy, +@@ -259,8 +262,8 @@ img_from_gd2_part(klass, f, srcx, srcy, rb_io_check_readable(fptr); - iptr = gdImageCreateFromGd2Part(fptr->f, NUM2INT(srcx), @@ -225,14 +213,14 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid Gd2 File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -272,5 +288,5 @@ img_from_xbm(klass, f) +@@ -272,5 +275,5 @@ img_from_xbm(klass, f) VALUE klass, f; { - OpenFile *fptr; + rb_io_t *fptr; gdImagePtr iptr; -@@ -280,7 +296,7 @@ img_from_xbm(klass, f) +@@ -280,7 +283,7 @@ img_from_xbm(klass, f) rb_io_check_readable(fptr); - iptr = gdImageCreateFromXbm(fptr->f); @@ -242,7 +230,7 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid Xbm File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -292,17 +308,17 @@ img_from_xbmfname(klass, fname) +@@ -292,17 +295,17 @@ img_from_xbmfname(klass, fname) { VALUE f; - OpenFile *fptr; @@ -264,14 +252,14 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid Xbm File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -314,5 +330,5 @@ img_from_xpm(klass, f) +@@ -314,5 +317,5 @@ img_from_xpm(klass, f) VALUE klass, f; { - OpenFile *fptr; + rb_io_t *fptr; gdImagePtr iptr; -@@ -323,7 +339,7 @@ img_from_xpm(klass, f) +@@ -323,7 +326,7 @@ img_from_xpm(klass, f) /* need cast, and the argument is char* type */ - iptr = (gdImagePtr)gdImageCreateFromXpm(fptr->path); @@ -281,7 +269,7 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid XPM File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -335,10 +351,10 @@ img_from_xpmfname(klass, fname) +@@ -335,10 +338,10 @@ img_from_xpmfname(klass, fname) { VALUE f; - OpenFile *fptr; @@ -294,7 +282,7 @@ Support both Ruby 1.8 and Ruby 1.9. + f = rb_file_open(StringValuePtr(fname), "r"); rb_io_binmode(f); GetOpenFile(f, fptr); -@@ -346,7 +362,7 @@ img_from_xpmfname(klass, fname) +@@ -346,7 +349,7 @@ img_from_xpmfname(klass, fname) /* need cast, and the argument is char* type */ - iptr = (gdImagePtr)gdImageCreateFromXpm(fptr->path); @@ -304,14 +292,14 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid XPM File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -360,5 +376,5 @@ img_from_jpeg(klass, f) +@@ -360,5 +363,5 @@ img_from_jpeg(klass, f) VALUE klass, f; { - OpenFile *fptr; + rb_io_t *fptr; gdImagePtr iptr; -@@ -368,7 +384,7 @@ img_from_jpeg(klass, f) +@@ -368,7 +371,7 @@ img_from_jpeg(klass, f) rb_io_check_readable(fptr); - iptr = gdImageCreateFromJpeg(fptr->f); @@ -321,7 +309,7 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid Jpeg File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -380,17 +396,17 @@ img_from_jpegfname(klass, fname) +@@ -380,17 +383,17 @@ img_from_jpegfname(klass, fname) { VALUE f; - OpenFile *fptr; @@ -343,7 +331,7 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_raise(rb_eArgError, "%s is not a valid Jpeg File", RB_IO_PATH(fptr)); return Data_Wrap_Struct(klass,0,free_img,iptr); -@@ -419,10 +435,10 @@ hex2triplet(hex) +@@ -419,10 +422,10 @@ hex2triplet(hex) Check_Type(hex, T_STRING); - if (RSTRING(hex)->len != 7) @@ -359,7 +347,7 @@ Support both Ruby 1.8 and Ruby 1.9. + bstr = rb_str_new(RSTRING_PTR(hex) + 5, 2); ret_ary = rb_ary_new(); -@@ -460,7 +476,7 @@ img_color_allocate_str(img, rgbstr) +@@ -460,7 +463,7 @@ img_color_allocate_str(img, rgbstr) ary = hex2triplet(rgbstr); c = gdImageColorAllocate(im, - NUM2INT(*(RARRAY(ary)->ptr)), @@ -370,7 +358,7 @@ Support both Ruby 1.8 and Ruby 1.9. + NUM2INT(*(RARRAY_PTR(ary)+2))); return INT2FIX(c); } -@@ -533,7 +549,7 @@ img_color_resolve_str(img, rgbstr) +@@ -533,7 +536,7 @@ img_color_resolve_str(img, rgbstr) ary = hex2triplet(rgbstr); c = gdImageColorResolve(im, - NUM2INT(*(RARRAY(ary)->ptr)), @@ -381,7 +369,7 @@ Support both Ruby 1.8 and Ruby 1.9. + NUM2INT(*(RARRAY_PTR(ary)+2))); return INT2FIX(c); -@@ -596,7 +612,7 @@ img_color_closest_str(img, rgbstr) +@@ -596,7 +599,7 @@ img_color_closest_str(img, rgbstr) ary = hex2triplet(rgbstr); c = gdImageColorClosest(im, - NUM2INT(*(RARRAY(ary)->ptr)), @@ -392,7 +380,7 @@ Support both Ruby 1.8 and Ruby 1.9. + NUM2INT(*(RARRAY_PTR(ary)+2))); return INT2FIX(c); } -@@ -658,7 +674,7 @@ img_color_closestHWB_str(img, rgbstr) +@@ -658,7 +661,7 @@ img_color_closestHWB_str(img, rgbstr) ary = hex2triplet(rgbstr); c = gdImageColorClosestHWB(im, - NUM2INT(*(RARRAY(ary)->ptr)), @@ -403,7 +391,7 @@ Support both Ruby 1.8 and Ruby 1.9. + NUM2INT(*(RARRAY_PTR(ary)+2))); return INT2FIX(c); } -@@ -718,7 +734,7 @@ img_color_exact_str(img, rgbstr) +@@ -718,7 +721,7 @@ img_color_exact_str(img, rgbstr) ary = hex2triplet(rgbstr); c = gdImageColorExact(im, - NUM2INT(*(RARRAY(ary)->ptr)), @@ -414,7 +402,14 @@ Support both Ruby 1.8 and Ruby 1.9. + NUM2INT(*(RARRAY_PTR(ary)+2))); return INT2FIX(c); } -@@ -1000,9 +1016,9 @@ img_polygon(img, ply, c) +@@ -990,5 +993,5 @@ static VALUE + img_polygon(img, ply, c) + VALUE img; +- struct RArray *ply; ++ VALUE ply; + VALUE c; + { +@@ -1000,9 +1003,9 @@ img_polygon(img, ply, c) poly_req(ply); - len = ply->len/2; @@ -427,7 +422,14 @@ Support both Ruby 1.8 and Ruby 1.9. + pnt[i].y = NUM2INT(RARRAY_PTR(ply)[i*2+1]); } -@@ -1025,9 +1041,9 @@ img_filled_polygon(img, ply, c) +@@ -1015,5 +1018,5 @@ static VALUE + img_filled_polygon(img, ply, c) + VALUE img; +- struct RArray *ply; ++ VALUE ply; + VALUE c; + { +@@ -1025,9 +1028,9 @@ img_filled_polygon(img, ply, c) poly_req(ply); - len = ply->len/2; @@ -440,21 +442,21 @@ Support both Ruby 1.8 and Ruby 1.9. + pnt[i].y = NUM2INT(RARRAY_PTR(ply)[i*2+1]); } -@@ -1200,5 +1216,5 @@ img_string(img, fnt, x, y, str, c) +@@ -1200,5 +1203,5 @@ img_string(img, fnt, x, y, str, c) Data_Get_Struct(fnt, gdFont, f); - gdImageString(im,f,NUM2INT(x),NUM2INT(y),RSTRING(str)->ptr,NUM2INT(c)); + gdImageString(im,f,NUM2INT(x),NUM2INT(y),RSTRING_PTR(str),NUM2INT(c)); return img; -@@ -1217,5 +1233,5 @@ img_string_up(img, fnt, x, y, str, c) +@@ -1217,5 +1220,5 @@ img_string_up(img, fnt, x, y, str, c) Data_Get_Struct(fnt, gdFont, f); - gdImageStringUp(im,f,NUM2INT(x),NUM2INT(y),RSTRING(str)->ptr,NUM2INT(c)); + gdImageStringUp(im,f,NUM2INT(x),NUM2INT(y),RSTRING_PTR(str),NUM2INT(c)); return img; -@@ -1238,10 +1254,10 @@ img_s_string_ttf(klass, fgcolor, fontnam +@@ -1238,10 +1241,10 @@ img_s_string_ttf(klass, fgcolor, fontnam &brect[0], NUM2INT(fgcolor), - RSTRING(fontname)->ptr, @@ -467,7 +469,7 @@ Support both Ruby 1.8 and Ruby 1.9. + RSTRING_PTR(string)); for (i=0; i<8; i++) { rb_ary_push(ary, INT2FIX(brect[i])); -@@ -1270,10 +1286,10 @@ img_string_ttf(img, fgcolor, fontname, p +@@ -1270,10 +1273,10 @@ img_string_ttf(img, fgcolor, fontname, p &brect[0], NUM2INT(fgcolor), - RSTRING(fontname)->ptr, @@ -480,7 +482,7 @@ Support both Ruby 1.8 and Ruby 1.9. + RSTRING_PTR(string)); for (i=0; i<8; i++) { rb_ary_push(ary, INT2FIX(brect[i])); -@@ -1302,10 +1318,10 @@ img_s_string_ft(klass, fgcolor, fontname +@@ -1302,10 +1305,10 @@ img_s_string_ft(klass, fgcolor, fontname &brect[0], NUM2INT(fgcolor), - RSTRING(fontname)->ptr, @@ -493,7 +495,7 @@ Support both Ruby 1.8 and Ruby 1.9. + RSTRING_PTR(string)); for (i=0; i<8; i++) { rb_ary_push(ary, INT2FIX(brect[i])); -@@ -1334,10 +1350,10 @@ img_string_ft(img, fgcolor, fontname, pt +@@ -1334,10 +1337,10 @@ img_string_ft(img, fgcolor, fontname, pt &brect[0], NUM2INT(fgcolor), - RSTRING(fontname)->ptr, @@ -506,7 +508,7 @@ Support both Ruby 1.8 and Ruby 1.9. + RSTRING_PTR(string)); for (i=0; i<8; i++) { rb_ary_push(ary, INT2FIX(brect[i])); -@@ -1364,8 +1380,8 @@ img_char(img, fnt, x, y, ch, c) +@@ -1364,8 +1367,8 @@ img_char(img, fnt, x, y, ch, c) if (TYPE(ch) == T_STRING) { - if (RSTRING(ch)->len != 1) { @@ -518,7 +520,7 @@ Support both Ruby 1.8 and Ruby 1.9. + ci = RSTRING_PTR(ch)[0]; } else { -@@ -1390,8 +1406,8 @@ img_char_up(img, fnt, x, y, ch, c) +@@ -1390,8 +1393,8 @@ img_char_up(img, fnt, x, y, ch, c) if (TYPE(ch) == T_STRING) { - if (RSTRING(ch)->len != 1) { @@ -530,108 +532,105 @@ Support both Ruby 1.8 and Ruby 1.9. + ci = RSTRING_PTR(ch)[0]; } else { -@@ -1418,4 +1434,6 @@ img_get_interlace(img) +@@ -1418,4 +1421,6 @@ img_get_interlace(img) static VALUE img_set_interlace(img, val) + VALUE img; + VALUE val; { gdImagePtr im; -@@ -1499,5 +1517,5 @@ img_png(img, out) +@@ -1499,5 +1504,5 @@ img_png(img, out) { gdImagePtr im; - OpenFile *fptr; + rb_io_t *fptr; FILE *f; -@@ -1507,5 +1525,5 @@ img_png(img, out) +@@ -1507,5 +1512,5 @@ img_png(img, out) GetOpenFile(out, fptr); rb_io_check_writable(fptr); - f = (fptr->f2) ? fptr->f2 : fptr->f; + f = RB_IO_FILE(fptr); gdImagePng(im, f); -@@ -1543,5 +1561,5 @@ img_gif(img, out) +@@ -1543,5 +1548,5 @@ img_gif(img, out) { gdImagePtr im; - OpenFile *fptr; + rb_io_t *fptr; FILE *f; -@@ -1551,5 +1569,5 @@ img_gif(img, out) +@@ -1551,5 +1556,5 @@ img_gif(img, out) GetOpenFile(out, fptr); rb_io_check_writable(fptr); - f = (fptr->f2) ? fptr->f2 : fptr->f; + f = RB_IO_FILE(fptr); gdImageGif(im, f); -@@ -1582,5 +1600,5 @@ img_gd(img, out) +@@ -1582,5 +1587,5 @@ img_gd(img, out) { gdImagePtr im; - OpenFile *fptr; + rb_io_t *fptr; FILE *f; -@@ -1590,5 +1608,5 @@ img_gd(img, out) +@@ -1590,5 +1595,5 @@ img_gd(img, out) GetOpenFile(out, fptr); rb_io_check_writable(fptr); - f = (fptr->f2) ? fptr->f2 : fptr->f; + f = RB_IO_FILE(fptr); gdImageGd(im, f); -@@ -1601,5 +1619,5 @@ img_gd2(img, out, cs, fmt) +@@ -1601,5 +1606,5 @@ img_gd2(img, out, cs, fmt) VALUE img, out, cs, fmt; { - OpenFile *fptr; + rb_io_t *fptr; gdImagePtr im; FILE *f; -@@ -1609,5 +1627,5 @@ img_gd2(img, out, cs, fmt) +@@ -1609,5 +1614,5 @@ img_gd2(img, out, cs, fmt) GetOpenFile(out, fptr); rb_io_check_writable(fptr); - f = (fptr->f2) ? fptr->f2 : fptr->f; + f = RB_IO_FILE(fptr); Data_Get_Struct(img, gdImage, im); -@@ -1624,5 +1642,5 @@ img_jpeg(img, out, quality) +@@ -1624,5 +1629,5 @@ img_jpeg(img, out, quality) { gdImagePtr im; - OpenFile *fptr; + rb_io_t *fptr; FILE *f; -@@ -1634,5 +1652,5 @@ img_jpeg(img, out, quality) +@@ -1634,5 +1639,5 @@ img_jpeg(img, out, quality) GetOpenFile(out, fptr); rb_io_check_writable(fptr); - f = (fptr->f2) ? fptr->f2 : fptr->f; + f = RB_IO_FILE(fptr); gdImageJpeg(im, f, FIX2INT(quality)); -@@ -1669,5 +1687,5 @@ img_wbmp(img, fg, out) +@@ -1669,5 +1674,5 @@ img_wbmp(img, fg, out) { gdImagePtr im; - OpenFile *fptr; + rb_io_t *fptr; FILE *f; -@@ -1679,5 +1697,5 @@ img_wbmp(img, fg, out) +@@ -1679,5 +1684,5 @@ img_wbmp(img, fg, out) GetOpenFile(out, fptr); rb_io_check_writable(fptr); - f = (fptr->f2) ? fptr->f2 : fptr->f; + f = RB_IO_FILE(fptr); gdImageWBMP(im, FIX2INT(fg), f); -@@ -1698,5 +1716,9 @@ ply_new(klass) +@@ -1698,5 +1703,5 @@ ply_new(klass) VALUE self = rb_ary_new(); -+#if RUBY_API_VERSION_MAJOR >=2 && RUBY_API_VERSION_MINOR >= 1 -+ rb_obj_reveal(self, klass); -+#else - RBASIC(self)->klass = klass; -+#endif +- RBASIC(self)->klass = klass; ++ rb_obj_reveal(self, klass); return self; } -@@ -1725,7 +1747,7 @@ ply_to_pt(ply, dx, dy) +@@ -1725,7 +1730,7 @@ ply_to_pt(ply, dx, dy) NUM2INT(dy); - if (RARRAY(ply)->len > 0) { @@ -642,21 +641,24 @@ Support both Ruby 1.8 and Ruby 1.9. + y = rb_ary_entry(ply, RARRAY_LEN(ply) - 1); rb_ary_push(ply, INT2NUM(NUM2INT(x) + NUM2INT(dx))); rb_ary_push(ply, INT2NUM(NUM2INT(y) + NUM2INT(dy))); -@@ -1742,5 +1764,5 @@ ply_get_pt(ply, idx) +@@ -1742,5 +1747,5 @@ ply_get_pt(ply, idx) int i = NUM2INT(idx); - if (RARRAY(ply)->len < idx) return Qnil; + if (RARRAY_LEN(ply) < idx) return Qnil; i *= 2; -@@ -1780,5 +1802,5 @@ ply_length(ply) +@@ -1780,16 +1785,16 @@ ply_length(ply) VALUE ply; { - return INT2FIX(RARRAY(ply)->len / 2); + return INT2FIX(RARRAY_LEN(ply) / 2); } -@@ -1788,8 +1810,8 @@ ply_vertices(ply) + static VALUE + ply_vertices(ply) +- struct RArray *ply; ++ VALUE ply; { int i; - VALUE ary = rb_ary_new2(ply->len/2); @@ -668,7 +670,13 @@ Support both Ruby 1.8 and Ruby 1.9. + rb_ary_push(ary, rb_assoc_new(RARRAY_PTR(ply)[i], RARRAY_PTR(ply)[i+1])); } return ary; -@@ -1803,16 +1825,16 @@ ply_bounds(ply) +@@ -1798,21 +1803,21 @@ ply_vertices(ply) + static VALUE + ply_bounds(ply) +- struct RArray *ply; ++ VALUE ply; + { + int i, l, t, r, b; int nx, ny; - if (ply->len == 0) { @@ -691,7 +699,14 @@ Support both Ruby 1.8 and Ruby 1.9. + ny = NUM2INT(RARRAY_PTR(ply)[i+1]); if (ny < t) t = ny; if (ny > b) b = ny; -@@ -1831,9 +1853,9 @@ ply_offset(ply, vx, vy) +@@ -1823,5 +1828,5 @@ ply_bounds(ply) + static VALUE + ply_offset(ply, vx, vy) +- struct RArray *ply; ++ VALUE ply; + VALUE vx, vy; + { +@@ -1831,9 +1836,9 @@ ply_offset(ply, vx, vy) y = NUM2INT(vy); - for (i = 0; ilen; i+=2) { @@ -706,7 +721,14 @@ Support both Ruby 1.8 and Ruby 1.9. + RARRAY_PTR(ply)[i+1] = INT2FIX(c); } -@@ -1858,16 +1880,16 @@ ply_map(argc, argv, ply) +@@ -1845,5 +1850,5 @@ ply_map(argc, argv, ply) + int argc; + VALUE *argv; +- struct RArray *ply; ++ VALUE ply; + { + VALUE sl, st, sr, sb, dl, dt, dr, db; +@@ -1858,16 +1863,16 @@ ply_map(argc, argv, ply) int nx, ny; - if (ply->len == 0) { @@ -729,7 +751,7 @@ Support both Ruby 1.8 and Ruby 1.9. + ny = NUM2INT(RARRAY_PTR(ply)[i+1]); if (ny < t) t = ny; if (ny > b) b = ny; -@@ -1894,12 +1916,12 @@ ply_map(argc, argv, ply) +@@ -1894,12 +1899,12 @@ ply_map(argc, argv, ply) } - for (i = 0; ilen; i+=2) { @@ -747,7 +769,7 @@ Support both Ruby 1.8 and Ruby 1.9. + RARRAY_PTR(ply)[i+1] = INT2FIX(c); } -@@ -1914,9 +1936,9 @@ ply_transform(ply, a, b, c, d, tx, ty) +@@ -1914,9 +1919,9 @@ ply_transform(ply, a, b, c, d, tx, ty) VALUE x, y; - for (i = 0; i < RARRAY(ply)->len / 2; i++) { @@ -760,14 +782,18 @@ Support both Ruby 1.8 and Ruby 1.9. + y = RARRAY_PTR(ply)[i * 2 + 1]; ply_set_pt(ply, INT2NUM(i), INT2NUM(NUM2DBL(a) * NUM2INT(x) + NUM2DBL(c) * NUM2INT(y) + NUM2INT(tx)), -@@ -1968,5 +1990,5 @@ fnt_s_new(obj, name) +@@ -1965,8 +1970,8 @@ static VALUE + fnt_s_new(obj, name) + VALUE obj; +- struct RString *name; ++ VALUE name; { Check_Type(name, T_STRING); - return fnt_new(name->ptr); + return fnt_new(RSTRING_PTR(name)); } -@@ -2060,7 +2082,7 @@ img_color_allocate_alpha_str(img, rgbstr +@@ -2060,7 +2065,7 @@ img_color_allocate_alpha_str(img, rgbstr ary = hex2triplet(rgbstr); c = gdImageColorAllocateAlpha(im, - NUM2INT(*(RARRAY(ary)->ptr)), @@ -778,7 +804,7 @@ Support both Ruby 1.8 and Ruby 1.9. + NUM2INT(*(RARRAY_PTR(ary)+2)), NUM2INT(a)); return INT2NUM(c); -@@ -2122,7 +2144,7 @@ img_color_resolve_alpha_str(img, rgbstr, +@@ -2122,7 +2127,7 @@ img_color_resolve_alpha_str(img, rgbstr, ary = hex2triplet(rgbstr); c = gdImageColorResolveAlpha(im, - NUM2INT(*(RARRAY(ary)->ptr)), @@ -789,7 +815,7 @@ Support both Ruby 1.8 and Ruby 1.9. + NUM2INT(*(RARRAY_PTR(ary)+2)), NUM2INT(a)); return INT2NUM(c); -@@ -2183,7 +2205,7 @@ img_color_closest_alpha_str(img, rgbstr, +@@ -2183,7 +2188,7 @@ img_color_closest_alpha_str(img, rgbstr, ary = hex2triplet(rgbstr); c = gdImageColorClosestAlpha(im, - NUM2INT(*(RARRAY(ary)->ptr)), @@ -800,7 +826,7 @@ Support both Ruby 1.8 and Ruby 1.9. + NUM2INT(*(RARRAY_PTR(ary)+2)), NUM2INT(a)); return INT2NUM(c); -@@ -2245,7 +2267,7 @@ img_color_exact_alpha_str(img, rgbstr, a +@@ -2245,7 +2250,7 @@ img_color_exact_alpha_str(img, rgbstr, a ary = hex2triplet(rgbstr); c = gdImageColorExactAlpha(im, - NUM2INT(*(RARRAY(ary)->ptr)), @@ -811,7 +837,7 @@ Support both Ruby 1.8 and Ruby 1.9. + NUM2INT(*(RARRAY_PTR(ary)+2)), NUM2INT(a)); return INT2NUM(c); -@@ -2311,7 +2333,7 @@ img_s_truecolor_str(rgbstr) +@@ -2311,7 +2316,7 @@ img_s_truecolor_str(rgbstr) VALUE ary; ary = hex2triplet(rgbstr); - c = gdTrueColor(NUM2INT(*(RARRAY(ary)->ptr)), @@ -822,7 +848,7 @@ Support both Ruby 1.8 and Ruby 1.9. + NUM2INT(*(RARRAY_PTR(ary)+2))); return INT2NUM(c); -@@ -2365,7 +2387,7 @@ img_s_truecolor_alpha_str(rgbstr, a) +@@ -2365,7 +2370,7 @@ img_s_truecolor_alpha_str(rgbstr, a) VALUE ary; ary = hex2triplet(rgbstr); - c = gdTrueColorAlpha(NUM2INT(*(RARRAY(ary)->ptr)), --_----------=_161331477870300--