Changeset 4845 for libcaca


Ignore:
Timestamp:
Nov 1, 2012, 9:18:08 PM (6 years ago)
Author:
Pascal Terjan
Message:

Use macros to access len, needed for ruby 1.9

Location:
libcaca/trunk/ruby
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/ruby/caca-canvas.c

    r4369 r4845  
    275275    VALUE v, x, y;
    276276
    277     n = RARRAY(points)->len;
     277    n = RARRAY_LEN(points);
    278278
    279279    ax = (int*)malloc(n*sizeof(int));
     
    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);
     
    337337    VALUE v, x, y;
    338338
    339     n = RARRAY(points)->len;
     339    n = RARRAY_LEN(points);
    340340
    341341    ax = (int*)malloc(n*sizeof(int));
     
    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);
     
    460460    VALUE v;
    461461
    462     l = RARRAY(coords)->len;
     462    l = RARRAY_LEN(coords);
    463463    if(l != 6 && l != 3)
    464464    {
     
    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));
     
    479479    }
    480480
    481     l = RARRAY(uv)->len;
     481    l = RARRAY_LEN(uv);
    482482    if(l != 6 && l != 3)
    483483    {
     
    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));
     
    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));
     
    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));
  • libcaca/trunk/ruby/caca-dither.c

    r4369 r4845  
    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");
     
    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);
Note: See TracChangeset for help on using the changeset viewer.