Fix a bug, and clear a debug assert #12
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix a dangerous bug in CResizableLayout::AddAllOtherAnchors
::GetClassName(hWnd, szClassName, _countof(szClassName))
The third parameter is a character count, not a byte count.
In Unicode builds
sizeof
would give twice the length of the name buffer; and access violations might be expected; especially with a small buffer.Not necessarily, but to make the code suitable for prehistoric VS versions,
_countof(x)
might be replaced withsizeof(x)/sizeof(x[0])
.Clear a rare debug assert in CResizableFormView::GetTotalClientRect
A trivial sequence "remove anchor - set window placement - add anchor" was fine in the first pass, but fired a debug asserts afterwards. The problem was in an attempted access to a non-existent scrollbar. An early check and return fixed this.
GetDeviceScrollSizes
treats all non-positive mapping modes as invalid, and the conditionnMapMode < 0
was changed accordingly.