This is a new set of potential bugs found via Viva64:
Example 1. ReactOS project. Incorrect printing of a WCHAR-character( regproc.c 293) .
static void REGPROC_unescape_string(WCHAR* str)
{
...
default:
fprintf(stderr,
"Warning! Unrecognized escape sequence: \\%c'\n",
str[str_idx]);
...
}
Reason: To fix the code, we should replace '%c' with '%C' in the format string.
Example 2. ReactOS project. Assignment error. (menu.c 4347)
BOOL WINAPI GetMenuItemInfoA(...)
{
...
mii->cch = mii->cch;
...
}
Example 16. ReactOS project. Misprint in a macro.( win32k gradient.c 343 )
#define SWAP(a,b,c) c = a;\
a = b;\
a = c
Example 8. ReactOS object. Choosing a wrong object.
void CardButton::DrawRect(HDC hdc, RECT *rect, bool fNormal)
{
...
HPEN hhi = CreatePen(0, 0, MAKE_PALETTERGB(crHighlight));
HPEN hsh = CreatePen(0, 0, MAKE_PALETTERGB(crShadow));
...
if(fNormal)
hOld = SelectObject(hdc, hhi);
else
hOld = SelectObject(hdc, hhi);
...
}
The 'then' statement is equivalent to the 'else' statement. cardlib cardbutton.cpp 83
The 'hsh' object is not used, while 'hhi' is used twice. This is the correct code:
if(fNormal)
hOld = SelectObject(hdc, hhi);
else
hOld = SelectObject(hdc, hsh);
Example 10. ReactOS project. Mistake in a variable name.
BOOL APIENTRY
GreStretchBltMask(...)
{
...
MaskPoint.x += DCMask->ptlDCOrig.x;
MaskPoint.y += DCMask->ptlDCOrig.x;
...
}
Consider reviewing the correctness of 'x' item's usage. win32k bitblt.c 670
Example 4. ReactOS project. Incorrect calculation of a string length ( vbe.c 57 )
static const PCHAR Nv11Board = "NV11 (GeForce2) Board";
static const PCHAR Nv11Chip = "Chip Rev B2";
static const PCHAR Nv11Vendor = "NVidia Corporation";
BOOLEAN
IsVesaBiosOk(...)
{
...
if (!(strncmp(Vendor, Nv11Vendor, sizeof(Nv11Vendor))) &&
!(strncmp(Product, Nv11Board, sizeof(Nv11Board))) &&
!(strncmp(Revision, Nv11Chip, sizeof(Nv11Chip))) &&
(OemRevision == 0x311))
...
}
Reason: The error here is this: the sizeof() operator, absolutely inappropriate
in this situation, is used to calculate string lengths. The sizeof()
operator actually calculates the pointer size instead of the number of
bytes in a string.
In this case Abragin said this is not a bug.
I'm sending here to discuss about them ;).Are they valid?
Link: http://www.viva64.com/en/a/0079/