kooloveme / thtmlviewer

Automatically exported from code.google.com/p/thtmlviewer
Other
0 stars 0 forks source link

StyleTypes.pas: Code improvement for C++Builder #399

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The following lines in file StyleTypes.pas (lines 402-407):

const
// CSS 2.1 defines a fixed ratio between pt and px at 96 dpi: 1px = 0.75pt.
// (see 
http://www.w3.org/TR/2010/WD-CSS2-20101207/syndata.html#value-def-length for 
details).
  HTMLViewerPixelsPerInch = 96.0; // fixed assumption in CSS 2.1 as lots of designs rely on it.
  HTMLViewerPointsPerInch = 72.0;
  HTMLViewerPointsPerPixel = HTMLViewerPointsPerInch / HTMLViewerPixelsPerInch;

result in the C++Builder file StyleTypes.hpp as follows:
#define HTMLViewerPixelsPerInch  (9.600000E+01)
#define HTMLViewerPointsPerInch  (7.200000E+01)
static const System::Extended HTMLViewerPointsPerPixel = 7.500000E-01;

Each file including the HtmlViewer component throws the compiler warning:
[C++ Warning] <File>.cpp(<last line>): 'HTMLViewerPointsPerPixel' is declared 
but never used

Solutions:
1. Please use only typed constants.
const
  HTMLViewerPixelsPerInch : Double = 96.0; // fixed assumption in CSS 2.1 as lots of designs rely on it.
  HTMLViewerPointsPerInch : Double = 72.0;
  HTMLViewerPointsPerPixel : Double = HTMLViewerPointsPerInch / HTMLViewerPixelsPerInch;

2. Move the declaration of HTMLViewerPointsPerPixel to the "implementation" 
section. Then the declaration does not occur in the hpp file. And we don't get 
many warnings.

Thank you!

Original issue reported on code.google.com by hpk...@sked.de on 24 Feb 2015 at 5:29