Примеры ошибок, обнаруженных с помощью диагностики V583
V583. The '?:' operator, regardless of its conditional expression, always returns the same value.
MAME
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: ",(%d,". 9900dasm.c 670
unsigned Dasm9900 (char *buffer, unsigned pc, int model_id,
const UINT8 *oprom, const UINT8 *opram)
{
....
buffer += sprintf(buffer,
bit_position ? ",(%d," : ",(%d,", bit_position);
....
}
Scilab
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: "createComplexSparseMatrixInList". api_list.cpp 2398
static SciErr fillCommonSparseMatrixInList(....)
{
....
addErrorMessage(&sciErr, API_ERROR_FILL_SPARSE_IN_LIST,
_("%s: Unable to create list item #%d in Scilab memory"),
_iComplex ? "createComplexSparseMatrixInList" :
"createComplexSparseMatrixInList",
_iItemPos + 1);
....
}
Similar errors can be found in some other places:
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: "createComplexSparseMatrixInList". api_list.cpp 2411
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: "createComplexSparseMatrixInList". api_list.cpp 2418
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: "createComplexSparseMatrixInList". api_list.cpp 2464
- And 1 additional diagnostic messages.
Cocos2d-x
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: ATLAS_REPEAT. atlas.cpp 219
spAtlas* spAtlas_readAtlas (....)
{
....
page->uWrap = *str.begin == 'x' ? ATLAS_REPEAT :
(*str.begin == 'y' ? ATLAS_CLAMPTOEDGE : ATLAS_REPEAT);
page->vWrap = *str.begin == 'x' ? ATLAS_CLAMPTOEDGE :
(*str.begin == 'y' ? ATLAS_REPEAT : ATLAS_REPEAT); // <=
....
}
Oracle VM Virtual Box
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: g_acDaysInMonthsLeap[pTime->u8Month - 1]. time.cpp 453
static const uint8_t g_acDaysInMonths[12] =
{
/*Jan Feb Mar Arp May Jun Jul Aug Sep Oct Nov Dec */
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
static const uint8_t g_acDaysInMonthsLeap[12] =
{
/*Jan Feb Mar Arp May Jun Jul Aug Sep Oct Nov Dec */
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
static PRTTIME rtTimeNormalizeInternal(PRTTIME pTime)
{
....
unsigned cDaysInMonth = fLeapYear
? g_acDaysInMonthsLeap[pTime->u8Month - 1] // <=
: g_acDaysInMonthsLeap[pTime->u8Month - 1]; // <=
....
}
Miranda NG
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: urc->dlgNewSize.cy - si->iSplitterY. TabSRMM window.cpp 473
static int RoomWndResize(...., UTILRESIZECONTROL *urc)
{
....
urc->rcItem.top = (bToolbar && !bBottomToolbar) ?
urc->dlgNewSize.cy - si->iSplitterY :
urc->dlgNewSize.cy - si->iSplitterY;
....
}
Similar errors can be found in some other places:
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: 1. TabSRMM tools.cpp 301
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: 9. TabSRMM msglog.cpp 367
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: 2. TabSRMM themes.cpp 2287
- And 8 additional diagnostic messages.
Spring Engine
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: player.cpuUsage. engine-dedicated%engine-headless%engine-legacy gameserver.cpp 902
void CGameServer::LagProtection()
{
....
const float playerCpuUsage =
player.isLocal ? player.cpuUsage : player.cpuUsage; // <=
....
}
Haiku Operation System
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value. impactv.c 520
void Radeon_CalcImpacTVRegisters(....)
{
....
values->tv_hstart =
internal_encoder ?
values->tv_hdisp + 1 - params->mode888 + 12 :
values->tv_hdisp + 1 - params->mode888 + 12;
....
}
Telegram
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: 12. Telegram window.cpp 1607
void Window::placeSmallCounter(.... int size, int count, ....)
{
....
QString cnt = (count < 100) ? QString("%1").arg(count) :
QString("..%1").arg(
count % 10, 1, 10, QChar('0'));
int32 cntSize = cnt.size();
....
int32 fontSize;
if (size == 16) {
fontSize = 8;
} else if (size == 32) {
fontSize = (cntSize < 2) ? 12 : 12;
} else {
fontSize = (cntSize < 2) ? 22 : 22;
}
....
}
FreeBSD Kernel
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: td->td_name. subr_turnstile.c 1029
static void
print_thread(struct thread *td, const char *prefix)
{
db_printf("%s%p (tid %d, pid %d, ....", prefix, td, td->td_tid,
td->td_proc->p_pid, td->td_name[0] != '\0' ? td->td_name :
td->td_name);
}
Similar errors can be found in some other places:
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: td->td_name. subr_turnstile.c 1112
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: td->td_name. subr_turnstile.c 1196
CryEngine V
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: -1.8f. posealignerc3.cpp 330
ILINE bool InitializePoseAlignerPinger(....)
{
....
chainDesc.offsetMin = Vec3(0.0f, 0.0f, bIsMP ? -1.8f : -1.8f);
chainDesc.offsetMax = Vec3(0.0f, 0.0f, bIsMP ? +0.75f : +1.f);
....
}
Similar errors can be found in some other places:
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: -1.8f. posealignerc3.cpp 313
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: -2.f. posealignerc3.cpp 347
- V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: D3D11_RTV_DIMENSION_TEXTURE2DARRAY. d3dtexture.cpp 2277
- And 3 additional diagnostic messages.
ReOpenLDAP
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: "vlvResult". common.c 2119
static int
print_vlv(....)
{
....
tool_write_ldif( ldif ? LDIF_PUT_COMMENT : LDIF_PUT_VALUE,
ldif ? "vlvResult" : "vlvResult", buf, rc ); // <=
}
....
}
Chromium
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: 1. configurator_impl.cc 133
int ConfiguratorImpl::StepDelay() const
{
return fast_update_ ? 1 : 1;
}
CMaNGOS
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: SAY_BELNISTRASZ_AGGRO_1. razorfen_downs.cpp 104
void AttackedBy(Unit* pAttacker) override
{
....
if (!m_bAggro)
{
DoScriptText(urand(0, 1) ?
SAY_BELNISTRASZ_AGGRO_1 : // <=
SAY_BELNISTRASZ_AGGRO_1, // <=
m_creature, pAttacker);
m_bAggro = true;
}
....
}
Audacity
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: true. TimeTrack.cpp 296
void TimeTrack::WriteXML(XMLWriter &xmlFile) const
{
....
// MB: so why don't we just call Invalidate()? :)
mRuler->SetFlip(GetHeight() > 75 ? true : true);
....
}
V8 JavaScript Engine
V583 CWE-783 The '?:' operator, regardless of its conditional expression, always returns one and the same value: "<RemoteObject>". objects.cc 2993
void JSObject::JSObjectShortPrint(StringStream* accumulator) {
....
accumulator->Add(global_object ? "<RemoteObject>" :
"<RemoteObject>");
....
}
Most likely, there's some sort of a typo.
TDLib
V583 CWE-783 The '?:' operator, regardless of its conditional expression, always returns one and the same value: get_file_node(y_file_id). filemanager.cpp 871
Result<FileId> FileManager::merge(FileId x_file_id,
FileId y_file_id,
bool no_sync)
{
....
FileNodePtr x_node = no_sync ? get_file_node(x_file_id) :
get_sync_file_node(x_file_id);
....
FileNodePtr y_node = no_sync ? get_file_node(y_file_id) :
get_file_node(y_file_id); // <=
....
}
Krita
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: d->paragraphStylesDotXmlStyles.values(). KoTextSharedLoadingData.cpp 594
QList<KoParagraphStyle *>
KoTextSharedLoadingData::paragraphStyles(bool stylesDotXml) const
{
return stylesDotXml ?
d->paragraphStylesDotXmlStyles.values() :
d->paragraphStylesDotXmlStyles.values(); // <=
}
Krita
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: qFloor(axis). kis_transform_worker.cc 456
void mirror_impl(KisPaintDeviceSP dev,
qreal axis,
bool isHorizontal)
{
....
int leftCenterPoint = qFloor(axis) < axis ?
qFloor(axis) : qFloor(axis); // <=
int leftEnd = qMin(leftCenterPoint, rightEnd);
int rightCenterPoint = qFloor(axis) < axis ?
qCeil(axis) : qFloor(axis);
int rightStart = qMax(rightCenterPoint, leftStart);
....
}
Vangers: One For The Road
V583 CWE-783 The '?:' operator, regardless of its conditional expression, always returns one and the same value. iextern.cpp 2461
const char* iGetJoyBtnNameText(int vkey,int lang)
{
const char *ret;
if (vkey & VK_BUTTON)
{
if (vkey >= VK_BUTTON_1 && vkey <= VK_BUTTON_32)
{
ret = (lang)
? iJoystickButtons2[vkey - VK_BUTTON_1]
: iJoystickButtons1[vkey - VK_BUTTON_1];
return ret;
}
else
return NULL; //WARNING NEED VIEW!!!
}
if (vkey & VK_STICK_SWITCH)
{
if (vkey >= VK_STICK_SWITCH_1 && vkey <= VK_STICK_SWITCH_9)
{
ret = (lang)
? iJoystickStickSwitch2[vkey - VK_STICK_SWITCH_1] // <=
: iJoystickStickSwitch2[vkey - VK_STICK_SWITCH_1]; // <=
return ret;
}
else
return NULL; //WARNING NEED VIEW!!!
}
return NULL; //WARNING NEED VIEW!!!
}
Haiku Operation System
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: 500000. usb_modeswitch.cpp 361
static status_t
my_transfer_data(....)
{
....
do {
bigtime_t timeout = directionIn ? 500000 : 500000;
result = acquire_sem_etc(device->notify, 1, B_RELATIVE_TIMEOUT, timeout);
....
} while (result == B_INTERRUPTED);
....
}
Command & Conquer
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value: 3072. STARTUP.CPP 1136
void Read_Setup_Options( RawFileClass *config_file )
{
....
ScreenHeight = ini.Get_Bool("Options", "Resolution", false) ? 3072 : 3072;
....
}
DuckStation
V583 The '?:' operator, regardless of its conditional expression, always returns one and the same value. gamelistmodel.cpp 415
bool GameListModel::lessThan(...., int column, bool ascending) const
{
....
const GameListEntry& left = m_game_list->GetEntries()[left_row];
const GameListEntry& right = m_game_list->GetEntries()[right_row];
....
switch(column)
{
case Column_Type:
{
....
return ascending ?
(static_cast<int>(left.type)
< static_cast<int>(right.type))
:
(static_cast<int>(right.type)
> static_cast<int>(left.type));
}
}
....
}
Captain Blood
V583 [CWE-783] The '?:' operator, regardless of its conditional expression, always returns one and the same value: 0xffff0000. NoFatality.cpp 63
void _cdecl NoFatality::Draw(float dltTime, long level)
{
//....
for (....)
{
Render().DrawBox(...., IsActive() ? 0xffff0000 : 0xffff0000);
}
//....
}