Вы находитесь на странице: 1из 5

Dolphin-emu

:
: 24.02.2012
PVSStudio. - , .
Dolphin-emu.

Dolphin-emu Gamecube Wii. ,


. code.google.com.
. ,
. 260 000 .
(1340 000 ) ,
.
, .
,
PVS-Studio.

. ,

. ,
.
, Dolphin-emu :
bool IRBuilder::maskedValueIsZero(
InstLoc Op1, InstLoc Op2) const
{
return (~ComputeKnownZeroBits(Op1) &
~ComputeKnownZeroBits(Op1)) == 0;
}
PVS-Studio:
V501 There are identical sub-expressions '~ComputeKnownZeroBits(Op1)' to the left and to the right of
the '&' operator. Core ir.cpp 1215
- 'Op1' 'Op2'.
, ')'.

static const char iplverPAL[0x100] = "(C) 1999-2001 ....";


static const char iplverNTSC[0x100]= "(C) 1999-2001 ....";
CEXIIPL::CEXIIPL() : ....
{
...
memcpy(m_pIPL, m_bNTSC ? iplverNTSC : iplverPAL,
sizeof(m_bNTSC ? iplverNTSC : iplverPAL));
...
}
PVS-Studio:
V568 It's odd that the argument of sizeof() operator is the 'm_bNTSC ? iplverNTSC : iplverPAL'
expression. Core exi_deviceipl.cpp 112
sizeof() . ,
'iplverNTSC' 'iplverPAL' . , sizeof()
0x100. . 'iplverNTSC' 'iplverPAL ' ,
-. :
const char A[10] = "123";
const char B[10] = "123";
const char C[20] = "123";
cout << sizeof(true ? A : B) << ", "
<< sizeof(true ? A : C) << endl;
: 10, 4.
, - .


memset()
memcpy().
u32 Flatten(..., BlockStats *st, ...)
{
...
memset(st, 0, sizeof(st));
...

}
PVS-Studio:
V579 The memset function receives the pointer and its size as arguments. It is possibly a mistake.
Inspect the third argument. Core ppcanalyst.cpp 302
, BlockStats.
: sizeof(*st).
:
void drawShadedTexSubQuad(...,
const MathUtil::Rectangle<float>* rDest, ...)
{
...
if (stsq_observer ||
memcmp(rDest,
&tex_sub_quad_data.rdest, sizeof(rDest)) != 0 ||
tex_sub_quad_data.u1 != u1 ||
tex_sub_quad_data.v1 != v1 ||
tex_sub_quad_data.u2 != u2 ||
tex_sub_quad_data.v2 != v2 ||
tex_sub_quad_data.G != G)
...
}
. : sizeof(*rDest).

float
Dolphin-emu, float,
. float == !=.
.
float V550.
:
float Slope::GetValue(float dx, float dy)
{
return f0 + (dfdx * dx) + (dfdy * dy);

void BuildBlock(s32 blockX, s32 blockY)


{
...
float invW = 1.0f / WSlope.GetValue(dx, dy);
...
float q = TexSlopes[i][2].GetValue(dx, dy) * invW;
if (q != 0.0f)
projection = invW / q;
...
}
PVS-Studio
V550 An odd precise comparison: q != 0.0f. It's probably better to use a comparison with defined
precision: fabs(A - B) > Epsilon. VideoSoftware rasterizer.cpp 264
"if (q != 0.0f)". , 'q'
. , ,
. , , 0.00000002. 0,
.
.


void CMemoryWindow::onSearch(wxCommandEvent& event)
{
...
//sprintf(tmpstr, "%s%s", tmpstr, rawData.c_str());
//strcpy(&tmpstr[1], rawData.ToAscii());
//memcpy(&tmpstr[1], &rawData.c_str()[0], rawData.size());
sprintf(tmpstr, "%s%s", tmpstr, (const char *)rawData.mb_str());
...
}

, .
. , . PVS-Studio
:
V541 It is dangerous to print the string 'tmpstr' into itself. Dolphin memorywindow.cpp 344
, "tmpstr" .
, . sprintf()
. ,
strcat().
, , :
V541 It is dangerous to print the string 'pathData_bin' into itself. Dolphin wiisavecrypted.cpp 513
V541 It is dangerous to print the string 'regs' into itself. Core interpreter.cpp 84
V541 It is dangerous to print the string 'fregs' into itself. Core interpreter.cpp 89

, PVS-Studio.
.

Вам также может понравиться