Ticket #99: libcaca-ruby-1.9.patch
File libcaca-ruby-1.9.patch, 3.7 KB (added by , 12 years ago) |
---|
-
ruby/caca-canvas.c
old new 274 274 int error = 0; 275 275 VALUE v, x, y; 276 276 277 n = RARRAY (points)->len;277 n = RARRAY_LEN(points); 278 278 279 279 ax = (int*)malloc(n*sizeof(int)); 280 280 if(!ax) … … 290 290 for(i=0; i<n; i++) 291 291 { 292 292 v = rb_ary_entry(points, i); 293 if((TYPE(v) == T_ARRAY) && (RARRAY (v)->len== 2))293 if((TYPE(v) == T_ARRAY) && (RARRAY_LEN(v) == 2)) 294 294 { 295 295 x = rb_ary_entry(v,0); 296 296 y = rb_ary_entry(v,1); … … 336 336 int error = 0; 337 337 VALUE v, x, y; 338 338 339 n = RARRAY (points)->len;339 n = RARRAY_LEN(points); 340 340 341 341 ax = (int*)malloc(n*sizeof(int)); 342 342 if(!ax) … … 352 352 for(i=0; i<n; i++) 353 353 { 354 354 v = rb_ary_entry(points, i); 355 if((TYPE(v) == T_ARRAY) && (RARRAY (v)->len== 2))355 if((TYPE(v) == T_ARRAY) && (RARRAY_LEN(v) == 2)) 356 356 { 357 357 x = rb_ary_entry(v,0); 358 358 y = rb_ary_entry(v,1); … … 459 459 float cuv[6]; 460 460 VALUE v; 461 461 462 l = RARRAY (coords)->len;462 l = RARRAY_LEN(coords); 463 463 if(l != 6 && l != 3) 464 464 { 465 465 rb_raise(rb_eArgError, "invalid coords list"); … … 471 471 ccoords[i] = NUM2INT(v); 472 472 else 473 473 { 474 if((TYPE(v) != T_ARRAY) || (RARRAY (v)->len!= 2))474 if((TYPE(v) != T_ARRAY) || (RARRAY_LEN(v) != 2)) 475 475 rb_raise(rb_eArgError, "invalid coords list"); 476 476 ccoords[2*i] = NUM2INT(rb_ary_entry(v, 0)); 477 477 ccoords[2*i+1] = NUM2INT(rb_ary_entry(v, 1)); 478 478 } 479 479 } 480 480 481 l = RARRAY (uv)->len;481 l = RARRAY_LEN(uv); 482 482 if(l != 6 && l != 3) 483 483 { 484 484 rb_raise(rb_eArgError, "invalid uv list"); … … 490 490 cuv[i] = NUM2DBL(v); 491 491 else 492 492 { 493 if((TYPE(v) != T_ARRAY) || (RARRAY (v)->len!= 2))493 if((TYPE(v) != T_ARRAY) || (RARRAY_LEN(v) != 2)) 494 494 rb_raise(rb_eArgError, "invalid uv list"); 495 495 ccoords[2*i] = NUM2DBL(rb_ary_entry(v, 0)); 496 496 ccoords[2*i+1] = NUM2DBL(rb_ary_entry(v, 1)); … … 600 600 static VALUE import_from_memory(VALUE self, VALUE data, VALUE format) 601 601 { 602 602 long int bytes; 603 bytes = caca_import_canvas_from_memory (_SELF, StringValuePtr(data), RSTRING (StringValue(data))->len, StringValuePtr(format));603 bytes = caca_import_canvas_from_memory (_SELF, StringValuePtr(data), RSTRING_LEN(StringValue(data)), StringValuePtr(format)); 604 604 if(bytes <= 0) 605 605 rb_raise(rb_eRuntimeError, strerror(errno)); 606 606 … … 610 610 static VALUE import_area_from_memory(VALUE self, VALUE x, VALUE y, VALUE data, VALUE format) 611 611 { 612 612 long int bytes; 613 bytes = caca_import_area_from_memory (_SELF, NUM2INT(x), NUM2INT(y), StringValuePtr(data), RSTRING (StringValue(data))->len, StringValuePtr(format));613 bytes = caca_import_area_from_memory (_SELF, NUM2INT(x), NUM2INT(y), StringValuePtr(data), RSTRING_LEN(StringValue(data)), StringValuePtr(format)); 614 614 if(bytes <= 0) 615 615 rb_raise(rb_eRuntimeError, strerror(errno)); 616 616 -
ruby/caca-dither.c
old new 48 48 VALUE v, r, g, b, a; 49 49 int error = 0; 50 50 51 if(RARRAY (palette)->len!= 256)51 if(RARRAY_LEN(palette) != 256) 52 52 { 53 53 rb_raise(rb_eArgError, "Palette must contain 256 elements"); 54 54 } … … 84 84 for(i=0; i<256; i++) 85 85 { 86 86 v = rb_ary_entry(palette, i); 87 if((TYPE(v) == T_ARRAY) && (RARRAY (v)->len== 4))87 if((TYPE(v) == T_ARRAY) && (RARRAY_LEN(v) == 4)) 88 88 { 89 89 r = rb_ary_entry(v,0); 90 90 g = rb_ary_entry(v,1);