microsoft / microsoft/Windows-classic-samples

RecipeThumbnailProvider: explain -static_cast<LONG>(nHeight)

Open
#263 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
5.7k
Forks
3.3k
PR merge metrics
No merged PRs in 30d

Description

The code sample for CRecipeThumbProvider makes an assignment of -static_cast<LONG>(nHeight) to the field biHeight of type LONG, where nHeight is of type UINT.

It is unclear why it is correct to negate the result of the static cast, as a reader of the code might be misled to believe some sort of UINT->INT conversion weirdness to be present. The code sample should have a comment directing the reader to the documentation of BITMAPINFOHEADER.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open Samples/Win7Samples/winui/shell/appshellintegration/RecipeThumbnailProvider/RecipeThumbnailProvider.cpp at the assignment around line 252. Read the BITMAPINFOHEADER documentation linked in the issue to understand the negative height, then add a comment that explains it and points readers to that documentation; done means the sample is clearer without changing its behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.