Skip to content

Commit

Permalink
postprocess_SEQEND: improve Missing owner
Browse files Browse the repository at this point in the history
log the handle, search the owner on preR13, as in indxf
  • Loading branch information
rurban committed Dec 15, 2023
1 parent 5177d61 commit 0e7da55
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
28 changes: 25 additions & 3 deletions src/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6634,13 +6634,35 @@ in_postprocess_SEQEND (Dwg_Object *restrict obj, BITCODE_BL num_owned,
loglevel = dwg->opts & DWG_OPTS_LOGLEVEL;
LOG_TRACE ("in_postprocess_SEQEND (%u):\n", (unsigned)num_owned);
owner = dwg_ref_object (dwg, obj->tio.entity->ownerhandle);
// r12 and earlier: search for owner backwards
if (dwg->header.from_version < R_13b1 && !owner
&& !obj->tio.entity->ownerhandle)
{
for (BITCODE_BL i = obj->index - 1; i > 0; i--)
{
Dwg_Object *_o = &dwg->object[i];
if (_o->type == DWG_TYPE_INSERT || _o->type == DWG_TYPE_MINSERT
|| _o->type == DWG_TYPE_POLYLINE_2D
|| _o->type == DWG_TYPE_POLYLINE_3D
|| _o->type == DWG_TYPE_POLYLINE_PFACE
|| _o->type == DWG_TYPE_POLYLINE_MESH)
{
owner = _o;
obj->tio.entity->ownerhandle
= dwg_add_handleref (dwg, 4, _o->handle.value, obj);
LOG_TRACE ("SEQEND.owner = " FORMAT_H " (%s) [H* 0]\n",
ARGS_H (_o->handle), _o->name);
break;
}
}
}
if (!owner)
{
if (obj->tio.entity->ownerhandle)
LOG_WARN ("Missing owner from " FORMAT_REF " [H 330]",
ARGS_REF (obj->tio.entity->ownerhandle))
LOG_WARN ("Missing owner (" FORMAT_RLLx ") from " FORMAT_REF " [H 330]",
obj->handle.value, ARGS_REF (obj->tio.entity->ownerhandle))
else
LOG_WARN ("Missing owner")
LOG_WARN ("Missing owner (" FORMAT_RLLx ")", obj->handle.value)
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/in_dxf.c
Original file line number Diff line number Diff line change
Expand Up @@ -8369,10 +8369,10 @@ dxf_postprocess_SEQEND (Dwg_Object *restrict obj)
if (!owner)
{
if (obj->tio.entity->ownerhandle)
LOG_WARN ("Missing owner from " FORMAT_REF " [H 330]",
ARGS_REF (obj->tio.entity->ownerhandle))
LOG_WARN ("Missing owner (" FORMAT_RLLx ") from " FORMAT_REF " [H 330]",
obj->handle.value, ARGS_REF (obj->tio.entity->ownerhandle))
else
LOG_WARN ("Missing owner")
LOG_WARN ("Missing owner (" FORMAT_RLLx ")", obj->handle.value)
return;
}
obj->tio.entity->ownerhandle->obj = NULL;
Expand Down

0 comments on commit 0e7da55

Please sign in to comment.