Ticket #99: libcaca-ruby-1.9.patch

File libcaca-ruby-1.9.patch, 3.7 KB (added by bkabrda, 12 years ago)
  • ruby/caca-canvas.c

    old new  
    274274    int error = 0;
    275275    VALUE v, x, y;
    276276
    277     n = RARRAY(points)->len;
     277    n = RARRAY_LEN(points);
    278278
    279279    ax = (int*)malloc(n*sizeof(int));
    280280    if(!ax)
     
    290290    for(i=0; i<n; i++)
    291291    {
    292292        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))
    294294        {
    295295            x = rb_ary_entry(v,0);
    296296            y = rb_ary_entry(v,1);
     
    336336    int error = 0;
    337337    VALUE v, x, y;
    338338
    339     n = RARRAY(points)->len;
     339    n = RARRAY_LEN(points);
    340340
    341341    ax = (int*)malloc(n*sizeof(int));
    342342    if(!ax)
     
    352352    for(i=0; i<n; i++)
    353353    {
    354354        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))
    356356        {
    357357            x = rb_ary_entry(v,0);
    358358            y = rb_ary_entry(v,1);
     
    459459    float cuv[6];
    460460    VALUE v;
    461461
    462     l = RARRAY(coords)->len;
     462    l = RARRAY_LEN(coords);
    463463    if(l != 6 && l != 3)
    464464    {
    465465        rb_raise(rb_eArgError, "invalid coords list");
     
    471471            ccoords[i] = NUM2INT(v);
    472472        else
    473473        {
    474             if((TYPE(v) != T_ARRAY) || (RARRAY(v)->len != 2))
     474            if((TYPE(v) != T_ARRAY) || (RARRAY_LEN(v) != 2))
    475475                rb_raise(rb_eArgError, "invalid coords list");
    476476            ccoords[2*i] = NUM2INT(rb_ary_entry(v, 0));
    477477            ccoords[2*i+1] = NUM2INT(rb_ary_entry(v, 1));
    478478        }
    479479    }
    480480
    481     l = RARRAY(uv)->len;
     481    l = RARRAY_LEN(uv);
    482482    if(l != 6 && l != 3)
    483483    {
    484484        rb_raise(rb_eArgError, "invalid uv list");
     
    490490            cuv[i] = NUM2DBL(v);
    491491        else
    492492        {
    493             if((TYPE(v) != T_ARRAY) || (RARRAY(v)->len != 2))
     493            if((TYPE(v) != T_ARRAY) || (RARRAY_LEN(v) != 2))
    494494                rb_raise(rb_eArgError, "invalid uv list");
    495495            ccoords[2*i] = NUM2DBL(rb_ary_entry(v, 0));
    496496            ccoords[2*i+1] = NUM2DBL(rb_ary_entry(v, 1));
     
    600600static VALUE import_from_memory(VALUE self, VALUE data, VALUE format)
    601601{
    602602    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));
    604604    if(bytes <= 0)
    605605        rb_raise(rb_eRuntimeError, strerror(errno));
    606606
     
    610610static VALUE import_area_from_memory(VALUE self, VALUE x, VALUE y, VALUE data, VALUE format)
    611611{
    612612    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));
    614614    if(bytes <= 0)
    615615        rb_raise(rb_eRuntimeError, strerror(errno));
    616616
  • ruby/caca-dither.c

    old new  
    4848    VALUE v, r, g, b, a;
    4949    int error = 0;
    5050
    51     if(RARRAY(palette)->len != 256)
     51    if(RARRAY_LEN(palette) != 256)
    5252    {
    5353        rb_raise(rb_eArgError, "Palette must contain 256 elements");
    5454    }
     
    8484    for(i=0; i<256; i++)
    8585    {
    8686        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))
    8888        {
    8989            r = rb_ary_entry(v,0);
    9090            g = rb_ary_entry(v,1);