Examples of errors detected by the V523 diagnostic

V523. The 'then' statement is equivalent to the 'else' statement.


Multi-threaded Dynamic Queue

V523 The 'then' statement is equivalent to the 'else' statement. GridCtrl gridcellbase.cpp 652


BOOL CGridCellBase::PrintCell(....)
{
  ...
  if(IsFixed())
    crFG = (GetBackClr() != CLR_DEFAULT) ?
      GetTextClr() : pDefaultCell->GetTextClr();
  else
    crFG = (GetBackClr() != CLR_DEFAULT) ?
      GetTextClr() : pDefaultCell->GetTextClr();
  ...
}

Notepad++

V523 The 'then' statement is equivalent to the 'else' statement


void TabBarPlus::drawItem(
  DRAWITEMSTRUCT *pDrawItemStruct)
{
  ...

  if (!_isVertical)
    Flags |= DT_BOTTOM;
  else
    Flags |= DT_BOTTOM;
  ...
}

Most likely this is what should be written here: Flags |= DT_VCENTER;


WinMerge

V523 The 'then' statement is equivalent to the 'else' statement


if (max < INT_MAX)
{
  for (i = min; i < max; i++)
  {
    if (eptr >= md->end_subject ||
        IS_NEWLINE(eptr))
      break;
    eptr++;
    while (eptr < md->end_subject &&
           (*eptr & 0xc0) == 0x80)
      eptr++;
    }
  }
else
{
  for (i = min; i < max; i++)
  {
    if (eptr >= md->end_subject ||
        IS_NEWLINE(eptr))
      break;
    eptr++;
    while (eptr < md->end_subject &&
           (*eptr & 0xc0) == 0x80)
      eptr++;
    }
  }
}

IPP Samples

V523 The 'then' statement is equivalent to the 'else' statement. aac_enc aac_enc_api_fp.c 1379


AACStatus aacencGetFrame(....)
{
  ...
  if (maxEn[0] > maxEn[1]) {
    ics[1].num_window_groups = ics[0].num_window_groups;
    for (g = 0; g < ics[0].num_window_groups; g++) {
      ics[1].len_window_group[g] = ics[0].len_window_group[g];
    }
  } else {
    ics[1].num_window_groups = ics[0].num_window_groups;
    for (g = 0; g < ics[0].num_window_groups; g++) {
      ics[1].len_window_group[g] = ics[0].len_window_group[g];
    }
  }
  ...
}

IPP Samples

V523 The 'then' statement is equivalent to the 'else' statement. h264_dec umc_h264_segment_decoder_deblocking_mbaff.cpp 340


void H264SegmentDecoder::ResetDeblockingVariablesMBAFF()
{
  ...
  if (GetMBFieldDecodingFlag(....))
    m_deblockingParams.nNeighbour[HORIZONTAL_DEBLOCKING] =
      m_CurMBAddr - mb_width * 2;
  else
    m_deblockingParams.nNeighbour[HORIZONTAL_DEBLOCKING] =
      m_CurMBAddr - mb_width * 2;
  ...
}

Most likely this is what should be written at end: mb_width * 2 + 1;

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. h264_enc umc_h264_deblocking_mbaff_tmpl.cpp.h 366

Qt

V523 The 'then' statement is equivalent to the 'else' statement. Qt3Support q3datetimeedit.cpp 2170


QString Q3TimeEdit::sectionFormattedText(int sec)
{
  ...
  if (d->typing && sec == d->ed->focusSection())
    d->ed->setSectionSelection(sec, offset - txt.length(),
                               offset);
  else
    d->ed->setSectionSelection(sec, offset - txt.length(),
                               offset);
  ...
}

Clang

V523 The 'then' statement is equivalent to the 'else' statement. LLVMInstCombine instcombineandorxor.cpp 1387


static bool CollectBSwapParts(....) {
  ...
  unsigned DestByteNo = InputByteNo + OverallLeftShift;
  if (InputByteNo < ByteValues.size()/2) {
    if (ByteValues.size()-1-DestByteNo != InputByteNo)
      return true;
  } else {
    if (ByteValues.size()-1-DestByteNo != InputByteNo)
      return true;
  }
  ...
}

Clang

V523 The 'then' statement is equivalent to the 'else' statement. clangRewrite rewriteobjc.cpp 4181


std::string RewriteObjC::SynthesizeBlockFunc(....)
{
  ...
  if (convertBlockPointerToFunctionPointer(QT))
    QT.getAsStringInternal(ParamStr, Context->PrintingPolicy);
  else
    QT.getAsStringInternal(ParamStr, Context->PrintingPolicy);
  ...
}

ReactOS

V523 The 'then' statement is equivalent to the 'else' statement. cardlib cardbutton.cpp 83


void CardButton::DrawRect(HDC hdc, RECT *rect, bool fNormal)
{
  ...
  HPEN hhi = CreatePen(0, 0, MAKE_PALETTERGB(crHighlight));
  HPEN hsh = CreatePen(0, 0, MAKE_PALETTERGB(crShadow));
  ...
  if(fNormal)
    hOld = SelectObject(hdc, hhi);
  else
    hOld = SelectObject(hdc, hhi);
  ...
}

Most likely this is what should be written here: else hOld = SelectObject(hdc, hsh);


IPP Samples

V523 The 'then' statement is equivalent to the 'else' statement. me umc_me.cpp 3547


