Examples of errors detected by the V570 diagnostic
V570. Variable is assigned to itself.
Qt
V570 The 'transition->m_hasGetterSetterProperties' variable is assigned to itself. QtScript structure.cpp 512
PassRefPtr<Structure> Structure::
getterSetterTransition(Structure* structure)
{
....
RefPtr<Structure> transition =
create(structure->storedPrototype(), structure->typeInfo());
transition->m_propertyStorageCapacity =
structure->m_propertyStorageCapacity;
transition->m_hasGetterSetterProperties = // <=
transition->m_hasGetterSetterProperties;
transition->m_hasNonEnumerableProperties =
structure->m_hasNonEnumerableProperties;
transition->m_specificFunctionThrashCount =
structure->m_specificFunctionThrashCount;
....
}
A critical initialization error: transition->m_hasGetterSetterProperties = transition->m_hasGetterSetterProperties.
ReactOS
V570 The 'mii->cch' variable is assigned to itself. user32 menu.c 4347
BOOL WINAPI GetMenuItemInfoA(....)
{
....
mii->cch = mii->cch;
....
}
Looks like a misprint. The code should look like this: mii->cch = miiW->cch;
Quake-III-Arena
V570 The 'p->org[0]' variable is assigned to itself. cgame cg_marks.c 1267
void CG_ParticleSnowFlurry (qhandle_t pshader, centity_t *cent)
{
....
p->org[0] = p->org[0];
p->org[1] = p->org[1];
p->org[2] = p->org[2];
....
}
OpenCV
V570 The 'stereo.fundMatr[i]' variable is assigned to itself. calibfilter.cpp 339
typedef struct CvStereoCamera
{
....
float fundMatr[9]; /* fundamental matrix */
....
};
CvStereoCamera stereo;
void CvCalibFilter::Stop( bool calibrate )
{
....
for( i = 0; i < 9; i++ )
{
stereo.fundMatr[i] = stereo.fundMatr[i];
}
....
}
OpenCV
V570 The 'xyD[r]' variable is assigned to itself. test_imgwarp_strict.cpp 560
void CV_Resize_Test::resize_1d(....)
{
....
for (int r = 0; r < cn; ++r)
{
xyD[r] = 0;
for (int k = 0; k < ksize; ++k)
xyD[r] += w[k] * xyS[k * cn + r];
xyD[r] = xyD[r];
}
....
}
OpenCV
V570 The 'sizes[INPUT][0].height' variable is assigned to itself. test_math.cpp 1356
void Core_DetTest::get_test_array_types_and_sizes(....)
{
....
sizes[INPUT][0].width =
sizes[INPUT][0].height = sizes[INPUT][0].height;
....
}
ReactOS
V570 The 'pUserColorControl->dwFlags' variable is assigned to itself. gdientry.c 1029
DWORD WINAPI
DdGetDriverInfo(LPDDHAL_GETDRIVERINFODATA pData)
{
....
pUserColorControl->dwFlags = pUserColorControl->dwFlags;
....
}
Similar errors can be found in some other places:
- V570 The 'Irp->IoStatus.Information' variable is assigned to itself. hidclass.c 461
VirtualDub
V570 The 'this->hic' variable is assigned to itself. Riza w32videocodecpack.cpp 253
void VDVideoCompressorVCM::Start(const void *inputFormat,
uint32 inputFormatSize,
const void *outputFormat,
uint32 outputFormatSize,
const VDFraction& frameRate,
VDPosition frameCount)
{
this->hic = hic;
....
}
Coin3D
V570 The 'v0[0]' variable is assigned to itself. sotext3.cpp 1158
void
SoText3P::generate(....)
{
....
v0[0] = v0[0];
....
}
Similar errors can be found in some other places:
- V570 The 'v0[1]' variable is assigned to itself. sotext3.cpp 1159
- V570 The 'v1[0]' variable is assigned to itself. sotext3.cpp 1160
- V570 The 'v1[1]' variable is assigned to itself. sotext3.cpp 1161
- And 4 additional diagnostic messages.
CryEngine 3 SDK
V570 The 'modifiedSlopeNormal.z' variable is assigned to itself. playerstateground.cpp 227
void CPlayerStateGround::OnPrePhysicsUpdate(....)
{
....
modifiedSlopeNormal.z = modifiedSlopeNormal.z;
....
}
Unreal Engine 4
V570 The 'ResolveParams.CubeFace' variable is assigned to itself. rhi.h 1279
enum ECubeFace;
ECubeFace CubeFace;
friend FArchive& operator<<(
FArchive& Ar,FResolveParams& ResolveParams)
{
....
if(Ar.IsLoading())
{
ResolveParams.CubeFace = (ECubeFace)ResolveParams.CubeFace;
}
....
}
TortoiseGit
V570 The 'blame->path' variable is assigned to itself. blame.c 319
static int blame_internal(git_blame *blame)
{
....
blame->ent = ent;
blame->path = blame->path;
....
}
Chromium
V570 The 'tmp_rect.right' variable is assigned to itself. text_store.cc 320
STDMETHODIMP TextStore::GetTextExt(....) {
....
tmp_rect.right = tmp_rect.right;
....
}
OpenJPEG
V570 The 'p_stream->m_current_data' variable is assigned to itself. cio.c 675
OPJ_SIZE_T opj_stream_write_skip (
opj_stream_private_t * p_stream, ....)
{
....
if (!l_is_written)
{
p_stream->m_status |= opj_stream_e_error;
p_stream->m_bytes_in_buffer = 0;
p_stream->m_current_data = p_stream->m_current_data;
return (OPJ_SIZE_T) -1;
}
....
}
Linux Kernel
V570 The 'acx->window_size' variable is assigned to itself. acx.c 1728
int wl12xx_acx_config_hangover(struct wl1271 *wl)
{
....
acx->recover_time = cpu_to_le32(conf->recover_time);
acx->hangover_period = conf->hangover_period;
acx->dynamic_mode = conf->dynamic_mode;
acx->early_termination_mode = conf->early_termination_mode;
acx->max_period = conf->max_period;
acx->min_period = conf->min_period;
acx->increase_delta = conf->increase_delta;
acx->decrease_delta = conf->decrease_delta;
acx->quiet_time = conf->quiet_time;
acx->increase_time = conf->increase_time;
acx->window_size = acx->window_size; // <=
....
}
FreeCAD
V570 The 'this->quat[3]' variable is assigned to itself. rotation.cpp 260
Rotation & Rotation::invert(void)
{
this->quat[0] = -this->quat[0];
this->quat[1] = -this->quat[1];
this->quat[2] = -this->quat[2];
this->quat[3] = this->quat[3]; // <=
return *this;
}
GNU Octave
V570 The 'i' variable is assigned to itself. sparse.cc 144
template <class T>
void Sparse<T>::SparseRep::maybe_compress(bool remove_zeros)
{
....
octave_idx_type i = 0;
for (octave_idx_type j = 1; j <= ncols; j++)
{
octave_idx_type u = c[j];
for (i = i; i < u; i++) // <=
if (d[i] != T())
{
d[k] = d[i];
r[k++] = r[i];
}
c[j] = k;
}
....
}
Similar errors can be found in some other places:
- V570 The 'i' variable is assigned to itself. sparse.cc 967
FreeSWITCH
V570 The variable is assigned to itself. skypopen_protocol.c 1512
struct SkypopenHandles {
HWND win32_hInit_MainWindowHandle;
HWND win32_hGlobal_SkypeAPIWindowHandle;
....
};
LRESULT APIENTRY skypopen_present(...., WPARAM uiParam, ....)
{
....
if (!tech_pvt->SkypopenHandles.currentuserhandle) {
tech_pvt->SkypopenHandles.api_connected = 1;
tech_pvt->SkypopenHandles.win32_hGlobal_SkypeAPIWindowHandle =
(HWND) uiParam;
tech_pvt->SkypopenHandles.win32_hGlobal_SkypeAPIWindowHandle =
tech_pvt->SkypopenHandles.win32_hGlobal_SkypeAPIWindowHandle;
}
....
}
Unreal Engine 4
V570 The 'Position' variable is assigned to itself. drawelements.h 435
class FSlateDrawElement
{
....
FORCEINLINE void SetPosition(const FVector2D& InPosition)
{ Position = Position; }
....
FVector2D Position;
....
};
ChakraCore
V570 The 'this->isInlined' variable is assigned to itself. functioncodegenjittimedata.h 625
void SetupRecursiveInlineeChain(
Recycler *const recycler,
const ProfileId profiledCallSiteId)
{
if (!inlinees)
{
inlinees = RecyclerNewArrayZ(....);
}
inlinees[profiledCallSiteId] = this;
inlineeCount++;
this->isInlined = isInlined; // <=
}
Similar errors can be found in some other places:
- V570 The 'sym->m_isTaggableIntConst' variable is assigned to itself. linearscan.cpp 3170
FreeBSD Kernel
V570 The 'lenRecv' variable is assigned to itself. itdinit.c 271
osGLOBAL void
itdssGetOperatingOptionParams(....)
{
....
/* to remove compiler warnings */
pLastUsedChar = pLastUsedChar;
lenRecv = lenRecv;
subkey2 = subkey2;
subkey1 = subkey1;
key = key;
buffer = &tmpBuffer[0];
buffLen = sizeof (tmpBuffer);
....
}
Oracle VM Virtual Box
V570 The 'from->eval1D[i].u1' variable is assigned to itself. state_evaluators.c 1006
void
crStateEvaluatorDiff(CREvaluatorBits *e, CRbitvalue *bitID,
CRContext *fromCtx, CRContext *toCtx)
{
....
from->eval1D[i].order = to->eval1D[i].order;
from->eval1D[i].u1 = from->eval1D[i].u1; // <=
from->eval1D[i].u2 = from->eval1D[i].u2; // <=
....
}
Similar errors can be found in some other places:
- V570 The 'from->eval1D[i].u2' variable is assigned to itself. state_evaluators.c 1007
- V570 The 'from->eval2D[i].u1' variable is assigned to itself. state_evaluators.c 1042
- V570 The 'from->eval2D[i].u2' variable is assigned to itself. state_evaluators.c 1043
- And 2 additional diagnostic messages.
The GTK+ Project
V570 The 'tmp_info' variable is assigned to itself. gtkimcontextxim.c 442
static GtkXIMInfo *
get_im (....)
{
....
GtkXIMInfo *info;
....
info = NULL;
tmp_list = open_ims;
while (tmp_list)
{
....
else
{
tmp_info = tmp_info; // <=
break;
}
....
}
if (info == NULL)
{
....
}
....
}
ReactOS
V570 The 'idButton' variable is assigned to itself. mainwindow.cpp 546
LRESULT CDeviceManager::OnNotify(_In_ LPARAM lParam)
{
....
UINT_PTR idButton = lpttt->hdr.idFrom;
switch (idButton)
{
....
}
idButton = idButton; // <=
....
}
Open X-Ray Engine
V570 The 'value[0]' variable is assigned to itself. compiler_cover.cpp 260
void compute_cover_value (....)
{
....
float value [8];
....
if (value[0] < .999f) {
value[0] = value[0];
}
....
}
CryEngine V
V570 The 'runtimeData.entityId' variable is assigned to itself. behaviortreenodes_ai.cpp 1771
void ExecuteEnterScript(RuntimeData& runtimeData)
{
ExecuteScript(m_enterScriptFunction, runtimeData.entityId);
runtimeData.entityId = runtimeData.entityId; // <=
runtimeData.executeExitScriptIfDestructed = true;
}
Steinberg SDKs
V570 The same value is assigned twice to the 'lpf' variable. mdaComboProcessor.cpp 274
void ComboProcessor::recalculate ()
{
....
case 4: trim = 0.96f; lpf = filterFreq(1685.f);
mix1 = -0.85f; mix2 = 0.41f;
del1 = int (getSampleRate () / 6546.f);
del2 = int (getSampleRate () / 3315.f);
break;
case 5: trim = 0.59f; lpf = lpf = filterFreq(2795.f); // <=
mix1 = -0.29f; mix2 = 0.38f;
del1 = int (getSampleRate () / 982.f);
del2 = int (getSampleRate () / 2402.f);
hpf = filterFreq(459.f);
break;
....
}
Amazon Lumberyard
V570 The 'behaviorParams.ignoreOnVehicleDestroyed' variable is assigned to itself. vehiclecomponent.cpp 168
bool CVehicleComponent::Init(....)
{
....
if (!damageBehaviorTable.getAttr(....)
{
behaviorParams.ignoreOnVehicleDestroyed = false;
}
else
{
behaviorParams.ignoreOnVehicleDestroyed = // <=
behaviorParams.ignoreOnVehicleDestroyed; // <=
}
....
}
bValue = !bValue
Azure Service Fabric
V570 The 'statusDetails_' variable is assigned to itself. ComposeDeploymentStatusQueryResult.cpp 49
ComposeDeploymentStatusQueryResult &
ComposeDeploymentStatusQueryResult::operator = (
ComposeDeploymentStatusQueryResult && other) // <=
{
if (this != & other)
{
deploymentName_ = move(other.deploymentName_);
applicationName_ = move(other.applicationName_);
dockerComposeDeploymentStatus_ = move(other....);
statusDetails_ = move(statusDetails_); // <=
}
return *this;
}
Vangers: One For The Road
V570 The same value is assigned twice to the 'ExternalSensor' variable. mechos.cpp 5828
struct VangerUnit : TrackUnit, uvsUnitType, aiFactorType
{
....
int ExternalMode, ExternalTime, ExternalLock,
ExternalDraw, ExternalAngle;
int ExternalTime2;
SensorDataType *ExternalObject;
SensorDataType *ExternalLastSensor;
SensorDataType *ExternalSensor;
int RandomUpdate;
....
};
void VangerUnit::CreateVangerUnit(void)
{
....
DoorFlag = 0;
ExternalMode = EXTERNAL_MODE_NORMAL;
ExternalTime = 0;
ExternalLock = 0;
ExternalDraw = 1;
ExternalObject = ExternalSensor = ExternalSensor = NULL; // <=
ExternalTime2 = 0;
ExternalAngle = 0;
Go2World();
....
};
Similar errors can be found in some other places:
- V570 The same value is assigned twice to the 'ExternalSensor' variable. mechos.cpp 13967
0 A.D.
V570 The 'ptr' variable is assigned to itself. FUTracker.h 122
FUTrackedPtr(ObjectClass* _ptr = NULL) : ptr(_ptr)
{
if (ptr != NULL) FUTracker::TrackObject((FUTrackable*) ptr);
ptr = ptr;
}
NCBI Genome Workbench
V570 The 'm_onClickFunction' variable is assigned to itself. alngraphic.hpp 103
void SetOnClickFunctionName(string onClickFunction) {
m_onClickFunction = m_onClickFunction;
}
Similar errors can be found in some other places:
- V570 The 'iter->level' variable is assigned to itself. align_format_util.cpp 189
- V570 The 'd_elements_values[ind]' variable is assigned to itself. sls_alp_data.cpp 1416
LLVM/Clang
V570 The 'Identifier->Type' variable is assigned to itself. FormatTokenLexer.cpp 249
bool FormatTokenLexer::tryMergeCSharpNullConditionals() {
....
auto &Identifier = *(Tokens.end() - 2);
auto &Question = *(Tokens.end() - 1);
....
Identifier->ColumnWidth += Question->ColumnWidth;
Identifier->Type = Identifier->Type; // <=
Tokens.erase(Tokens.end() - 1);
return true;
}
Haiku Operation System
V570 The 'wPipeIndex' variable is assigned to itself. CEchoGals_transport.cpp 244
ECHOSTATUS CEchoGals::CloseAudio (....)
{
....
wPipeIndex = wPipeIndex;
m_ProcessId[ wPipeIndex ] = NULL;
m_Pipes[ wPipeIndex ].wInterleave = 0;
....
}
Heawei Ark Compiler
V570 The 'theDoubleVal' variable is assigned to itself. lexer.cpp 283
int64 theIntVal = 0;
float theFloatVal = 0.0;
double theDoubleVal = 0.0;
TokenKind MIRLexer
::GetFloatConst(uint32 valStart, uint32 startIdx, bool negative) {
....
theIntVal = static_cast<int>(theFloatVal);
theDoubleVal = static_cast<double>(theDoubleVal); // <=
if (theFloatVal == -0) {
theDoubleVal = -theDoubleVal;
}
....
}
GCC
V570 The 'ctx->outer_reduction_clauses' variable is assigned to itself. omp-low.c 935
static omp_context *
new_omp_context (gimple *stmt, omp_context *outer_ctx)
{
omp_context *ctx = XCNEW (omp_context);
splay_tree_insert (all_contexts, (splay_tree_key) stmt,
(splay_tree_value) ctx);
ctx->stmt = stmt;
if (outer_ctx)
{
ctx->outer = outer_ctx;
ctx->cb = outer_ctx->cb;
ctx->cb.block = NULL;
ctx->local_reduction_clauses = NULL;
ctx->outer_reduction_clauses = ctx->outer_reduction_clauses; // <=
ctx->depth = outer_ctx->depth + 1;
}
....
}
Command & Conquer
V570 The 'hdr->MagicNumber' variable is assigned to itself. COMBUF.CPP 806
struct CommHdr {
unsigned short MagicNumber;
unsigned char Code;
unsigned long PacketID;
} *hdr;
void CommBufferClass::Mono_Debug_Print(int refresh)
{
....
hdr = (CommHdr *)SendQueue[i].Buffer;
hdr->MagicNumber = hdr->MagicNumber;
hdr->Code = hdr->Code;
....
}
Similar errors can be found in some other places:
- V570 The 'hdr->Code' variable is assigned to itself. COMBUF.CPP 807
- V570 The 'hdr->MagicNumber' variable is assigned to itself. COMBUF.CPP 931
- V570 The 'hdr->Code' variable is assigned to itself. COMBUF.CPP 932
- And 10 additional diagnostic messages.
Storm Engine
V570 The 'Data_num' variable is assigned to itself. s_stack.cpp 36
uint32_t Data_num;
....
DATA *S_STACK::Push(....)
{
if (Data_num > 1000)
{
Data_num = Data_num;
}
....
}
TheXTech
V570 The 'NPC[A].Location.X' variable is assigned to itself. thextech npc_hit.cpp 1995
else
{
NPC[A].Location.Y = NPC[A].Location.Y + NPC[A].Location.Height;
NPC[A].Location.X = NPC[A].Location.X; // - (32 - .Location.Width) / 2
....
}
Ogre3D
V570 Variable is assigned to itself. OgreETCCodec.cpp 242
bool ETCCodec::decodePKM(const DataStreamPtr& stream,
DecodeResult& result) const
{
// ....
void *destPtr = output->getPtr();
stream->read(destPtr, imgData->size);
destPtr = static_cast<void*>(static_cast<uchar*>(destPtr)); // <=
// ....
}
The destPtr pointer is cast to another pointer type, then to its own type, and is assigned to itself. A very strange place. Perhaps this is an old code that the developers forgot to remove.
Captain Blood
V570 [CWE-480] The 'ldMaxChars' variable is assigned to itself. StringAttr.cpp 198
void StringAttribute::LoadFromFile (....)
{
int ldMinChars, ldMaxChars;
// ....
minChars = ldMinChars;
ldMaxChars = ldMaxChars;
// ....
}
class StringAttribute : public BaseAttribute
{
int minChars;
int maxChars;
}