:
: 23.05.2011
. , Chromium. Chromium -
, PVS-Studio.
Chromium - - , Google
. Chromium Google Chrome. Chromium
Google Chrome, .
Chromium - (solution), 473 .
C/C++ 460 .
.
460 . ,
155 . , .
. Chromium
Chromium. ,
.
Chromium ,
PVS-Studio. Chromium
, . PVS-Studio ,
++ .
Chromium .
,
:
int XX[] = { 1, 2, 3, 4 };
size_t N = sizeof(XX) / sizeof(XX[0]);
:
#define count_of(arg) (sizeof(arg) / sizeof(arg[0]))
. , ,
. ,
, .
:
void Test(int C[3])
{
int A[3];
int *B = Foo();
size_t x = count_of(A); // Ok
x = count_of(B); // Error
x = count_of(C); // Error
}
count_of(A) A,
.
count_of() ,
. ,
count_of(B). .
, .
Miranda IM:
#define SIZEOF(X) (sizeof(X)/sizeof(X[0]))
int Cache_GetLineText(..., LPTSTR text, int text_size, ...)
{
...
tmi.printDateTime(pdnce->hTimeZone, _T("t"), text, SIZEOF(text), 0);
...
}
. , ,
:
++, 'C' ,
.
.
, ,
. :
void Test(int (&C)[3])
{
x = count_of(C); // Ok
}
count_of(C) 3.
Chromium. ,
. :
template <typename T, size_t N>
char (&ArraySizeHelper(T (&array)[N]))[N];
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
. ArraySizeHelper
N.
N, 'char'. ,
. sizeof() ArraySizeHelper.
'arraysize' ArraySizeHelper .
, .
, , .
, 'count_of()'. ArraySizeHelper
, .
:
template <typename T, size_t N>
char (&ArraySizeHelper(T (&array)[N]))[N];
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
V502
expected. The '?:' operator has a lower priority than the '-'
operator.
views
custom_frame_view.cc
400
, .
V547
is never < 0.
ncdecode_tablegen
ncdecode_tablegen.c
197
common
84
VisitedLinkCommon::Fingerprint
VisitedLinkCommon::ComputeURLFingerprint(
...
const uint8 salt[LINK_SALT_LENGTH])
{
...
MD5Update(&ctx, salt, sizeof(salt));
...
}
MD5Update() , .
? - .
-
.
:
:
V501
chromoting_jingle_glue
iq_request.cc
248
:
V530
chrome_frame_npapi
np_proxy_service.cc
293
:
V522
chrome_frame_npapi
517
bool ChromeFrameNPAPI::Invoke(...)
{
ChromeFrameNPAPI* plugin_instance =
ChromeFrameInstanceFromNPObject(header);
if (!plugin_instance && (plugin_instance->automation_client_.get()))
return false;
...
}
, :
V547
browser
idle_win.cc
23
// Will go -ve if we have been idle for a long time (2gb seconds).
if (current_idle_time < 0)
current_idle_time = INT_MAX;
...
}
, . , .
, Chromium. :
V554
interactive_ui_tests
306
, Chromium.
, Chromium.
. , ,
. ( ICU):
V547 Expression '* string != 0 || * string != '_'' is always true.
Probably the '&&' operator should be used here.
icui18n ucol_sit.cpp
242
*status = U_BUFFER_OVERFLOW_ERROR;
}
...
}
"(*string != 0 || *string != '_')" . : (*string == 0 ||
*string == '_').
PVS-Studio . Chromium - ,
. Chromium. ,
, . ,
460 , , ,
.
P.S.
: Chromium ? ,
. ,
. Chromium Miranda IM Ultimate Toolbox.
,
. .
Chromium, ,
. ,
PVS-Studio. Google
.
P.P.S.
, . , FlylinkDC++.
.