C++: Collected small fixes

Minor improvements to the code and cmake build.

--------

Testing:

The small cosmetic tweaks won't really be tested by the CI builds except to confirm they build.  However, the IFD and PNG changes will be.  All jobs should remain green.