2010 PVS-Studio
:
: 20.04.2011
, ,
Visual Studio 2010. open source .
PVS-Studio. .
" "
[1] , ,
.
- . ,
.
.
open source c
, Visual Studio 2010 Premium.
. PVS-Studio.
, :
eMule Plus;
Pixie;
VirtualDub;
WinMerge;
XUIFramework.
, !
eMule Plus
Visual Studio 237. 4.
PVS-Studio 68. 3.
Visual Studio: warning C6054: String 'szwThemeFile' might not be
zero-terminated. c:\emuleplus\dialogmintraybtn.hpp 445
WCHAR szwThemeFile[MAX_PATH];
WCHAR szwThemeColor[256];
if (m_themeHelper.GetCurrentThemeName(szwThemeFile,
ARRSIZE(szwThemeFile), szwThemeColor,
ARRSIZE(szwThemeColor), NULL, 0) != S_OK)
return NULL;
WCHAR *p;
if ((p = wcsrchr(szwThemeFile, L'\\')) == NULL)
0, .
, .
if (pceltFetched != NULL)
*pceltFetched++;
" " (*ptr)++. , ,
, ,
.
HRESULT hr = pNSC->AddPortMapping(
riPortRule.m_strRuleName.AllocSysString(), riPortRule.m_byProtocol,
riPortRule.m_nPortNumber, riPortRule.m_nPortNumber, 0, L"127.0.0.1",
ICSTT_IPADDRESS, &pNSPM);
, .
. ,
. ,
? , ,
.
Visual Studio: warning C6314: Incorrect order of operations: bitwiseor has higher precedence than the conditional-expression operator.
Add parentheses to clarify intent. c:\emuleplus\searchlistctrl.cpp 659
searchlistctrl.cpp 659
menuSearchFile.AppendMenu( MF_STRING |
((iSelectionMark != -1) && (dwSelectedCount > 0) &&
g_App.m_pServerConnect->IsConnected() &&
((pCurServer = g_App.m_pServerConnect->GetCurrentServer())!= NULL)&&
(pCurServer->GetTCPFlags() & SRV_TCPFLG_RELATEDSEARCH)) ?
MF_ENABLED : MF_GRAYED, MP_SEARCHRELATED,
GetResString(IDS_SEARCHRELATED));
(- ) .
... (
), ? ,
" ".
CFontPreviewCombo::CFontPreviewCombo()
{
...
m_clrSample = GetSysColor(COLOR_WINDOWTEXT);
m_clrSample = RGB(60,0,0);
...
}
, RGB(60,0,0) .
Pixie
Visual Studio 18. 0.
PVS-Studio 65. 5.
PVS-Studio: V519 The 'numRays' object is assigned values twice
successively. Perhaps this is a mistake. bundles.cpp 579
void CGatherBundle::post() {
numRays = last;
numRays = 0;
last = 0;
depth++;
}
, , numRays ,
. ? ? . !
quadrics.cpp 880
inline
void
triangulatePolygon(...) {
...
for (i=1;i<nloops;i++) {
...
do {
...
do {
...
CTriVertex
*snVertex
(CTriVertex *)
alloca(2*sizeof(CTriVertex));
...
} while(dVertex != loops[0]);
...
} while(sVertex != loops[i]);
...
}
...
}
- alloca .
VirtualDub
Visual Studio 24. 0.
PVS-Studio 41. 2.
wint_t lexgetescape() {
wint_t c = lexgetc();
if (c < 0)
fatal("Newline found in escape sequence");
...
}
, false.
struct ConvoluteFilterData {
long m[9];
long bias;
void *dyna_func;
DWORD dyna_size;
DWORD dyna_old_protect;
BOOL fClip;
};
WinMerge
Visual Studio 343. 3.
PVS-Studio 69. 12.
Visual Studio: warning C6313: Incorrect operator: zero-valued flag
cannot be tested with bitwise-and. Use an equality test to check for
zero-valued flags. c:\winmerge\src\bcmenu.cpp 1489
else if (nFlags&MF_STRING){
ASSERT(!(nFlags&MF_OWNERDRAW));
ModifyMenu(pos,nFlags,nID,mdata->GetString());
}
. , , " ".
Visual Studio: warning C6287: Redundant code: the left and right
sub-expressions are identical.
c:\winmerge\src\editlib\ccrystaleditview.cpp 1560
bool
isclosebrace (TCHAR c)
{
return c == _T ('}') || c == _T ('}') || c == _T (']')
|| c == _T ('>');
}
. ? "Copy-paste-technology", ,
.
Visual Studio: warning C6287: Redundant code: the left and right
sub-expressions are identical. c:\winmerge\src\mergedoc.cpp 1165
if ((m_nBufferType[nBuffer] == BUFFER_UNNAMED) ||
(m_nBufferType[nBuffer] == BUFFER_UNNAMED))
nSaveErrorCode = SAVE_NO_FILENAME;
. , , - -.
ccrystaltextview.cpp 1646
TCHAR ch = strText[i];
switch (ch)
{
case 0xB7:
case 0xBB:
strHTML += ch;
strHTML += _T("<wbr>");
bLastCharSpace = FALSE;
nNonbreakChars = 0;
break;
, . case ,
. . TCHAR
char.
if(IsLunaMenuStyle())
if(!xp_space_accelerators)return;
else
if(!original_space_accelerators)return;
, , , if else? ?
?
enum output_style {}
...
switch (m_options.m_outputStyle)
{
case OUTPUT_CONTEXT:
enum switch. ? ?
pCmdUI->Enable(FALSE);
}
if (pView1->GetTextBufferEol(line) !=
pView1->GetTextBufferEol(line))
{
, ... ? , pView2.
void VariantValue::Clear()
{
m_vtype = VT_NULL;
m_bvalue = false;
m_ivalue = 0;
m_fvalue = 0;
m_svalue.empty();
m_tvalue = 0;
}
empty() .
PVS-Studio: V510
if (src[k]=='>')
break;
}
...
}
. Access Violation.
'>' 'srclen'
. 'i', 'k'.
'>' , .
XUIFramework
Visual Studio 93. 2.
PVS-Studio 30. 5.
delete delete[]. . ,
. .
m_xSt = CST_RESIZE;
m_xSt = CST_RESIZE;
, m_ySt. - , ?
if (enuHAlign == Center)
enuHAlign == Midle. if (enuVAlign == Middle),
Center. enum, .
HDWP CItemCtrl::OnSize(...)
{
...
if (m_styTop == CST_ZOOM ||
m_styTop == CST_ZOOM ||
m_styBottom == CST_DELTA_ZOOM ||
m_styBottom == CST_DELTA_ZOOM)
...
}
, :
HDWP CItemCtrl::OnSize(...)
{
...
if (m_styTop == CST_ZOOM ||
m_styTop == CST_DELTA_ZOOM ||
m_styBottom == CST_ZOOM ||
m_styBottom == CST_DELTA_ZOOM)
...
}
. -
, - .
1. , .
. http://www.viva64.com/ru/a/0071/.