Ipp32s MeVC1::GetAcCoeffSize(....)
{
  if(luma)
    tblSet = (MeACTablesSet*)&ACTablesSet[
      CodingSetsInter[m_cur.qp8][m_cur.AcTableIndex]];
  else
    tblSet = (MeACTablesSet*)&ACTablesSet[
      CodingSetsInter[m_cur.qp8][m_cur.AcTableIndex]];
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. me umc_me.cpp 3664

ADAPTIVE Communication Environment (ACE)

V523 The 'then' statement is equivalent to the 'else' statement. ACE throughput_stats.cpp 31


ACE_Throughput_Stats::sample (ACE_UINT64 throughput,
                              ACE_UINT64 latency)
{
  this->ACE_Basic_Stats::sample (latency);

  if (this->samples_count () == 1u)
    {
      this->throughput_last_   = throughput;
    }
  else
    {
      this->throughput_last_ = throughput;
    }
}

Clang

V523 The 'then' statement is equivalent to the 'else' statement. clangRewrite rewriteobjc.cpp 3361


std::string RewriteObjC::SynthesizeBlockFunc(....)
{
  ...
  if (convertBlockPointerToFunctionPointer(QT))
    QT.getAsStringInternal(ParamStr,
                           Context->getPrintingPolicy());
  else
    QT.getAsStringInternal(ParamStr,
                           Context->getPrintingPolicy());
  ...
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. clangRewrite rewritemodernobjc.cpp 3291

Clang

V523 The 'then' statement is equivalent to the 'else' statement. LLVMInstCombine instcombineandorxor.cpp 1368


static bool CollectBSwapParts(....)
{
  ...
  unsigned DestByteNo = InputByteNo + OverallLeftShift;
  if (InputByteNo < ByteValues.size()/2) {
    if (ByteValues.size()-1-DestByteNo != InputByteNo)
      return true;
  } else {
    if (ByteValues.size()-1-DestByteNo != InputByteNo)
      return true;
  }
  ...
}

Blender

V523 The 'then' statement is equivalent to the 'else' statement. bf_ikplugin generalmatrixvector.h 268


EIGEN_DONT_INLINE static void run(....)
{
  ...
  if ((size_t(lhs0+alignedStart)%sizeof(LhsPacket))==0)
    for (Index i = alignedStart;i<alignedSize;i+=ResPacketSize)
      pstore(&res[i],
             pcj.pmadd(ploadu<LhsPacket>(&lhs0[i]),
                       ptmp0, pload<ResPacket>(&res[i])));
  else
    for (Index i = alignedStart;i<alignedSize;i+=ResPacketSize)
      pstore(&res[i],
             pcj.pmadd(ploadu<LhsPacket>(&lhs0[i]),
                       ptmp0, pload<ResPacket>(&res[i])));
  ...
}

UCSniff

V523 The 'then' statement is equivalent to the 'else' statement. ec_sccp.c 3216


int openreceivehandler(....)
{
  ...
 int return_rtp = check_rtp_entry(ip);
 if (return_rtp < 0) {
   int return_value = populate_rtp_struct(return_rtp, ip,
                                          passthrupartyid,
                                          rtpport);
   if(return_value == -1) {
     return NULL;
   }
 } else {
   int return_value = populate_rtp_struct(return_rtp, ip,
                                          passthrupartyid,
                                          rtpport);
   if (return_value == -1) {
     return NULL;
   }
 }
  ...
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. ec_sccp.c 3794

MAME

V523 The 'then' statement is equivalent to the 'else' statement. deco16ic.c 943


static DEVICE_START( deco16ic )
{
  ...
  if (intf->split)
    deco16ic->pf2_tilemap_16x16 =
      tilemap_create_device(device, get_pf2_tile_info,
        deco16_scan_rows, 16, 16, fullwidth ?
          64 : 32, fullheight ? 64 : 32);
  else
    deco16ic->pf2_tilemap_16x16 =
      tilemap_create_device(device, get_pf2_tile_info,
        deco16_scan_rows, 16, 16, fullwidth ?
          64 : 32, fullheight ? 64 : 32);
  ...
}

MAME

V523 The 'then' statement is equivalent to the 'else' statement. resnet.c 628


int compute_res_net(int inputs, int channel,
                    const res_net_info *di)
{
  ...
  if (OpenCol)
  {
    rTotal += 1.0 / di->rgb[channel].R[i];
    v += vOL / di->rgb[channel].R[i];
  }
  else
  {
    rTotal += 1.0 / di->rgb[channel].R[i];
    v += vOL / di->rgb[channel].R[i];
  }
  ...
}

Trans-Proteomic Pipeline

V523 The 'then' statement is equivalent to the 'else' statement. tpplib kerneldensityrtmixturedistr.cxx 104


bool KernelDensityRTMixtureDistr::recalc_RTstats(....)
{
  ...
  if (catalog) {
    tmp = (*run_RT_calc_)[i]->recalc_RTstats(
      (*probs)[i], min_prob, (*ntts)[i], min_ntt, 2700);
  }
  else {
    tmp = (*run_RT_calc_)[i]->recalc_RTstats(
      (*probs)[i], min_prob, (*ntts)[i], min_ntt, 2700);
  }
  ...
}

Visualization Toolkit (VTK)

V523 The 'then' statement is equivalent to the 'else' statement. vtkRendering vtkobjexporter.cxx 324


void vtkOBJExporter::WriteAnActor(....)
{
  ...
  if (i%2)
  {
    i1 = i - 1;
    i2 = i - 2;
  }
  else
  {
    i1 = i - 1;
    i2 = i - 2;
  }
  ...
}

Samba

V523 The 'then' statement is equivalent to the 'else' statement. reg_perfcount.c 1092


static uint32 reg_perfcount_get_perf_data_block(....)
{
  ....
  if(object_ids == NULL)
  {
    /* we're getting a request for "Global" here */
    retval = _reg_perfcount_assemble_global(block, mem_ctx,
                                            base_index, names);
  }
  else
  {
    /* we're getting a request for a specific
       set of PERF_OBJECT_TYPES */
    retval = _reg_perfcount_assemble_global(block, mem_ctx,
                                            base_index, names);
  }
  ....
}

ReactOS

V523 The 'then' statement is equivalent to the 'else' statement. cardbutton.cpp 86


void CardButton::DrawRect(HDC hdc, RECT *rect, bool fNormal)
{
  ....
  if(fNormal)
    hOld = SelectObject(hdc, hhi);
  else
    hOld = SelectObject(hdc, hhi);
  ....
}

ReactOS

V523 The 'then' statement is equivalent to the 'else' statement. pin_wavepci.cpp 562


NTSTATUS NTAPI
CPortPinWavePci::HandleKsStream(IN PIRP Irp)
{
  ....
  if (m_Capture)
    m_Position.WriteOffset += Data;
  else
    m_Position.WriteOffset += Data;
  ....
}

ReactOS

V523 The 'then' statement is equivalent to the 'else' statement. tab.c 1043


static void TAB_SetupScrolling(
  TAB_INFO*   infoPtr,
  const RECT* clientRect)
{
  ....
  /*
  * Calculate the position of the scroll control.
  */
  if(infoPtr->dwStyle & TCS_VERTICAL)
  {
    controlPos.right = clientRect->right;
    controlPos.left  = controlPos.right -
                       2 * GetSystemMetrics(SM_CXHSCROLL);

    if (infoPtr->dwStyle & TCS_BOTTOM)
    {
      controlPos.top    = clientRect->bottom -
                          infoPtr->tabHeight;
      controlPos.bottom = controlPos.top +
                          GetSystemMetrics(SM_CYHSCROLL);
    }
    else
    {
      controlPos.bottom = clientRect->top + infoPtr->tabHeight;
      controlPos.top    = controlPos.bottom -
                          GetSystemMetrics(SM_CYHSCROLL);
    }
  }
  else
  {
    controlPos.right = clientRect->right;
    controlPos.left  = controlPos.right -
                       2 * GetSystemMetrics(SM_CXHSCROLL);

    if (infoPtr->dwStyle & TCS_BOTTOM)
    {
      controlPos.top    = clientRect->bottom -
                          infoPtr->tabHeight;
      controlPos.bottom = controlPos.top +
                          GetSystemMetrics(SM_CYHSCROLL);
    }
    else
    {
      controlPos.bottom = clientRect->top + infoPtr->tabHeight;
      controlPos.top    = controlPos.bottom -
                          GetSystemMetrics(SM_CYHSCROLL);
    }
  }
  ....
}

Windows 8 Driver Samples

V523 The 'then' statement is equivalent to the 'else' statement. hw_oids.c 1043


NDIS_STATUS
Hw11QueryDiversitySelectionRX(
  _In_  PHW_MAC_CONTEXT HwMac,
  _In_  BOOLEAN         SelectedPhy,
  _In_  ULONG           MaxEntries,
  _Out_ PDOT11_DIVERSITY_SELECTION_RX_LIST
                        Dot11DiversitySelectionRXList
    )
{
  //
  // Determine the PHY that the user wants to query
  //
  if (SelectedPhy)
    return HwQueryDiversitySelectionRX(HwMac->Hw,
              HwMac->SelectedPhyId,
              MaxEntries,
              Dot11DiversitySelectionRXList
              );
  else
    return HwQueryDiversitySelectionRX(HwMac->Hw,
              HwMac->SelectedPhyId,
              MaxEntries,
              Dot11DiversitySelectionRXList
              );
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. fail_driver1.c 188
  • V523 The 'then' statement is equivalent to the 'else' statement. simgpio_i2c.c 2253
  • V523 The 'then' statement is equivalent to the 'else' statement. simgpio.c 2181

WebRTC

V523 The 'then' statement is equivalent to the 'else' statement. aecm_core.c 1352


static int16_t CalcSuppressionGain(AecmCore_t * const aecm)
{
  ....
  if (tmp16no1 < aecm->supGain)
  {
    aecm->supGain += (int16_t)((tmp16no1 - aecm->supGain) >> 4);
  } else
  {
    aecm->supGain += (int16_t)((tmp16no1 - aecm->supGain) >> 4);
  }
  ....
}

Skia Graphics Engine

V523 The 'then' statement is equivalent to the 'else' statement. skopedgebuilder.cpp 52


void SkOpEdgeBuilder::closeContour(const SkPoint& curveEnd,
                                   const SkPoint& curveStart)
{
  ....
  if (curveEnd.fX != curveStart.fX ||
      curveEnd.fY != curveStart.fY)
  {
    fPathPts[fPathPts.count() - 1] = curveStart;
  } else {
    fPathPts[fPathPts.count() - 1] = curveStart;
  }  ....
}

Multi Theft Auto

V523 The 'then' statement is equivalent to the 'else' statement. cclientweapon.cpp 696


void CClientWeapon::DoGunShells ( CVector vecOrigin,
                                  CVector vecDirection )
{
  ....
  if ( GetAttachedTo () )
    g_pGame->GetFx ()->TriggerGunshot (
      NULL, vecOrigin, vecDirection, true );
  else
    g_pGame->GetFx ()->TriggerGunshot (
      NULL, vecOrigin, vecDirection, true );
  ....
}

OpenMS

V523 The 'then' statement is equivalent to the 'else' statement. mzmlhandler.h 534


template <typename MapType>
void MzMLHandler<MapType>::characters(
  const XMLCh* const chars, const XMLSize_t)
{
  ....
  if (optionalAttributeAsString_(data_processing_ref,
                                 attributes,
                                 s_data_processing_ref))
  {
    data_.back().meta.setDataProcessing(
                        processing_[data_processing_ref]);
  }
  else
  {
    data_.back().meta.setDataProcessing(
                        processing_[data_processing_ref]);
  }
  ....
}

Most likely this is what should be written here: processing_[data_processing_ref] ... processing_[default_processing_]


CryEngine 3 SDK

V523 The 'then' statement is equivalent to the 'else' statement. gamerules.cpp 5401


bool CGameRules::
ShouldGiveLocalPlayerHitableFee...OnCrosshairHoverForEntityClass
(const IEntityClass* pEntityClass) const
{
  assert(pEntityClass != NULL);

  if(gEnv->bMultiplayer)
  {
    return
      (pEntityClass == s_pSmartMineClass) ||
      (pEntityClass == s_pTurretClass) ||
      (pEntityClass == s_pC4Explosive);
  }
  else
  {
    return
      (pEntityClass == s_pSmartMineClass) ||
      (pEntityClass == s_pTurretClass) ||
      (pEntityClass == s_pC4Explosive);
  }
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. gamerulescombicaptureobjective.cpp 1692
  • V523 The 'then' statement is equivalent to the 'else' statement. vehiclemovementhelicopter.cpp 588

FlightGear

V523 The 'then' statement is equivalent to the 'else' statement. hud_tape.cxx 267


void HUD::Tape::draw_vertical(float value)
{
  ....
  if (_tick_length == VARIABLE) {
    draw_line(_x, y, marker_xs, y);
    draw_line(marker_xe, y, right, y);
  } else {
    draw_line(_x, y, marker_xs, y);
    draw_line(marker_xe, y, right, y);
  }
  ....
}

Micro-Manager

V523 The 'then' statement is equivalent to the 'else' statement. LeicaDMIScopeInterface.cpp 1296


int LeicaScopeInterface::GetDICTurretInfo(....)
{
  ....
  std::string tmp;
  ....
  if (tmp == "DIC-TURRET")
    scopeModel_->dicTurret_.SetMotorized(true);
  else
    scopeModel_->dicTurret_.SetMotorized(true);
  ....
}

Scilab

V523 The 'then' statement is equivalent to the 'else' statement. taucs_scilab.c 700


static int uf_union  (int* uf, int s, int t) {

  if (uf_find(uf,s) < uf_find(uf,t))
  {
    uf[uf_find(uf,s)] = uf_find(uf,t);
    return (uf_find(uf,t));
  }
  else
  {
    uf[uf_find(uf,s)] = uf_find(uf,t);
    return (uf_find(uf,t));
  }
}

Word for Windows 1.1a

V523 The 'then' statement is equivalent to the 'else' statement. dlglook1.c 873


int TmcCharacterLooks(pcmb)
CMB * pcmb;
{
  ....
  if (qps < 0)
  {
    pcab->wCharQpsSpacing = -qps;
    pcab->iCharIS = 2;
  }
  else  if (qps > 0)
  {
    pcab->iCharIS = 1;
  }
  else
  {
    pcab->iCharIS = 0;
  }
  ....
  if (hps < 0)
  {
    pcab->wCharHpsPos = -hps;
    pcab->iCharPos = 2;
  }
  else  if (hps > 0)
  {
    pcab->iCharPos = 1;
  }
  else
  {
    pcab->iCharPos = 1;
  }
  ....
}

Unreal Engine 4

V523 The 'then' statement is equivalent to the 'else' statement. paths.cpp 703


FString FPaths::CreateTempFilename( const TCHAR* Path,
  const TCHAR* Prefix, const TCHAR* Extension )
{
  ....
  const int32 PathLen = FCString::Strlen( Path );
  if( PathLen > 0 && Path[ PathLen - 1 ] != TEXT('/') )
  {
    UniqueFilename =
      FString::Printf( TEXT("%s/%s%s%s"), Path, Prefix,
                       *FGuid::NewGuid().ToString(), Extension );
  }
  else
  {
    UniqueFilename =
      FString::Printf( TEXT("%s/%s%s%s"), Path, Prefix,
                       *FGuid::NewGuid().ToString(), Extension );
  }
  ....
}

Unreal Engine 4

V523 The 'then' statement is equivalent to the 'else' statement. slatestyle.h 289


class SLATE_API FSlateStyleSet : public ISlateStyle
{
  ....
  template< typename DefinitionType >
  FORCENOINLINE void Set(....)
  {
    ....
    if ( DefinitionPtr == NULL )
    {
      WidgetStyleValues.Add( PropertyName,
        MakeShareable(new DefinitionType(InStyleDefintion)) );
    }
    else
    {
      WidgetStyleValues.Add( PropertyName,
        MakeShareable(new DefinitionType(InStyleDefintion)) );
    }
  }
  ....
};

Qt

V523 The 'then' statement is equivalent to the 'else' statement. qbluetoothservicediscoveryagent.cpp 402


void
QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscovered(
  const QBluetoothDeviceInfo &info)
{
  if(mode == QBluetoothServiceDiscoveryAgent::FullDiscovery) {
    for(int i = 0; i < discoveredDevices.count(); i++){
      if(discoveredDevices.at(i).address() == info.address()){
        discoveredDevices.removeAt(i);
      }
    }
    discoveredDevices.prepend(info);
  }
  else {
    for(int i = 0; i < discoveredDevices.count(); i++){
      if(discoveredDevices.at(i).address() == info.address()){
        discoveredDevices.removeAt(i);
      }
    }
    discoveredDevices.prepend(info);
  }
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. pcre_exec.c 5577
  • V523 The 'then' statement is equivalent to the 'else' statement. ditaxmlgenerator.cpp 1722
  • V523 The 'then' statement is equivalent to the 'else' statement. htmlgenerator.cpp 388

WebM

V523 The 'then' statement is equivalent to the 'else' statement. vp9_encodeframe.c 2450


static void encode_superblock(....)
{
  if (mbmi->ref_frame[0] != LAST_FRAME)
    cpi->zbin_mode_boost = GF_ZEROMV_ZBIN_BOOST;
  else
    cpi->zbin_mode_boost = LF_ZEROMV_ZBIN_BOOST;
  ....
}

WebRTC

V523 The 'then' statement is equivalent to the 'else' statement. aecm_core.c 1227


int16_t WebRtcAecm_CalcSuppressionGain(AecmCore_t * const aecm)
{
  ....
  if (tmp16no1 < aecm->supGain)
  {
    aecm->supGain += (int16_t)((tmp16no1 - aecm->supGain) >> 4);
  } else
  {
    aecm->supGain += (int16_t)((tmp16no1 - aecm->supGain) >> 4);
  }
  ....
}

Wine Is Not an Emulator

V523 The 'then' statement is equivalent to the 'else' statement. filedlg.c 3302


static LRESULT FILEDLG95_LOOKIN_DrawItem(....)
{
if(pDIStruct->itemID == liInfos->uSelectedItem)
  {
    ilItemImage = (HIMAGELIST) SHGetFileInfoW (
      (LPCWSTR) tmpFolder->pidlItem, 0, &sfi, sizeof (sfi),
        shgfi_flags );
  }
  else
  {
    ilItemImage = (HIMAGELIST) SHGetFileInfoW (
      (LPCWSTR) tmpFolder->pidlItem, 0, &sfi, sizeof (sfi),
        shgfi_flags );
  }
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. genres.c 1130

ITK

V523 The 'then' statement is equivalent to the 'else' statement. metadtitube.cxx 155


void MetaDTITube::
PrintInfo() const
{
  MetaObject::PrintInfo();
  METAIO_STREAM::cout << "ParentPoint = " << m_ParentPoint
                      << METAIO_STREAM::endl;
  if(m_Root)
  {
    METAIO_STREAM::cout << "Root = "
                        << "True" << METAIO_STREAM::endl;
  }
  else
  {
    METAIO_STREAM::cout << "Root = "
                        << "True" << METAIO_STREAM::endl;
  }
  ....
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. metatube.cxx 125
  • V523 The 'then' statement is equivalent to the 'else' statement. h5tconv.c 4655

K Desktop Environment

V523 The 'then' statement is equivalent to the 'else' statement. kconfig_compiler.cpp 1051


QString newItem( const QString &type, ....)
{
  QString t = "new "+cfg.inherits+"::Item" + ....;
  if ( type == "Enum" ) t += ", values" + name;
  if ( !defaultValue.isEmpty() ) {
    t += ", ";
    if ( type == "String" ) t += defaultValue;        // <=
    else t+= defaultValue;                            // <=
  }
  t += " );";

  return t;
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. installation.cpp 589

Miranda NG

V523 The 'then' statement is equivalent to the 'else' statement. TabSRMM msglog.cpp 439


static void Build_RTF_Header()
{
  ....
  if (dat->dwFlags & MWF_LOG_RTL)
    AppendToBuffer(buffer, bufferEnd, bufferAlloced,
                   "{\\rtf1\\ansi\\deff0{\\fonttbl");
  else
    AppendToBuffer(buffer, bufferEnd, bufferAlloced,
                   "{\\rtf1\\ansi\\deff0{\\fonttbl");
  ....
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. AdvaImg pluginbmp.cpp 602
  • V523 The 'then' statement is equivalent to the 'else' statement. AdvaImg pluginbmp.cpp 810
  • V523 The 'then' statement is equivalent to the 'else' statement. AdvaImg pluginbmp.cpp 956
  • And 6 additional diagnostic messages.

.NET CoreCLR

V523 The 'then' statement is equivalent to the 'else' statement. cee_wks threadsuspend.cpp 2468


enum __MIDL___MIDL_itf_mscoree_0000_0004_0001
{
  OPR_ThreadAbort = 0,
  OPR_ThreadRudeAbortInNonCriticalRegion = .... ,
  OPR_ThreadRudeAbortInCriticalRegion = ....) ,
  OPR_AppDomainUnload = .... ,
  OPR_AppDomainRudeUnload = ( OPR_AppDomainUnload + 1 ) ,
  OPR_ProcessExit = ( OPR_AppDomainRudeUnload + 1 ) ,
  OPR_FinalizerRun = ( OPR_ProcessExit + 1 ) ,
  MaxClrOperation = ( OPR_FinalizerRun + 1 )
}  EClrOperation;

void Thread::SetRudeAbortEndTimeFromEEPolicy()
{
  LIMITED_METHOD_CONTRACT;
  DWORD timeout;
  if (HasLockInCurrentDomain())
  {
    timeout = GetEEPolicy()->
      GetTimeout(OPR_ThreadRudeAbortInCriticalRegion);  // <=
  }
  else
  {
    timeout = GetEEPolicy()->
      GetTimeout(OPR_ThreadRudeAbortInCriticalRegion);  // <=
  }
  ....
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. ClrJit instr.cpp 3427
  • V523 The 'then' statement is equivalent to the 'else' statement. ClrJit flowgraph.cpp 18815
  • V523 The 'then' statement is equivalent to the 'else' statement. daccess dacdbiimpl.cpp 6374

Haiku Operation System

V523 The 'then' statement is equivalent to the 'else' statement. mkntfs.c 1132


static int insert_positioned_attr_in_mft_record(....)
{
  ....
  if (flags & ATTR_COMPRESSION_MASK) {
    hdr_size = 72;
    /* FIXME: This compression stuff is all wrong. .... */
    /* now. (AIA) */
    if (val_len)
      mpa_size = 0; /* get_size_for_compressed_....; */
    else
      mpa_size = 0;
  } else {
  ....
  }
  ....
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. mkntfs.c 1334

Godot Engine

V523 The 'then' statement is equivalent to the 'else' statement. scroll_bar.cpp 57


void ScrollBar::_input_event(InputEvent p_event)
{
  ....
  if (b.button_index==5 && b.pressed)
  {
    if (orientation==VERTICAL)
      set_val( get_val() + get_page() / 4.0 );
    else
      set_val( get_val() + get_page() / 4.0 );
    accept_event();
  }
  ....
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. scroll_bar.cpp 67

Unreal Engine 4

V523 The 'then' statement is equivalent to the 'else' statement. slatestyle.h 71


template< typename DefinitionType >
FORCENOINLINE void Set( .... )
{
  ....
  if ( DefinitionPtr == nullptr )
  {
    WidgetStyleValues.Add( PropertyName,
      MakeShareable( new DefinitionType( InStyleDefintion ) ) );
  }
  else
  {
    WidgetStyleValues.Add( PropertyName,
      MakeShareable( new DefinitionType( InStyleDefintion ) ) );
  }
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. k2node_latentabilitycall.cpp 660
  • V523 The 'then' statement is equivalent to the 'else' statement. slatestyle.h 71

FreeCAD

V523 The 'then' statement is equivalent to the 'else' statement. viewproviderfemmesh.cpp 695


inline void insEdgeVec(std::map<int,std::set<int> > &map,
                       int n1, int n2)
{
  if(n1<n2)
    map[n2].insert(n1);
  else
    map[n2].insert(n1);
};

GNU Octave

V523 The 'then' statement is equivalent to the 'else' statement. matrix_type.cc 312


DEFUN(....)
{
  ....
  if (str_typ == "upper")
    mattyp.mark_as_permuted(len, p);
  else
    mattyp.mark_as_permuted(len, p);
  ....
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. matrix_type.cc 485

Doxygen

V523 The 'then' statement is equivalent to the 'else' statement. docparser.cpp 521


static void checkUndocumentedParams()
{
  ....
  if (g_memberDef->inheritsDocsFrom())
  {
    warn_doc_error(g_memberDef->getDefFileName(),
                   g_memberDef->getDefLine(),
                   substitute(errMsg,"%","%%"));
   }
  else
  {
    warn_doc_error(g_memberDef->getDefFileName(),
                   g_memberDef->getDefLine(),
                   substitute(errMsg,"%","%%"));
  }
  ....
}

Doxygen

V523 The 'then' statement is equivalent to the 'else' statement. translator_tw.h 769


class TranslatorChinesetraditional : public Translator
{
public:
  ....
  virtual QCString trGeneratedFromFiles(bool single, ....)
  {
  ....
  QCString result=(QCString)"?";
  ....
  if (single) result+=":"; else result+=":";
  ....
  }
....
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. translator_tw.h 1956
  • V523 The 'then' statement is equivalent to the 'else' statement. translator_tw.h 1965

FreeSWITCH

V523 The 'then' statement is equivalent to the 'else' statement. sofia_glue.c 552


char *sofia_overcome_sip_uri_weakness(....)
{
  ....
  if (strchr(stripped, ';')) {
    if (params) {
      new_uri = switch_core_session_sprintf(session, "....",
        uri_only ? "" : "<", stripped, sofia_glue_transport2str(
        transport), params, uri_only ? "" : ">");
    } else {
      new_uri = switch_core_session_sprintf(session, "....",
        uri_only ? "" : "<", stripped, sofia_glue_transport2str(
        transport), uri_only ? "" : ">");
    }
  } else {
    if (params) {
      new_uri = switch_core_session_sprintf(session, "....",
        uri_only ? "" : "<", stripped, sofia_glue_transport2str(
        transport), params, uri_only ? "" : ">");
    } else {
      new_uri = switch_core_session_sprintf(session, "....",
        uri_only ? "" : "<", stripped, sofia_glue_transport2str(
        transport), uri_only ? "" : ">");
    }
  }
  ....
}

Mozilla Thunderbird

V523 The 'then' statement is equivalent to the 'else' statement. mozspelli18nmanager.cpp 34


NS_IMETHODIMP
mozSpellI18NManager::GetUtil(mozISpellI18NUtil **_retval, ....)
{
  ....
  nsAutoString lang;
  ....
  if(lang.EqualsLiteral("en"))
  {
    *_retval = new mozEnglishWordUtils;
  }
  else
  {
    *_retval = new mozEnglishWordUtils;
  }
  NS_IF_ADDREF(*_retval);
  return NS_OK;
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. jemalloc.c 6504
  • V523 The 'then' statement is equivalent to the 'else' statement. nsnativethemewin.cpp 1007
  • V523 The 'then' statement is equivalent to the 'else' statement. msgmapihook.cpp 677

Wine Is Not an Emulator

V523 The 'then' statement is equivalent to the 'else' statement. resource.c 661


WORD WINAPI GetDialog32Size16( LPCVOID dialog32 )
{
  ....
  p = (const DWORD *)p + 1; /* x */
  p = (const DWORD *)p + 1; /* y */
  p = (const DWORD *)p + 1; /* cx */
  p = (const DWORD *)p + 1; /* cy */

  if (dialogEx)
      p = (const DWORD *)p + 1; /* ID */
  else
      p = (const DWORD *)p + 1; /* ID */
  ....
}

Unreal Engine 4

V523 The 'then' statement is equivalent to the 'else' statement. lightrendering.cpp 864


void FDeferredShadingSceneRenderer::RenderLight(....)
{
  ....
  if (bClearCoatNeeded)
  {
    SetShaderTemplLighting<false, false, false, true>(
      RHICmdList, View, *VertexShader, LightSceneInfo);
  }
  else
  {
    SetShaderTemplLighting<false, false, false, true>(
      RHICmdList, View, *VertexShader, LightSceneInfo);
  }
  ....
}

FreeBSD Kernel

V523 The 'then' statement is equivalent to the 'else' statement. saint.c 2023


GLOBAL void siSMPRespRcvd(....)
{
  ....
  if (agNULL == frameHandle)
  {
    /* indirect mode */
    /* call back with success */
    (*(ossaSMPCompletedCB_t)(pRequest->completionCB))(agRoot,
       pRequest->pIORequestContext, OSSA_IO_SUCCESS, payloadSize,
       frameHandle);
  }
  else
  {
    /* direct mode */
    /* call back with success */
    (*(ossaSMPCompletedCB_t)(pRequest->completionCB))(agRoot,
       pRequest->pIORequestContext, OSSA_IO_SUCCESS, payloadSize,
       frameHandle);
  }
  ....
}

FreeBSD Kernel

V523 The 'then' statement is equivalent to the 'else' statement. smsat.c 2848


osGLOBAL void
smsatInquiryPage89(....)
{
  ....
  if (oneDeviceData->satDeviceType == SATA_ATA_DEVICE)
  {
    pInquiry[40] = 0x01; /* LBA Low          */
    pInquiry[41] = 0x00; /* LBA Mid          */
    pInquiry[42] = 0x00; /* LBA High         */
    pInquiry[43] = 0x00; /* Device           */
    pInquiry[44] = 0x00; /* LBA Low Exp      */
    pInquiry[45] = 0x00; /* LBA Mid Exp      */
    pInquiry[46] = 0x00; /* LBA High Exp     */
    pInquiry[47] = 0x00; /* Reserved         */
    pInquiry[48] = 0x01; /* Sector Count     */
    pInquiry[49] = 0x00; /* Sector Count Exp */
  }
  else
  {
    pInquiry[40] = 0x01; /* LBA Low          */
    pInquiry[41] = 0x00; /* LBA Mid          */
    pInquiry[42] = 0x00; /* LBA High         */
    pInquiry[43] = 0x00; /* Device           */
    pInquiry[44] = 0x00; /* LBA Low Exp      */
    pInquiry[45] = 0x00; /* LBA Mid Exp      */
    pInquiry[46] = 0x00; /* LBA High Exp     */
    pInquiry[47] = 0x00; /* Reserved         */
    pInquiry[48] = 0x01; /* Sector Count     */
    pInquiry[49] = 0x00; /* Sector Count Exp */
  }
  ....
}

FreeBSD Kernel

V523 The 'then' statement is equivalent to the 'else' statement. agtiapi.c 829


#define osti_strtoul(nptr, endptr, base)    \
          strtoul((char *)nptr, (char **)endptr, 0)

if (osti_strncmp(buffer, "0x", 2) == 0)
{
  maxTargets = osti_strtoul (buffer, &pLastUsedChar, 0);
  AGTIAPI_PRINTK( ".... maxTargets = osti_strtoul  0 \n" );
}
else
{
  maxTargets = osti_strtoul (buffer, &pLastUsedChar, 10);
  AGTIAPI_PRINTK( ".... maxTargets = osti_strtoul 10\n"   );
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. agtiapi.c 780
  • V523 The 'then' statement is equivalent to the 'else' statement. dminit.c 131
  • V523 The 'then' statement is equivalent to the 'else' statement. dminit.c 201
  • And 9 additional diagnostic messages.

The GTK+ Project

V523 The 'then' statement is equivalent to the 'else' statement. gtkprogressbar.c 1232


static void
gtk_progress_bar_act_mode_enter (GtkProgressBar *pbar)
{
  ....
  /* calculate start pos */
  if (orientation == GTK_ORIENTATION_HORIZONTAL)
    {
      if (!inverted)
        {
          priv->activity_pos = 0.0;
          priv->activity_dir = 0;
        }
      else
        {
          priv->activity_pos = 1.0;
          priv->activity_dir = 1;
        }
    }
  else
    {
      if (!inverted)
        {
          priv->activity_pos = 0.0;
          priv->activity_dir = 0;
        }
      else
        {
          priv->activity_pos = 1.0;
          priv->activity_dir = 1;
        }
    }
  ....
}

ReactOS

V523 The 'then' statement is equivalent to the 'else' statement. dllmain.c 1325


SOCKET WSPAPI WSPAccept(....)
{
  ....
  if (CallBack == CF_REJECT)
  {
    *lpErrno = WSAECONNREFUSED;
    return INVALID_SOCKET;
  }
  else
  {
    *lpErrno = WSAECONNREFUSED;
    return INVALID_SOCKET;
  }
  ....
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. crecyclebin.cpp 1357
  • V523 The 'then' statement is equivalent to the 'else' statement. mapdesc.cc 733
  • V523 The 'then' statement is equivalent to the 'else' statement. pattern.c 2058
  • And 1 additional diagnostic messages.

OpenJDK

V523 The 'then' statement is equivalent to the 'else' statement. awt_ImagingLib.c 2927


static int expandPackedBCR(JNIEnv *env, RasterS_t *rasterP,
                           int component,
                           unsigned char *outDataP)
{
  ....
  /* Convert the all bands */
  if (rasterP->numBands < 4) {
    /* Need to put in alpha */
    for (y=0; y < rasterP->height; y++) {
      inP = lineInP;
      for (x=0; x < rasterP->width; x++) {
        for (c=0; c < rasterP->numBands; c++) {
          *outP++ = (unsigned char)
            (((*inP&rasterP->sppsm.maskArray[c]) >> roff[c])
             <<loff[c]);
        }
        inP++;
      }
      lineInP += rasterP->scanlineStride;
    }
  }
  else {
    for (y=0; y < rasterP->height; y++) {
      inP = lineInP;
      for (x=0; x < rasterP->width; x++) {
        for (c=0; c < rasterP->numBands; c++) {
          *outP++ = (unsigned char)
            (((*inP&rasterP->sppsm.maskArray[c]) >> roff[c])
             <<loff[c]);
        }
        inP++;
      }
      lineInP += rasterP->scanlineStride;
    }
  }
  ....
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. awt_ImagingLib.c 3111
  • V523 The 'then' statement is equivalent to the 'else' statement. awt_ImagingLib.c 3307

CryEngine V

V523 The 'then' statement is equivalent to the 'else' statement. d3dshadows.cpp 1410


void CD3D9Renderer::ConfigShadowTexgen(....)
{
  ....
  if ( (pFr->m_Flags & DLF_DIRECTIONAL) ||
     (!(pFr->bUseHWShadowMap) && !(pFr->bHWPCFCompare)))
  {
    //linearized shadows are used for any kind of directional
    //lights and for non-hw point lights
    m_cEF.m_TempVecs[2][Num] = 1.f / (pFr->fFarDist);
  }
  else
  {
    //hw point lights sources have non-linear depth for now
    m_cEF.m_TempVecs[2][Num] = 1.f / (pFr->fFarDist);
  }
  ....
}

Inkscape

V523 The 'then' statement is equivalent to the 'else' statement. ShapeRaster.cpp 1825


void Shape::AvanceEdge(....)
{
  ....
  if ( swrData[no].sens ) {
    if ( swrData[no].curX < swrData[no].lastX ) {
      line->AddBord(swrData[no].curX,
                    swrData[no].lastX,
                    false);
    } else if ( swrData[no].curX > swrData[no].lastX ) {
        line->AddBord(swrData[no].lastX,
                      swrData[no].curX,
                      false);
      }
  } else {
    if ( swrData[no].curX < swrData[no].lastX ) {
      line->AddBord(swrData[no].curX,
                    swrData[no].lastX,
                    false);
    } else if ( swrData[no].curX > swrData[no].lastX ) {
        line->AddBord(swrData[no].lastX,
                      swrData[no].curX,
                      false);
    }
  }
}

Identical errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. ShapeRaster.cpp 1795
  • V523 The 'then' statement is equivalent to the 'else' statement. PathCutting.cpp 1323
  • V523 The 'then' statement is equivalent to the 'else' statement. ShapeSweep.cpp 2340

GCC

V523 The 'then' statement is equivalent to the 'else' statement. tree-ssa-threadupdate.c 2596


bool
thread_through_all_blocks (bool may_peel_loop_headers)
{
  ....
  /* Case 1, threading from outside to inside the loop
     after we'd already threaded through the header.  */
  if ((*path)[0]->e->dest->loop_father
      != path->last ()->e->src->loop_father)
  {
    delete_jump_thread_path (path);
    e->aux = NULL;
    ei_next (&ei;);
  }
  else
  {
    delete_jump_thread_path (path);
    e->aux = NULL;
    ei_next (&ei;);
  }
  ....
}

ICQ

V523 The 'then' statement is equivalent to the 'else' statement. contactlistitemdelegate.cpp 148


QSize ContactListItemDelegate::sizeHint(....) const
{
  ....
  if (!membersModel)
  {
    ....
  }
  else
  {
    if (membersModel->is_short_view_)
      return QSize(width, ContactList::ContactItemHeight());
    else
      return QSize(width, ContactList::ContactItemHeight());
  }
  return QSize(width, ContactList::ContactItemHeight());
}

Chromium

V523 The 'then' statement is equivalent to the 'else' statement.


bool ResourcePrefetcher::ShouldContinueReadingRequest(
  net::URLRequest* request,
  int bytes_read
)
{
  if (bytes_read == 0) {  // When bytes_read == 0, no more data.
    if (request->was_cached())
      FinishRequest(request);                   // <=
    else
      FinishRequest(request);                   // <=
    return false;
  }

  return true;
}

Alembic

V523 The 'then' statement is equivalent to the 'else' statement. OFaceSet.cpp 230


void OFaceSetSchema::set( const Sample &iSamp )
{
  ....
  if ( iSamp.getSelfBounds().hasVolume() )
  {
    //Caller explicity set bounds for this sample of the faceset.

    m_selfBoundsProperty.set( iSamp.getSelfBounds() );   // <=
  }
  else
  {
    m_selfBoundsProperty.set( iSamp.getSelfBounds() );   // <=

    //NYI compute self bounds via parent mesh's faces
  }
  ....
}


Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;