fixed! http://git.savannah.gnu.org/cgit/libredwg.git/commit/?id=f8b6e1acfdcb84869cf0ffb808c6fe13db76b755
Although testSVG.c does not output 3D solids since SVG is restricted to 2D vector primitives. Somebody should try to write a libredwg example application that uses the SAT parser/importer from OpenCASCADE that Rodrigo mentioned to export DWG to some 3D open CAD format (perhaps COLLADA? or STEP?). Felipe Sanches (Juca) On Mon, Feb 22, 2010 at 6:16 PM, Till Heuschmann <theuschm...@googlemail.com> wrote: > > You are right, passing the '++' to the FIELD_VECTOR macro results in an > unexpected incrementation of variable i. > > >> Timo, >> >> Please always send emails about LibreDWG with a copy to libredwg@gnu.org >> <mailto:libredwg@gnu.org>. >> >> So, you think the issue is realloc ing too frequently? >> >> -Felipe >> >> 2010/2/22 Timo Lähde <timovj.la...@gmail.com >> <mailto:timovj.la...@gmail.com>> >> >> 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 <j...@members.fsf.org >> <mailto:j...@members.fsf.org>> >> >> 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 libredwg@gnu.org >> <mailto:libredwg@gnu.org> >> >> 2010/2/21 Timo Lähde <timovj.la...@gmail.com >> <mailto:timovj.la...@gmail.com>> >> >> 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 >> >> >> >> >> >> >> >> > > > >