Appearently, "(HIWORD(dword) < 0)" cannot be less than zero since the conditional expression is constant, so the compile removes
expression from the source code.
If I take this code and compile it I end up with this ASM as the result:
Code:
dwLen = (DWORD)_llseek (hFile, 0L, 2);
iLen = LOWORD(dwLen);
_llseek (hFile, 0L, 0);
if (HIWORD(dwLen) > 0)
goto blah;
else if (HIWORD(dwLen) > 0 && LOWORD(dwLen) == -1)
goto blah;
ASM result:
Code:
push word ptr [09F0] //hFile
push 0
push 0
push 2 //OF_READ
call _llseek
mov [bp-10], ax //LOWORD
mov [bp-0E], dx //HIWORD
mov [bp-FF6E], ax //int=LOWORD
push word ptr [09F0] //hFile
push 0
push 0
push 0
call _llseek
cmp word ptr [bp-0E], 00 //HIWORD
jnz 02A5
jz 0292
cmp word ptr [bp-10], -01 //LOWORD /* if (LOWORD(dword) == -1) ?? */
jz 02A5
push word ptr [0AAE] // hEdit
lea ax, [si+01]
push ax
push 42
call LocalReAlloc
As you can see the "mov si, ax" statement is not present in the one _llseek call, and the jumps are jnz, jz, jz, verses the jg,
jl, ja in the original ASM code. BTW, I left the LocalReAlloc funtion out of the C source code I posted.