libredwg
libredwg copied to clipboard
Split objfreespace and second header
There is possibility of second header and without objfreespace in AC1012. This mean, that we need to split.
@rurban First version, with error, which I don't see
In file included from encode.c:53:
encode.c: In function ‘encode_template’:
common.h:446:6: error: this condition has identical branches [-Werror=duplicated-branches]
446 | if (dat->version >= v)
| ^
encode.c:2506:3: note: in expansion of macro ‘SINCE’
2506 | SINCE (R_2004)
| ^~~~~
No, we don't. If the objfreespace address is zero, as in sample_2000, this section is omitted, but the 2nd header not
Ha, another case.
AC1012 - some versions do have not objfreespace record in the header, the section doesn't exist. other AC1012/AC1013/AC1014/AC1015 < AutoCAD 2005 - has objfreespace record in the header, section exists AC1015 > AutoCAD 2005 - has objfreespace record in the header with 0 size, section doesn't exist.
section 3 often does not exist, i.e. empty address and size, but often the 2ndheader is still attached to it. My latest fixes work now. I don't want to split it, as it confuses the section number logic. (dwg->header.sections)
@rurban I updated PR. See comment https://github.com/LibreDWG/libredwg/issues/860#issuecomment-1918511755
For the time being I did it simplier for 0.13, as your patch with my fixes filled up my hard disc.
Hm, there is some memory issue.
But we should fix this better