cppcheck sept 18 redux
wine-devel at kievinfo.com
Tue Sep 22 00:09:08 CDT 2009
Ben Klein wrote:
> The question remains, how exactly does
> FIELD_OFFSET work, and does it end up dereferencing ca?
It does pointer arithmetic and does not dereference anything. "ca" is the
same as "(ca + 5)" or on lower level "((char*)ca + 5*sizeof(ca))" and
does not require any dereferencing.
> [/home/cahrendt/wine-git/dlls/wineps.drv/init.c:270]: (error) Possible
> null pointer dereference: dmW - otherwise it is redundant to check if
> dmW is null at line 272
This is a real bug and should be fixed:
> ptrdiff_t off_formname = (const char *)dmW->dmFormName - (const char *)dmW;
Does indeed dereference dmW to get the value of dmFormName.
More information about the wine-devel