libredwg icon indicating copy to clipboard operation
libredwg copied to clipboard

Split objfreespace and second header

Open michal-josef-spacek opened this issue 1 year ago • 8 comments

There is possibility of second header and without objfreespace in AC1012. This mean, that we need to split.

michal-josef-spacek avatar Jan 29 '24 16:01 michal-josef-spacek

@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)
      |   ^~~~~

michal-josef-spacek avatar Jan 29 '24 16:01 michal-josef-spacek

No, we don't. If the objfreespace address is zero, as in sample_2000, this section is omitted, but the 2nd header not

rurban avatar Jan 29 '24 18:01 rurban

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.

michal-josef-spacek avatar Jan 29 '24 19:01 michal-josef-spacek

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 avatar Jan 30 '24 12:01 rurban

@rurban I updated PR. See comment https://github.com/LibreDWG/libredwg/issues/860#issuecomment-1918511755

michal-josef-spacek avatar Jan 31 '24 07:01 michal-josef-spacek

For the time being I did it simplier for 0.13, as your patch with my fixes filled up my hard disc.

rurban avatar Feb 04 '24 08:02 rurban

Hm, there is some memory issue.

michal-josef-spacek avatar Feb 04 '24 11:02 michal-josef-spacek

But we should fix this better

rurban avatar Feb 09 '24 06:02 rurban