libredwg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libredwg] Re: libreDWG decode_3dsolid


From: Felipe Sanches
Subject: [libredwg] Re: libreDWG decode_3dsolid
Date: Mon, 22 Feb 2010 15:24:59 -0300

Timo,

Please always send emails about LibreDWG with a copy to address@hidden.

So, you think the issue is realloc ing too frequently?

-Felipe

2010/2/22 Timo Lähde <address@hidden>
Hello!

I was testing testSVG.c with that example.dwg and it crash.

Variable 'i' isn't the problem, but it's usage in those macros because of those too many increments of 'i' in that loop.
It should happen only once in reallocation in my opinion. After that correction that part of code goes past that error.

I have expanded all those macros to huge decode.c to debug that part of code.

if (_obj->version == 1)
{
    do
    {
     _obj->sat_data = (char **)realloc(_obj->sat_data, (i + 1) * sizeof(char *));
     _obj->block_size = bit_read_BL(dat);
    if (3 >= 3)
    {
      fprintf((&__stderr), "block_size" ": " "%lu" "\n", _obj->block_size);
    };
    if (_obj->block_size > 0)
    {
     _obj->sat_data[i] = (char *)malloc(_obj->block_size * sizeof(char));
    for (vcount = 0; vcount < _obj->block_size; vcount++)
   {
    _obj->sat_data[i][vcount] = bit_read_RC(dat);
    if (3 >= 3)
    {
      fprintf((&__stderr), "sat_data[i++]" "[%d]: " "%2x" "\n", vcount, _obj->sat_data[i][vcount]);
    }
    }
    };
   i++;
   } while (_obj->block_size);
}
else

{
    fprintf((&__stderr), "TODO: Implement parsing of ACIS file in entities 37,38 and 39.\n");
}

Timo

2010/2/22 Felipe Sanches <address@hidden>

I agree that using this vriable is not the best thing to do. But decode3d is not working at all yet. If you want to give it a try, feel free. But if you do so, let us know what you're doing so that we dont duplicate efforts.

juca

PS: I forwarded your message to address@hidden

2010/2/21 Timo Lähde <address@hidden>

Hello!

Is this better way to do that, because of variable i :

dwg.spec line 1244:

if (FIELD_VALUE(version)==1)
        {
          do
            {
              //FIELD_VALUE(sat_data) = (BITCODE_RC**) realloc(FIELD_VALUE(sat_data), i * sizeof(BITCODE_RC*));
             FIELD_VALUE(sat_data) = (BITCODE_RC**) realloc(FIELD_VALUE(sat_data), (i + 1) * sizeof(BITCODE_RC*));
              FIELD_BL (block_size);
              //FIELD_VECTOR (sat_data[i++], RC, block_size);
              FIELD_VECTOR (sat_data[i], RC, block_size);
              i++;
            } while(FIELD_VALUE(block_size));
        }
      else
        {
          //TODO
          fprintf(stderr, "TODO: Implement parsing of ACIS file in entities 37,38 and 39.\n");
        }

regards Timo VJ Lähde









reply via email to

[Prev in Thread] Current Thread [Next in Thread]