Opened 13 years ago
Closed 13 years ago
#3554 closed defect (fixed)
Found and fixed DGNLib Cell Header bug
Reported by: | warmerdam | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | dgn |
Cc: |
Description
Hi Frank,
I would just like to report a bug that we found in dgnwrite.cpp. Should be somewhere around line 2320 in DGNCreateCellHeaderFromGroup(). Basically we saw that Microstation showed a different level in the bottom right corner than what all of the cell's elements had. For example, if you set all the elements to level 16 and then open the generated file with Microstation, it will show Levels: 24.
The problem lies in the indexing of abyLevelsOccuring. Since the level flags are really 1-8, that means level 16 is the last bit in the second byte, and not the third as it is now.
Original:
abyLevelsOccuring[nLevel >> 3] |= (0x1 << ((nLevel-1)&0x7));
Fixed:
abyLevelsOccuring[(nLevel - 1) >> 3] |= (0x1 << ((nLevel-1)&0x7));
I also put in a check to see if the nLevel was 0, as we don't want -1 coming out from nLevel - 1.
Cheers,
Karl Hedlund Carmenta AB
Change History (1)
comment:1 by , 13 years ago
Cc: | removed |
---|---|
Keywords: | dgn added |
Resolution: | → fixed |
Status: | new → closed |
Corrected in trunk (r19572). I believe this does not impact GDAL/OGR use of dgnlib, but it will affect some other dgnlib users.
Thanks!