Forum > FPC development
Mismatch in header notification definitions causes not-applicable warnings
440bx:
Hello,
The Header control notifications are defined as being negative constants but, the NMHDR.code they are compared against is defined as a longword.
This causes warnings from FPC. Specifically:
Warning: range check error while evaluating constants (-306 must be between 0 and 4294967295)
This occurs for all the notification codes used by the header control.
PascalDragon:
Would you mind providing a bit more context, please? Cause right now it isn't really clear what exactly you're talking about.
Thaddy:
NMHDR record member constants itself are declared as signed integers (probably legacy) but the winapi NMHDR expects longword members. Hence the compiler barks.
(/win/wininc/struct.inc is correct, messages.inc isn't)
To suppress, cast to longword on use as a work-around.
Solution is possibly to redeclare
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---const HDM_TESTDUMMY = longword(-321); // instead of HDM_TESTDUMMY = -(321)var i:longint; j:longword; begin i:=HDM_TESTDUMMY; // testlongword.pas(6,8) Warning: Range check error while evaluating constants (4294966975 must be between -2147483648 and 2147483647) j:=HDM_TESTDUMMY; // OK. writeln(i,'|',j);end.Is that enough context?
[edit]
reported in Mantis as #0035324
p.s. the example actually reverses the issue to make it clear.
ASerge:
For clarification.
SDK defines such const as unsigned (commctrl.h):
--- Code: C [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---#define HDN_FIRST (0U-300U) // headerBut FPC as signed (commctrl.pp)
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---HDN_FIRST = (0-300); // headerSo it will be enough to specify
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---HDN_FIRST = LongWord(0-300); // header
440bx:
--- Quote from: ASerge on April 05, 2019, 08:13:28 pm ---
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---HDN_FIRST = (0-300); // headerSo it will be enough to specify
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---HDN_FIRST = LongWord(0-300); // header
--- End quote ---
Yes, fortunately, it is a very simple thing to fix.
Navigation
[0] Message Index
[#] Next page