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;
    }
  ....
}

Similar 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 V

V571 Recurring check. The 'if (pos == npos)' condition was already verified in line 1530. CryString.h 1539


//! Find last single character.
// \return -1 if not found, distance from beginning otherwise.
template<class T>
inline typename CryStringT<T>::....::rfind(....) const
{
  const_str str;
  if (pos == npos)
  {
    // find last single character
    str = _strrchr(m_str, ch);
    // return -1 if not found, distance from beginning otherwise
    return (str == NULL) ?
      (size_type) - 1 : (size_type)(str - m_str);
  }
  else
  {
    if (pos == npos)
    {
      pos = length();
    }
    if (pos > length())
    {
      return npos;
    }

    value_type tmp = m_str[pos + 1];
    m_str[pos + 1] = 0;
    str = _strrchr(m_str, ch);
    m_str[pos + 1] = tmp;
  }
  return (str == NULL) ?
   (size_type) - 1 : (size_type)(str - m_str);
}

Similar errors can be found in some other places:

  • V571 Recurring check. The 'if (pos == npos)' condition was already verified in line 1262. CryFixedString.h 1271

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.

Similar 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;
}

Similar 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(....) );
    }
  }
}

Similar 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;
    }
  }
  ....
}

Similar 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;
  }
  ....
}

Similar 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) {
        ....
     }
  }
  ....
}

Similar 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;
  }
  ....
}

Similar 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;
  }
  ....
}

CMaNGOS

V571 Recurring check. The 'isDirectory' condition was already verified in line 166. FileSystem.cpp 169


FileSystem::Dir&
FileSystem::getContents(const std::string& path,
                        bool forceUpdate)
{
  // Does this path exist on the real filesystem?
  if (exists && isDirectory)
  {
    // Is this path actually a directory?
    if (isDirectory)
    {
      ....
    }
  ....
}

CryEngine V

V571 Recurring check. The 'if (rLightInfo.m_pDynTexture)' condition was already verified in line 69. ObjMan.cpp 70


// Safe memory helpers
#define SAFE_RELEASE(p){ if (p) { (p)->Release(); (p) = NULL; } }

void CObjManager::UnloadVegetationModels(bool bDeleteAll)
{
  ....
  SVegetationSpriteLightInfo& rLightInfo = ....;
  if (rLightInfo.m_pDynTexture)
    SAFE_RELEASE(rLightInfo.m_pDynTexture);
  ....
}

Similar errors can be found in some other places:

  • V571 Recurring check. The 'if (m_pSectorGroups)' condition was already verified in line 48. PartitionGrid.cpp 50

Bind

V571 Recurring check. The 'if (lwc->searchnxt > 0)' condition was already verified in line 208. lwresd.c 209


isc_result_t
ns_lwresd_parseeresolvconf(isc_mem_t *mctx, cfg_parser_t *pctx,
         cfg_obj_t **configp)
{
  ....
  if (lwc->searchnxt > 0) {                           // <=
    if (lwc->searchnxt > 0) {                         // <=
      CHECK(buffer_putstr(&b, "\tsearch {\n"));
      for (i = 0; i < lwc->searchnxt; i++) {
        CHECK(buffer_putstr(&b, "\t\t\""));
        CHECK(buffer_putstr(&b, lwc->search[i]));
        CHECK(buffer_putstr(&b, "\";\n"));
      }
      CHECK(buffer_putstr(&b, "\t};\n"));
    }
  }
  ....
}

Tizen

V571 Recurring check. The 'if (MEDIA_VISION_ERROR_NONE != err2)' condition was already verified in line 942. face_test_suite.c 943


int perform_model_evaluation(mv_face_recognition_model_h model)
{
  ....
  int err2 = mv_destroy_source(source);
  if (MEDIA_VISION_ERROR_NONE != err2) {                   // <=
    if (MEDIA_VISION_ERROR_NONE != err2) {                 // <=
      printf(TEXT_RED
          "ERROR: .......: %i"
          TEXT_RESET "\n", err2);
    }
  }
  ....
}

Enlightenment

V571 Recurring check. The 'if (it1->fuzzy_match || it2->fuzzy_match)' condition was already verified in line 120. evry_plug_actions.c 121


static int
_cb_sort(const void *data1, const void *data2)
{
  const Evry_Item *it1 = data1;
  const Evry_Item *it2 = data2;
  ....
  if (it1->fuzzy_match || it2->fuzzy_match)
    if (it1->fuzzy_match || it2->fuzzy_match)
  ....
}

EFL Core Libraries

V571 Recurring check. The 'if (!disk->cache.vendor)' condition was already verified in line 298. eeze_disk.c 299


EAPI void eeze_disk_scan(Eeze_Disk *disk)
{
  ....
  if (!disk->cache.vendor)
    if (!disk->cache.vendor)
      disk->cache.vendor = udev_device_get_sysattr_value(....);
  ....
}

Similar errors can be found in some other places:

  • V571 Recurring check. The 'if (!disk->cache.model)' condition was already verified in line 302. eeze_disk.c 303
  • V571 Recurring check. The 'if (priv->last_buffer)' condition was already verified in line 150. emotion_sink.c 152
  • V571 Recurring check. The 'if (pd->editable)' condition was already verified in line 892. elm_code_widget.c 894
  • And 2 additional diagnostic messages.

Ardour

V571 Recurring check. The 'if (working_on_selection)' condition was already verified in line 284. editor_ops.cc 314


void
Editor::split_regions_at (....)
{
  ....
  if (working_on_selection) {
    ....
  } else {
    if( working_on_selection ) {
      //these are the new regions created after the split
      selection->add (latest_regionviews);
    }
  }

  commit_reversible_command ();
}

Steinberg SDKs

V571 Recurring check. The 'if (vstPlug)' condition was already verified in line 170. vsttestsuite.cpp 172


bool VstTestBase::teardown ()
{
  if (vstPlug)
  {
    if (vstPlug)
    {
      vstPlug->activateBus (kAudio, kInput, 0, false);
      vstPlug->activateBus (kAudio, kOutput, 0, false);
    }
    plugProvider->releasePlugIn (vstPlug, controller);
  }
  return true;
}


Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;
We use cookies for the analysis of events to improve our content and make user interaction more convenient. By continuing the view of our web-pages you accept the terms of using these files. You can find out more about cookie-files and privacy policy or close the notification, by clicking on the button. Learn More →
Do not show