Examples of errors detected by the V571 diagnostic

V571. Recurring check. This condition was already verified in previous line.


Qt

V571 Recurring check. The 'if (endian == DetectEndianness)' condition was already verified in line 470. bootstrap qutfcodec.cpp 471


QString QUtf32::convertToUnicode(....)
{
  ...
  if (endian == DetectEndianness) {
    if (endian == DetectEndianness) {
  ...
}

Just an odd double check.


Energy Checker SDK

V571 Recurring check. The 'if (ret == PL_FAILURE)' condition was already verified in line 1008. pl_csv_logger pl_csv_logger.c 1009


int main(int argc, char *argv[]) {
  ...
  if(ret == PL_FAILURE) {
    if(ret == PL_FAILURE) {
      pl_csv_logger_error(
        PL_CSV_LOGGER_ERROR_UNABLE_TO_READ_PL
    );
  ...
}

IPP Samples

V571 Recurring check. The 'if (x < 0)' condition was already verified in line 1025. 3d-viewer rrdemosupport.cpp 1026

V571 Recurring check. The 'if (y < 0)' condition was already verified in line 1028. 3d-viewer rrdemosupport.cpp 1029


void rrGetNextBunch_Spiral(....)
{
  int x,y;
  ...
  if(x < 0)
    if(x < 0)  goto _begine;
  ...
  if(y < 0)
    if(y < 0)  goto _begine;
  ...
}

Notepad++

V571 Recurring check. The 'if (_hTab == hTabOld)' condition was already verified in line 478. Notepad++ gripper.cpp 485


void Gripper::doTabReordering(POINT pt)
{
  ...
  else if (_hTab == hTabOld)
  {
    /* delete item on switch between tabs */
    ::SendMessage(_hTab, TCM_DELETEITEM, iItemOld, 0);
  }
  else
  {
    if (_hTab == hTabOld)
    {
      /* delete item on switch between tabs */
      ::SendMessage(_hTab, TCM_DELETEITEM, iItemOld, 0);
    }
  }
  ...
}

Blender

V571 Recurring check. The 'if (agrp == ((void *) 0))' condition was already verified in line 1108. bf_blenkernel ipo.c 1110


static void fcurve_add_to_list (....)
{
  ...
  if (agrp == NULL) {
    if (agrp == NULL) {
  ...
}

Multi Theft Auto

V571 Recurring check. The 'if (pNode)' condition was already verified in line 162. cluafunctiondefs.xml.cpp 164


int CLuaFunctionDefs::XMLNodeGetName ( lua_State* luaVM )
{
  CXMLNode* pNode = NULL;
  CScriptArgReader argStream ( luaVM );
  argStream.ReadUserData ( pNode );

  if ( !argStream.HasErrors ( ) )
  {
    if ( pNode )
    {
      if ( pNode )
      {
        lua_pushstring (
          luaVM, pNode->GetTagName ().c_str () );
        return 1;
      }
    }
  }
  else
    m_pScriptDebugging->LogCustom (
      luaVM, argStream.GetFullErrorMessage() );

  lua_pushboolean ( luaVM, false );
  return 1;
}

SeqAn

V571 Recurring check. The 'rBegin < insPos' condition was already verified in line 2073. store_all.h 2079


void convertMatchesToGlobalAlignment(....)
{
  ....
  TContigPos rBegin = _min((*j).beginPos, (*j).endPos);
  TContigPos rEnd = _max((*j).beginPos, (*j).endPos);
  if (rBegin < insPos && insPos < rEnd)
  {
    if (rBegin < insPos)
    {
      TReadGaps gaps(....);
      insertGap(gaps, insPos - rBegin);
    } else
    {
      if ((*j).beginPos < (*j).endPos)
        ++(*j).beginPos;
      else
        ++(*j).endPos;
    }
  ....
}

Identical errors can be found in some other places:

  • V571 Recurring check. The 'rBegin < insPos' condition was already verified in line 2260. store_all.h 2262

CryEngine 3 SDK

V571 Recurring check. The 'if (pos == npos)' condition was already verified in line 1447. crystring.h 1453


inline typename CryStringT<T>::size_type
CryStringT<T>::rfind( value_type ch,size_type pos ) const
{
  const_str str;
  if (pos == npos) {
    ....
  } else {
    if (pos == npos)
      pos = length();
  ....
}

Identical errors can be found in some other places:

  • V571 Recurring check. The 'if (pos == npos)' condition was already verified in line 1291. cryfixedstring.h 1297

Micro-Manager

V571 Recurring check. The 'if (ret != 0)' condition was already verified in line 5806. Piezosystem_dDrive.cpp 5807


int XYStage::OnTriggerEndX(MM::PropertyBase* pProp,
                           MM::ActionType eAct){
  if (eAct == MM::BeforeGet)
  {
    int ret = GetCommandValue("trgse",xChannel_,chx_.trgse_);
    if (ret!=DEVICE_OK)
    if (ret!=DEVICE_OK)
      return ret;
  .....
}

No trouble. Superfluous check.

Identical errors can be found in some other places:

  • V571 Recurring check. The 'if (ret != 0)' condition was already verified in line 5824. Piezosystem_dDrive.cpp 5825
  • V571 Recurring check. The 'if (ret != 0)' condition was already verified in line 9073. Piezosystem_dDrive.cpp 9074
  • V571 Recurring check. The 'if (ret != 0)' condition was already verified in line 9091. Piezosystem_dDrive.cpp 9092
  • And 4 additional diagnostic messages.

Unreal Engine 4

V571 Recurring check. The 'if (BeamTD)' condition was already verified in line 1650. particlecomponents.cpp 1652


bool UParticleEmitter::CalculateMaxActiveParticleCount()
{
  ....
  UParticleModuleTypeDataBeam2* BeamTD = ....;

  if (BeamTD)
  {
    if (BeamTD)
    {
      bForceMaxCount = true;
      MaxCount = BeamTD->MaxBeamCount + 2;
    }
  }
  ....
}

Unreal Engine 4

V571 Recurring check. The 'Properties' condition was already verified in line 941. audiodevice.cpp 943


void FAudioDevice::RecurseIntoSoundClasses(....)
{
  ....
  if( ChildClass && Properties )
  {
    if (Properties)
    {
  ....
}

Qt

V571 Recurring check. The 'if (QWindowsContext::verboseFonts)' condition was already verified in line 369. qwindowsfontengine.cpp 370


QWindowsFontEngine::~QWindowsFontEngine()
{
  ....
  if (QWindowsContext::verboseFonts)
    if (QWindowsContext::verboseFonts)
      qDebug("%s: font='%s", __FUNCTION__, qPrintable(_name));
  ....
}

Asterisk

V571 Recurring check. The 'wizard->wizard->retrieve_fields' condition was already verified in line 1520. sorcery.c 1521


void *ast_sorcery_retrieve_by_fields(....)
{
  ....
  if ((flags & AST_RETRIEVE_FLAG_MULTIPLE)) {
  ....
  } else if (fields && wizard->wizard->retrieve_fields) {  // <=
      if (wizard->wizard->retrieve_fields) {               // <=
        object = wizard->wizard->retrieve_fields(....);
      }
  }
}

Miranda NG

V571 Recurring check. The 'if (m_pOnlyOneInstance == 0)' condition was already verified in line 24. MirFox mirfoxcommons_logger.h 25


getInstance() {
  //initialized always from one thread
  if (m_pOnlyOneInstance == NULL) {
    if (m_pOnlyOneInstance == NULL) {
      m_pOnlyOneInstance = new MFLogger();
    }
  }
  return m_pOnlyOneInstance;
}

Identical errors can be found in some other places:

  • V571 Recurring check. The 'if (m_pOnlyOneInstance == 0)' condition was already verified in line 148. MirFox mirfoxcommons_sharedmemory.h 149
  • V571 Recurring check. The 'if (m_pOnlyOneInstance == 0)' condition was already verified in line 61. MirFox mirfoxcommons_messagequeuebysm.h 62
  • V571 Recurring check. The 'if (m_pOnlyOneInstance == 0)' condition was already verified in line 33. MirFox mirandautils.h 34
  • And 1 additional diagnostic messages.

Spring Engine

V571 Recurring check. The 'if (0 == MatFilePtr)' condition was already verified in line 140. assimp ogrematerial.cpp 143


aiMaterial*
OgreImporter::LoadMaterial(const std::string MaterialName) const
{
  ....
  MatFilePtr=m_CurrentIOHandler->Open(MaterialFileName);
  if(NULL==MatFilePtr)
  {
    //try the default mat Library
    if(NULL==MatFilePtr)
    {
      MatFilePtr=m_CurrentIOHandler->Open(m_MaterialLibFilename);
      ....
    }
  }
  ....
}

.NET CoreCLR

V571 Recurring check. The 'if (moduleInfo[MSCORWKS].baseAddr == 0)' condition was already verified in line 749. sos util.cpp 751


struct ModuleInfo
{
  ULONG64 baseAddr;
  ULONG64 size;
  BOOL hasPdb;
};

HRESULT CheckEEDll()
{
  ....
  // Do we have clr.dll
  if (moduleInfo[MSCORWKS].baseAddr == 0)          // <=
  {
      if (moduleInfo[MSCORWKS].baseAddr == 0)      // <=
          g_ExtSymbols->GetModuleByModuleName (
             MAIN_CLR_MODULE_NAME_A,0,NULL,
             &moduleInfo[MSCORWKS].baseAddr);
      if (moduleInfo[MSCORWKS].baseAddr != 0 &&    // <=
          moduleInfo[MSCORWKS].hasPdb == FALSE)
      {
        ....
      }
      ....
  }
  ....
}

Unreal Engine 4

V571 Recurring check. The 'if (LocItem.MetadataObj.IsValid())' condition was already verified in line 427. generategatherarchivecommandlet.cpp 429


void UGenerateGatherArchiveCommandlet::ConditionSource(....)
{
  if( LocItem.MetadataObj.IsValid() )
  {
    if( LocItem.MetadataObj.IsValid() )
    {
      ConditionSourceMetadata( MakeShareable(....) );
    }
  }
}

Identical errors can be found in some other places:

  • V571 Recurring check. The 'if (MipInfo[i].MipData)' condition was already verified in line 4760. landscapeeditinterface.cpp 4762
  • V571 Recurring check. The 'if (BeamTD)' condition was already verified in line 1667. particlecomponents.cpp 1669
  • V571 Recurring check. The 'if (BeamTD)' condition was already verified in line 1667. particlecomponents.cpp 1669
  • And 5 additional diagnostic messages.

FreeBSD Kernel

V571 Recurring check. This condition was already verified in line 1946. sahw.c 1949


GLOBAL
bit32 siHDAMode_V(....)
{
  ....
  if( saRoot->memoryAllocated.agMemory[i].totalLength > biggest)
  {
    if(biggest < saRoot->memoryAllocated.agMemory[i].totalLength)
    {
      save = i;
      biggest = saRoot->memoryAllocated.agMemory[i].totalLength;
    }
  }
  ....
}

Identical errors can be found in some other places:

  • V571 Recurring check. This condition was already verified in line 1940. if_rl.c 1941

ReactOS

V571 Recurring check. The 'comp->nbStep == i + 1' condition was already verified in line 1649. pattern.c 1655


static int xmlStreamCompile(xmlPatternPtr comp) {
....
case XML_OP_ELEM:
  ....
  if ((comp->nbStep == i + 1) &&   // <=
      (flags & XML_STREAM_STEP_DESC))
  {
    if (comp->nbStep == i + 1) {   // <=
      stream->flags |= XML_STREAM_FINAL_IS_ANY_NODE;
    }
  }
....
}

PHP:Hypertext Preprocessor

V571 Recurring check. The 'if (!sapi_module.phpinfo_as_text)' condition was already verified in line 975. info.c 978


PHPAPI void php_print_info(int flag)
{
  ....
  if (!sapi_module.phpinfo_as_text) {
    php_info_print("<h1>Configuration</h1>\n");
  } else {
    SECTION("Configuration");
  }
  ....
}

PHP:Hypertext Preprocessor

V571 Recurring check. The 'if (!sapi_module.phpinfo_as_text)' condition was already verified in line 1058. info.c 1059


PHPAPI void php_print_info(int flag)
{
  ....
  if (!sapi_module.phpinfo_as_text) {
    SECTION("PHP License");
    ....
  }
  ....
}

7-Zip

V571 Recurring check. The 'if (Result != ((HRESULT) 0L))' condition was already verified in line 56. extractengine.cpp 58


void Process2()
{
  ....
  if (Result != S_OK)
  {
    if (Result != S_OK)
      ErrorMessage = kCantOpenArchive;
    return;
  }
  ....
}

Identical errors can be found in some other places:

  • V571 Recurring check. The '!quoteMode' condition was already verified in line 18. stringutils.cpp 20
  • V571 Recurring check. The 'IsVarStr(params[1], 22)' condition was already verified in line 3377. nsisin.cpp 3381

Open X-Ray Engine

V571 Recurring check. The 'if (m_pPhysicsShell)' condition was already verified in line 32. destroyablephysicsobject.cpp 33


void CDestroyablePhysicsObject::OnChangeVisual()
{
  if (m_pPhysicsShell){
    if(m_pPhysicsShell)m_pPhysicsShell->Deactivate();
    ....
  }
  ....
}

Inkscape

V571 Recurring check. The 'back == false' condition was already verified in line 388. Path.cpp 389


void
Path::SetBackData (bool nVal)
{
  if (back == false) {
    if (nVal == true && back == false) {
      back = true;
      ResetPoints();
    } else if (nVal == false && back == true) {
      back = false;
      ResetPoints();
    }
  } else {
    if (nVal == true && back == false) {
      back = true;
      ResetPoints();
    } else if (nVal == false && back == true) {
      back = false;
      ResetPoints();
    }
  }
}

Blender

V571 Recurring check. The 'if (do_fill)' condition was already verified in line 751. editmesh_rip.c 752


static int edbm_rip_invoke__vert(....)
{
  ....
  if (do_fill) {
     if (do_fill) {
        ....
     }
  }
  ....
}

Identical errors can be found in some other places:

  • V571 Recurring check. The 'but' condition was already verified in line 9587. interface_handlers.c 9590
  • V571 Recurring check. The '!me->mloopcol' condition was already verified in line 252. paint_vertex.c 253
  • V571 Recurring check. The 'constinv == 0' condition was already verified in line 5256. transform_conversions.c 5257
  • And 2 additional diagnostic messages.

ReOpenLDAP

V571 Recurring check. The 'if (s->state.r == 0)' condition was already verified in line 147. rurwl.c 148


void rurw_r_unlock(....) {
  ....
  if (s->state.r == 0) {  // <=
    if (s->state.r == 0)  // <=
      s->thr = 0;
    p->rurw_readers -= 1;
  }
  ....
}

Identical errors can be found in some other places:

  • V571 Recurring check. The 'def->mrd_usage & 0x0100U' condition was already verified in line 319. mr.c 322

Apache HTTP Server

V571 Recurring check. The 'ldc->ChaseReferrals == 1' condition was already verified in line 399. util_ldap.c 400


static int uldap_connection_init(....)
{
  ....
  if (ldc->ChaseReferrals==AP_LDAP_CHASEREFERRALS_ON){
    if ((ldc->ReferralHopLimit != AP_LDAP_HOPLIMIT_UNSET) &&
         ldc->ChaseReferrals == AP_LDAP_CHASEREFERRALS_ON) {
          ....
    }
  }
  ....
}

CodeLite

V571 Recurring check. The 'isInStatement' condition was already verified in line 2292. ASBeautifier.cpp 2293


void ASBeautifier::parseCurrentLine(const string& line)
{
  ....
  if(isInStatement && !inStatementIndentStack->empty()) {  // <=
    if(prevNonSpaceCh == '=' &&
       isInStatement && !inStatementIndentStack->empty())  // <=
        inStatementIndentStack->back() = 0;
  }
  ....
}


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;