Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
Examples of errors detected by the V523…

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. tabbar.cpp 1085


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;


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;

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

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

LLVM/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]];
}

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

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

Similar errors can be found in some other places:

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

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

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

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

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

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

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

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

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

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

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

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

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

Similar errors can be found in some other places:

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

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

Similar 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+=":";
  ....
  }
....
}

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

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

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

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

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

Similar 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. stdafx.cpp 42


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

CMaNGOS

V523 The 'then' statement is equivalent to the 'else' statement. SpellAuras.cpp 1537


void Aura::HandleAuraModShapeshift(bool apply, bool Real)
{
  switch (form)
  {
    case FORM_CAT:
      ....
    case FORM_TRAVEL:
      ....
    case FORM_AQUA:
      if (Player::TeamForRace(target->getRace()) == ALLIANCE)
        modelid = 2428;
      else
        modelid = 2428;
    ....
  }
  ....
}

Far2l

V523 The 'then' statement is equivalent to the 'else' statement. Queque.cpp 358


void FTP::AddToQueque(FAR_FIND_DATA* FileName,
                      LPCSTR Path,
                      BOOL Download)
{
  ....
  char *m;
  ....
  if(Download)
    m = strrchr(FileName->cFileName, '/');
  else
    m = strrchr(FileName->cFileName, '/');
  ....
}

FreeBSD Kernel

V523 The 'then' statement is equivalent to the 'else' statement. bxe.c 3812


static uint32_t
bxe_send_unload_req(struct bxe_softc *sc,
                    int              unload_mode)
{
  uint32_t reset_code = 0;

  /* Select the UNLOAD request mode */
  if (unload_mode == UNLOAD_NORMAL) {
    reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
  } else {
    reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
  }
  ....
}

FreeBSD Kernel

V523 The 'then' statement is equivalent to the 'else' statement. linux_ipc.c 353


static int
linux_msqid_pushdown(l_int ver,
  struct l_msqid64_ds *linux_msqid64, caddr_t uaddr)
{
  ....
  if (linux_msqid64->msg_qnum > USHRT_MAX)
    linux_msqid.msg_qnum = linux_msqid64->msg_qnum;
  else
    linux_msqid.msg_qnum = linux_msqid64->msg_qnum;
  ....
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. linux_ipc.c 357
  • V523 The 'then' statement is equivalent to the 'else' statement. nfs_clvnops.c 2877
  • V523 The 'then' statement is equivalent to the 'else' statement. smsatcb.c 5793
  • And 1 additional diagnostic messages.

CryEngine V

V523 The 'then' statement is equivalent to the 'else' statement. ScriptTable.cpp 789


bool CScriptTable::AddFunction(const SUserFunctionDesc& fd)
{
  ....
  char sFuncSignature[256];
  if (fd.sGlobalName[0] != 0)
    cry_sprintf(sFuncSignature, "%s.%s(%s)", fd.sGlobalName,
      fd.sFunctionName, fd.sFunctionParams);
  else
    cry_sprintf(sFuncSignature, "%s.%s(%s)", fd.sGlobalName,
      fd.sFunctionName, fd.sFunctionParams);
  ....
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. BudgetingSystem.cpp 718
  • V523 The 'then' statement is equivalent to the 'else' statement. D3DShadows.cpp 627
  • V523 The 'then' statement is equivalent to the 'else' statement. livingentity.cpp 967

Scilab

V523 The 'then' statement is equivalent to the 'else' statement. data3d.cpp 51


void Data3D::getDataProperty(int property, void **_pvData)
{
  if (property == UNKNOWN_DATA_PROPERTY)
  {
    *_pvData = NULL;
  }
  else
  {
    *_pvData = NULL;
  }
}

EFL Core Libraries

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


void
_ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location)
{
  ....
  if (ECORE_EVAS_PORTRAIT(ee))
    ecore_wl_window_resize(wdata->win, ee->w, ee->h, location);
  else
    ecore_wl_window_resize(wdata->win, ee->w, ee->h, location);
  ....
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. ecore_evas_wayland_egl.c 581

Tizen

V523 The 'then' statement is equivalent to the 'else' statement. ise-stt-option.cpp 433


static Evas_Object *create_language_list(Evas_Object *parent)
{
  ....
  char *s = (char *)disp_lang_array[i];

  if (strchr(s, '(')){
    item = item_append(genlist, itc_1text, i,
                       language_set_genlist_radio_cb, genlist);
  } else {
    item = item_append(genlist, itc_1text, i,
                       language_set_genlist_radio_cb, genlist);
  }
  ....
}

Tizen

V523 The 'then' statement is equivalent to the subsequent code fragment. dpm-toolkit-cli.c 87


static int open_entry_popup(const char* title, const char* msg,
                            const char* guide, char** value)
{
  text_header(title, msg);
  section_separator();
  fancy_text(DEFAULT, NONE, "Enter text(type '.' to cancel) : ");
    *value = malloc(64);
  scanf("%64s", *value);
  if (*value[0] == '.') {
    return XTK_EVENT_CANCEL;
  }

  if (*value[0] == '~') {
    return XTK_EVENT_OK;                                   // <=
  }

  return XTK_EVENT_OK;                                     // <=
}

Tizen

V523 The 'then' statement is equivalent to the subsequent code fragment. mouse.c 143


static Eina_Bool _move_cb(void *data, int type, void *event)
{
  Ecore_Event_Mouse_Move *move = event;

  mouse_info.move_x = move->root.x;
  mouse_info.move_y = move->root.y;

  if (mouse_info.pressed == false) {
    return ECORE_CALLBACK_RENEW;                 // <=
  }

  return ECORE_CALLBACK_RENEW;                   // <=
}

Tizen

V523 The 'then' statement is equivalent to the 'else' statement. page_setting_all.c 125


static void _content_resize(...., const char *signal)
{
  ....
  if (strcmp(signal, "portrait") == 0) {
    evas_object_size_hint_min_set(s_info.layout,
      ELM_SCALE_SIZE(width), ELM_SCALE_SIZE(height));
  } else {
    evas_object_size_hint_min_set(s_info.layout,
      ELM_SCALE_SIZE(width), ELM_SCALE_SIZE(height));
  }
  ....
}

Tizen

V523 The 'then' statement is equivalent to the 'else' statement. bt-httpproxy.c 383


static void _bt_hps_set_notify_read_status(const char *obj_path,
      guint offset_status, guint read_status, int https_status)
{
  ....
  if (!hps_notify_read_list) {
    /* Store Notification information */
    notify_read_info = g_new0(struct hps_notify_read_info, 1);
    if (notify_read_info) {
      notify_read_info->char_path = g_strdup(obj_path);
      notify_read_info->read_status = read_status;
      notify_read_info->offset_status = offset_status;
      notify_read_info->https_status = https_status;
      hps_notify_read_list = g_slist_append(hps_notify_read_list,
                                            notify_read_info);
    }
    return;
  } else {
    /* Store Notification information */
    notify_read_info = g_new0(struct hps_notify_read_info, 1);
    if (notify_read_info) {
      notify_read_info->char_path = g_strdup(obj_path);
      notify_read_info->read_status = read_status;
      notify_read_info->offset_status = offset_status;
      notify_read_info->https_status = https_status;
      hps_notify_read_list = g_slist_append(hps_notify_read_list,
                                            notify_read_info);
    }
    return;
  }
}

MuseScore

V523 The 'then' statement is equivalent to the 'else' statement. pluginCreator.cpp 84


PluginCreator::PluginCreator(QWidget* parent)
   : QMainWindow(parent)
{
  ....
  if (qApp->layoutDirection() == Qt::LayoutDirection::....) {
    editTools->addAction(actionUndo);
    editTools->addAction(actionRedo);
  }
  else {
    editTools->addAction(actionUndo);
    editTools->addAction(actionRedo);
  }
  ....
}

Audacity

V523 The 'then' statement is equivalent to the 'else' statement. AButton.cpp 297


AButton::AButtonState AButton::GetState()
{
  ....
      if (mIsClicking) {
        state = mButtonIsDown ? AButtonOver : AButtonDown; //ok
      }
      else {
        state = mButtonIsDown ? AButtonDown : AButtonOver; //ok
      }
    }
  }
  else {
    if (mToggle) {
      state = mButtonIsDown ? AButtonDown : AButtonUp; // <= fail
    }
    else {
      state = mButtonIsDown ? AButtonDown : AButtonUp; // <= fail
    }
  }
  return state;
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. ASlider.cpp 394
  • V523 The 'then' statement is equivalent to the 'else' statement. ExpandingToolBar.cpp 297
  • V523 The 'then' statement is equivalent to the 'else' statement. Ruler.cpp 2422

Rosegarden

V523 The 'then' statement is equivalent to the 'else' statement. HydrogenXMLHandler.cpp 476


bool
HydrogenXMLHandler::characters(const QString& chars)
{
 bool rc=false;

 if (m_version=="") {
   /* no version yet, use 093 */
   rc=characters_093(chars);
 }
 else {
   /* select version dependant function */
   rc=characters_093(chars);
 }
 return rc;
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. HydrogenXMLHandler.cpp 182
  • V523 The 'then' statement is equivalent to the 'else' statement. HydrogenXMLHandler.cpp 358

Steinberg SDKs

V523 The 'then' statement is equivalent to the 'else' statement. mdaJX10Processor.cpp 522


void JX10Processor::noteOn (....)
{
  ....
  if (!polyMode) //monophonic retriggering
  {
    voice[v].env += SILENCE + SILENCE;
  }
  else
  {
    //if (params[15] < 0.28f)
    //{
    //  voice[v].f0 = voice[v].f1 = voice[v].f2 = 0.0f;
    //  voice[v].env = SILENCE + SILENCE;
    //  voice[v].fenv = 0.0f;
    //}
    //else
    voice[v].env += SILENCE + SILENCE; //anti-glitching trick
  }
  ....
}

PDFium

V523 CWE-691 The 'then' statement is equivalent to the 'else' statement. cpwl_edit_impl.cpp 1580


bool CPWL_EditImpl::Backspace(bool bAddUndo, bool bPaint) {
  ....
  if (m_wpCaret.nSecIndex != m_wpOldCaret.nSecIndex) {
    AddEditUndoItem(pdfium::MakeUnique<CFXEU_Backspace>(
      this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset));
  } else {
    AddEditUndoItem(pdfium::MakeUnique<CFXEU_Backspace>(
      this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset));
  }
  ....
}

Regardless of a condition, one and the same action is executed. Most likely, there's some sort of a typo.

Similar errors can be found in some other places:

  • V523 CWE-691 The 'then' statement is equivalent to the 'else' statement. cpwl_edit_impl.cpp 1616
  • V523 CWE-691 The 'then' statement is equivalent to the 'else' statement. cpdf_formfield.cpp 172
  • V523 CWE-691 The 'then' statement is equivalent to the 'else' statement. cjs_field.cpp 2323

RT-Thread

V523 CWE-691 The 'then' statement is equivalent to the 'else' statement. gd32f4xx_can.c 254


void can_debug_freeze_disable(uint32_t can_periph)
{
  CAN_CTL(can_periph) &= ~CAN_CTL_DFZ;
  if(CAN0 == can_periph){
    dbg_periph_disable(DBG_CAN0_HOLD);
  }else{
    dbg_periph_disable(DBG_CAN0_HOLD);
  }
}

Krita

V523 The 'then' statement is equivalent to the 'else' statement. kis_processing_applicator.cpp 227


void KisProcessingApplicator::applyVisitorAllFrames(....)
{
  KisLayerUtils::FrameJobs jobs;

  if (m_flags.testFlag(RECURSIVE)) {
    KisLayerUtils::updateFrameJobsRecursive(&jobs, m_node);
  } else {
    KisLayerUtils::updateFrameJobsRecursive(&jobs, m_node);
  }
  ....
}

Amazon Lumberyard

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


void TranslateVariableNameByOperandType(....)
{
  //  Igor: yet another Qualcomm's special case
  //  GLSL compiler thinks that -2147483648 is
  //  an integer overflow which is not
  if (*((int*)(&psOperand->afImmediates[0])) == 2147483648)
  {
    bformata(glsl, "-2147483647-1");
  }
  else
  {
    //  Igor: this is expected to fix
    //  paranoid compiler checks such as Qualcomm's
    if (*((unsigned int*)(&psOperand->afImmediates[0])) >= 2147483648)
    {
      bformata(glsl, "%d",
          *((int*)(&psOperand->afImmediates[0])));
    }
    else
    {
      bformata(glsl, "%d",
          *((int*)(&psOperand->afImmediates[0])));
    }
  }
  bcatcstr(glsl, ")");
  ....
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. livingentity.cpp 1385
  • V523 The 'then' statement is equivalent to the 'else' statement. tometalinstruction.c 4201
  • V523 The 'then' statement is equivalent to the 'else' statement. scripttable.cpp 905
  • And 5 additional diagnostic messages.

Perl 5

V523 The 'then' statement is equivalent to the 'else' statement. toke.c 12056


static U8 *
S_add_utf16_textfilter(pTHX_ U8 *const s, bool reversed)
{
  ....
  SvCUR_set(PL_linestr, 0);
  if (FILTER_READ(0, PL_linestr, 0)) {
    SvUTF8_on(PL_linestr);
  } else {
    SvUTF8_on(PL_linestr);
  }
  PL_bufend = SvEND(PL_linestr);
  return (U8*)SvPVX(PL_linestr);
}

Qt

V523 CWE-691 The 'then' statement is equivalent to the 'else' statement. qgraphicsscene_bsp.cpp 179


QString QGraphicsSceneBspTree::debug(int index) const
{
  ....
  if (node->type == Node::Horizontal) {
    tmp += debug(firstChildIndex(index));
    tmp += debug(firstChildIndex(index) + 1);
  } else {
    tmp += debug(firstChildIndex(index));
    tmp += debug(firstChildIndex(index) + 1);
  }
  ....
}

NCBI Genome Workbench

V523 The 'then' statement is equivalent to the subsequent code fragment. vcf_reader.cpp 1105


bool
CVcfReader::xAssignFeatureLocationSet(....)
{
  ....
  if (data.m_SetType == CVcfData::ST_ALL_DEL) {
    if (data.m_strRef.size() == 1) {
      //deletion of a single base
      pFeat->SetLocation().SetPnt().SetPoint(data.m_iPos-1);
      pFeat->SetLocation().SetPnt().SetId(*pId);
    }
    else {
      pFeat->SetLocation().SetInt().SetFrom(data.m_iPos-1);
      //-1 for 0-based,
      //another -1 for inclusive end-point ( i.e. [], not [) )
      pFeat->SetLocation().SetInt().SetTo(
         data.m_iPos -1 + data.m_strRef.length() - 1);
      pFeat->SetLocation().SetInt().SetId(*pId);
    }
    return true;
  }

  //default: For MNV's we will use the single starting point
  //NB: For references of size >=2, this location will not
  //match the reference allele.  Future Variation-ref
  //normalization code will address these issues,
  //and obviate the need for this code altogether.
  if (data.m_strRef.size() == 1) {
    //deletion of a single base
    pFeat->SetLocation().SetPnt().SetPoint(data.m_iPos-1);
    pFeat->SetLocation().SetPnt().SetId(*pId);
  }
  else {
    pFeat->SetLocation().SetInt().SetFrom(data.m_iPos-1);
    pFeat->SetLocation().SetInt().SetTo(
      data.m_iPos -1 + data.m_strRef.length() - 1);
    pFeat->SetLocation().SetInt().SetId(*pId);
  }
  return true;
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. blk.c 2142
  • V523 The 'then' statement is equivalent to the subsequent code fragment. odbc.c 379
  • V523 The 'then' statement is equivalent to the subsequent code fragment. odbc.c 1414
  • And 8 additional diagnostic messages.

LibreOffice

V523 The 'then' statement is equivalent to the 'else' statement. svdpdf.hxx 146


/// Transform the rectangle (left, right, top, bottom) by this Matrix.
template <typename T> void Transform(....)
{
  ....
  if (top > bottom)
      top = std::max(leftTopY, rightTopY);
  else
      top = std::min(leftTopY, rightTopY);

  if (top > bottom)
      bottom = std::max(leftBottomY, rightBottomY);  // <=
  else
      bottom = std::max(leftBottomY, rightBottomY);  // <=
}

LibreOffice

V523 The 'then' statement is equivalent to the 'else' statement. docxattributeoutput.cxx 1571


void DocxAttributeOutput::DoWritePermissionTagEnd(
  const OUString & permission)
{
    OUString permissionIdAndName;

    if (permission.startsWith("permission-for-group:", &permissionIdAndName))
    {
        const sal_Int32 sparatorIndex = permissionIdAndName.indexOf(':');
        const OUString permissionId   = permissionIdAndName.copy(....);
        const OString rId             = OUStringToOString(....).getStr();

        m_pSerializer->singleElementNS(XML_w, XML_permEnd,
            FSNS(XML_w, XML_id), rId.getStr(),
            FSEND);
    }
    else
    {
        const sal_Int32 sparatorIndex = permissionIdAndName.indexOf(':');
        const OUString permissionId   = permissionIdAndName.copy(....);
        const OString rId             = OUStringToOString(....).getStr();

        m_pSerializer->singleElementNS(XML_w, XML_permEnd,
            FSNS(XML_w, XML_id), rId.getStr(),
            FSEND);
    }
}

Qalculate!

V523 The 'then' statement is equivalent to the 'else' statement. Number.cc 4018


bool Number::square()
{
  ....
  if(mpfr_cmpabs(i_value->internalLowerFloat(),
                 i_value->internalUpperFloat()) > 0) {
    mpfr_sqr(f_tmp, i_value->internalLowerFloat(), MPFR_RNDU);
    mpfr_sub(f_rl, f_rl, f_tmp, MPFR_RNDD);
  } else {
    mpfr_sqr(f_tmp, i_value->internalLowerFloat(), MPFR_RNDU);
    mpfr_sub(f_rl, f_rl, f_tmp, MPFR_RNDD);
  }
  ....
}

Haiku Operation System

V523 The 'then' statement is equivalent to the 'else' statement. subr_gtaskqueue.c 191


#define  TQ_LOCK(tq)              \
  do {                \
    if ((tq)->tq_spin)          \
      mtx_lock_spin(&(tq)->tq_mutex);      \
    else              \
      mtx_lock(&(tq)->tq_mutex);      \
  } while (0)
#define  TQ_ASSERT_LOCKED(tq)  mtx_assert(&(tq)->tq_mutex, MA_OWNED)

#define  TQ_UNLOCK(tq)              \
  do {                \
    if ((tq)->tq_spin)          \
      mtx_unlock_spin(&(tq)->tq_mutex);    \
    else              \
      mtx_unlock(&(tq)->tq_mutex);      \
  } while (0)

void
grouptask_block(struct grouptask *grouptask)
{
  ....
  TQ_LOCK(queue);
  gtask->ta_flags |= TASK_NOENQUEUE;
  gtaskqueue_drain_locked(queue, gtask);
  TQ_UNLOCK(queue);
}

void
grouptask_block(struct grouptask *grouptask)
{
  ....
  do { if ((queue)->tq_spin) mtx_lock(&(queue)->tq_mutex);
       else mtx_lock(&(queue)->tq_mutex); } while (0);
  gtask->ta_flags |= 0x4;
  gtaskqueue_drain_locked(queue, gtask);
   do { if ((queue)->tq_spin) mtx_unlock(&(queue)->tq_mutex);
        else mtx_unlock(&(queue)->tq_mutex); } while (0);
}

mutex.h
/* on FreeBSD these are different functions */
#define mtx_lock_spin(x)   mtx_lock(x)
#define mtx_unlock_spin(x) mtx_unlock(x)

libarchive

V523 The 'then' statement is equivalent to the subsequent code fragment. archive_read_support_format_ar.c 415


static int
_ar_read_header(struct archive_read *a, struct archive_entry *entry,
  struct ar *ar, const char *h, size_t *unconsumed)
{
  ....
  /*
   * "__.SYMDEF" is a BSD archive symbol table.
   */
  if (strcmp(filename, "__.SYMDEF") == 0) {
    archive_entry_copy_pathname(entry, filename);
    /* Parse the time, owner, mode, size fields. */
    return (ar_parse_common_header(ar, entry, h));
  }

  /*
   * Otherwise, this is a standard entry.  The filename
   * has already been trimmed as much as possible, based
   * on our current knowledge of the format.
   */
  archive_entry_copy_pathname(entry, filename);
  return (ar_parse_common_header(ar, entry, h));
}

ROOT

V523 The 'then' statement is equivalent to the 'else' statement. TKDTree.cxx 805


template <typename  Index, typename Value>
void TKDTree<Index, Value>::UpdateRange(....)
{
  ....
  if (point[fAxis[inode]]<=fValue[inode]){
    //first examine the node that contains the point
    UpdateRange(GetLeft(inode),point, range, res);
    UpdateRange(GetRight(inode),point, range, res);
  } else {
    UpdateRange(GetLeft(inode),point, range, res);
    UpdateRange(GetRight(inode),point, range, res);
  }
  ....
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. TContainerConverters.cxx 51
  • V523 The 'then' statement is equivalent to the 'else' statement. TWebFile.cxx 1310
  • V523 The 'then' statement is equivalent to the 'else' statement. MethodMLP.cxx 423
  • And 1 additional diagnostic messages.

Command & Conquer

V523 The 'then' statement is equivalent to the 'else' statement. RADAR.CPP 1827


void RadarClass::Player_Names(bool on)
{
  IsPlayerNames = on;
  IsToRedraw = true;
  if (on) {
    Flag_To_Redraw(true);
//    Flag_To_Redraw(false);
  } else {
    Flag_To_Redraw(true);   // force drawing of the plate
  }
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. CELL.CPP 1792
  • V523 The 'then' statement is equivalent to the 'else' statement. RADAR.CPP 2274

Qemu

V523 The 'then' statement is equivalent to the 'else' statement. cp0_helper.c 383


target_ulong helper_mftc0_cause(CPUMIPSState *env)
{
  ....
  CPUMIPSState *other = mips_cpu_map_tc(env, &other_tc);

  if (other_tc == other->current_tc) {
    tccause = other->CP0_Cause;
  } else {
    tccause = other->CP0_Cause;
  }
  ....
}

PPrint

V523 The 'then' statement is equivalent to the 'else' statement. pprint.hpp 715


template <typename Container>
typename std::enable_if<......>::type print_internal(......) {
  ....
  for (size_t i = 1; i < value.size() - 1; i++) {
    print_internal(value[i], indent + indent_, "", level + 1);
    if (is_container<T>::value == false)
      print_internal_without_quotes(", ", 0, "\n");
    else
      print_internal_without_quotes(", ", 0, "\n");
  }
  ....
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. pprint.hpp 780
  • V523 The 'then' statement is equivalent to the 'else' statement. pprint.hpp 851
  • V523 The 'then' statement is equivalent to the 'else' statement. pprint.hpp 927
  • And 1 additional diagnostic messages.

Espressif IoT Development Framework

V523 The 'then' statement is equivalent to the 'else' statement. timer.c 292


esp_err_t timer_isr_register(....)
{
  ....
  if ((intr_alloc_flags & ESP_INTR_FLAG_EDGE) == 0) {
    intr_source = ETS_TG1_T0_LEVEL_INTR_SOURCE + timer_num;
  } else {
    intr_source = ETS_TG1_T0_LEVEL_INTR_SOURCE + timer_num;
  }
  ....
}

MuseScore

V523 The 'then' statement is equivalent to the 'else' statement. bsp.cpp 194


QString BspTree::debug(int index) const
{
  ....
  if (node->type == Node::Type::HORIZONTAL) {
    tmp += debug(firstChildIndex(index));
    tmp += debug(firstChildIndex(index) + 1);
  } else {
    tmp += debug(firstChildIndex(index));
    tmp += debug(firstChildIndex(index) + 1);
  }
  ....
}

TheXTech

V523 The 'then' statement is equivalent to the 'else' statement. thextech npc_hit.cpp 1546


if(NPC[C].Projectile && !(NPC[C].Type >= 117 && NPC[C].Type <= 120))
{
  if(!(NPC[A].Type == 24 && NPC[C].Type == 13))
    NPC[A].Killed = B;
  else
    NPC[A].Killed = B;
}

Blend2D

V523 The 'then' statement is equivalent to the 'else' statement. pixelconverter.cpp 1215


template<typename PixelAccess, bool AlwaysUnaligned>
static BLResult BL_CDECL bl_convert_argb32_from_prgb_any(....)
{
  for (uint32_t y = h; y != 0; y--) {
    if (!AlwaysUnaligned && blIsAligned(srcData, PixelAccess::kSize))
    {
      for (uint32_t i = w; i != 0; i--) {
        uint32_t pix = PixelAccess::fetchA(srcData);
        uint32_t r = (((pix >> rShift) & rMask) * rScale) >> 16;
        uint32_t g = (((pix >> gShift) & gMask) * gScale) >> 8;
        uint32_t b = (((pix >> bShift) & bMask) * bScale) >> 8;
        uint32_t a = (((pix >> aShift) & aMask) * aScale) >> 24;

        BLPixelOps::unpremultiply_rgb_8bit(r, g, b, a);
        blMemWriteU32a(dstData, (a << 24) | (r << 16) | (g << 8) | b);

        dstData += 4;
        srcData += PixelAccess::kSize;
      }
    }
    else {
      for (uint32_t i = w; i != 0; i--) {
        uint32_t pix = PixelAccess::fetchA(srcData);
        uint32_t r = (((pix >> rShift) & rMask) * rScale) >> 16;
        uint32_t g = (((pix >> gShift) & gMask) * gScale) >> 8;
        uint32_t b = (((pix >> bShift) & bMask) * bScale) >> 8;
        uint32_t a = (((pix >> aShift) & aMask) * aScale) >> 24;

        BLPixelOps::unpremultiply_rgb_8bit(r, g, b, a);
        blMemWriteU32a(dstData, (a << 24) | (r << 16) | (g << 8) | b);

        dstData += 4;
        srcData += PixelAccess::kSize;
      }
    }
    // ....
  }
}

Overgrowth

V523 The 'then' statement is equivalent to the 'else' statement. skeleton.cpp 152


void Skeleton::SetGravity( bool enable )
{
  if(enable)
  {
    for(unsigned i=0; i<physics_bones.size(); i++)
    {
      if(!physics_bones[i].bullet_object)
      {
        continue;
      }
      physics_bones[i].bullet_object->SetGravity(true);
      //physics_bones[i].bullet_object->SetDamping(0.0f);
    }
  }
  else
  {
    for(unsigned i=0; i<physics_bones.size(); i++)
    {
      if(!physics_bones[i].bullet_object)
      {
        continue;
      }
      physics_bones[i].bullet_object->SetGravity(true);
      //physics_bones[i].bullet_object->SetDamping(1.0f);
    }
  }
}

Captain Blood

V523 [CWE-691] The 'then' statement is equivalent to the 'else' statement. TaskViewer.cpp 298


void TaskViewer::SetText(const char * rawText)
{
  // ....
  if (rawText[0] == '#')
  {
    str = rawText;
  }
  else
  {
    str = rawText;
  }
  // ....
}

CodeLite

V523 The 'then' statement is equivalent to the 'else' statement. mainbook.cpp:450, mainbook.cpp:442


void MainBook::GetAllEditors(clEditor::Vec_t& editors, size_t flags)
{
  ....
  if (!(flags & kGetAll_DetachedOnly))
  {
    if (!(flags & kGetAll_RetainOrder))
    {
      // Most of the time we don't care about
      // the order the tabs are stored in
      for (size_t i = 0; i < m_book->GetPageCount(); i++)
      {
        clEditor* editor = dynamic_cast<clEditor*>(m_book->GetPage(i));
        if (editor)
        {
          editors.push_back(editor);
        }
      }
    }
    else
    {
      for (size_t i = 0; i < m_book->GetPageCount(); i++)
      {
        clEditor* editor = dynamic_cast<clEditor*>(m_book->GetPage(i));
        if (editor)
        {
          editors.push_back(editor);
        }
      }
    }
  }
  ....
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. art_metro.cpp:289, art_metro.cpp:287
  • V523 The 'then' statement is equivalent to the 'else' statement. clStatusBar.cpp:151, clStatusBar.cpp:147
  • V523 The 'then' statement is equivalent to the 'else' statement. php_workspace_view.cpp:1001, php_workspace_view.cpp:999
  • And 5 additional diagnostic messages.

GCC

V523 The 'then' statement is equivalent to the 'else' statement. svalue.cc 2009, svalue.cc 1998


void
const_fn_result_svalue::dump_to_pp(pretty_printer *pp,
                                   bool simple) const
{
  if (simple)
  {
    pp_printf (pp, "CONST_FN_RESULT(%qD, {", m_fndecl);
    for (unsigned i = 0; i < m_num_inputs; i++)
    {
      if (i > 0)
        pp_string (pp, ", ");
      dump_input (pp, i, m_input_arr[i], simple);
    }
    pp_string (pp, "})");
  }
  else
  {
    pp_printf (pp, "CONST_FN_RESULT(%qD, {", m_fndecl);
    for (unsigned i = 0; i < m_num_inputs; i++)
    {
      if (i > 0)
        pp_string (pp, ", ");
      dump_input (pp, i, m_input_arr[i], simple);
    }
    pp_string (pp, "})");
  }
}

Qt Creator

V523 [CWE-691] The 'then' statement is equivalent to the 'else' statement. nodemetainfo.cpp 1840


QString NodeMetaInfo::componentFileName() const
{
  if constexpr (!useProjectStorage())
  {
    if (isValid())
    {
      return m_privateData->componentFileName();
    }
  }
  else
  {
    if (isValid())
    {
      return m_privateData->componentFileName();
    }
  }

  return {};
}

qdEngine

V523 [CWE-691] The 'then' statement is equivalent to the 'else' statement. qd_game_object_moving.cpp 2781


const qdGameObjectStateWalk* qdGameObjectMoving::current_walk_state() const
{
  const qdGameObjectState* st = get_cur_state();
  if(!st || st -> state_type() != qdGameObjectState::STATE_WALK){
#ifndef _QUEST_EDITOR
    st = last_walk_state_;
    if(!st || st -> state_type() != qdGameObjectState::STATE_WALK)
      st = get_default_state();
else                                 // <=
    st = get_default_state();
    if(!st) st = get_state(0);
#endif
  }
  ....
}

This is what should have been written here: #else


LLVM/Clang

V523 The 'then' statement is equivalent to the subsequent code fragment. CGOpenMPRuntime.cpp:6040, 6036


const Expr *CGOpenMPRuntime::getNumTeamsExprForTargetDirective(
    CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &MinTeamsVal,
    int32_t &MaxTeamsVal)
{
  ....
  if (isOpenMPParallelDirective(NestedDir->getDirectiveKind()) ||
          isOpenMPSimdDirective(NestedDir->getDirectiveKind())) {
    MinTeamsVal = MaxTeamsVal = 1;
    return nullptr;
  }
  MinTeamsVal = MaxTeamsVal = 1;
  return nullptr;
  ....
}

Similar errors can be found in some other places:

  • V523 The 'then' statement is equivalent to the 'else' statement. Options.cpp 1212

OpenVINO

V523 The 'then' statement is equivalent to the 'else' statement. random_uniform.cpp 120


template <>
void RandomUniform<x64::avx512_core>::initVectors()
{
  ....
  if (m_jcp.out_data_type.size() <= 4)
  {
    static const uint64_t n_inc_arr[8]  =
                              { 0, 1, 2, 3, 4, 5, 6, 7 };
    mov(r64_aux, reinterpret_cast<uintptr_t>(n_inc_arr));
  }
  else
  {
    static const uint64_t n_inc_arr[8]  =
                               { 0, 1, 2, 3, 4, 5, 6, 7 }; // TODO: i64
    mov(r64_aux, reinterpret_cast<uintptr_t>(n_inc_arr));
  }
  ....
}

DPDK

V523 The 'then' statement is equivalent to the 'else' statement. bnx2x.c 1633


static uint32_t bnx2x_send_unload_req(struct bnx2x_softc *sc, int unload_mode)
{
  uint32_t reset_code = 0;

  /* Select the UNLOAD request mode */
  if (unload_mode == UNLOAD_NORMAL) {
    reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
  } else {
    reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
  }
  ....
}

DPDK

V523 The 'then' statement is equivalent to the 'else' statement. txgbe_phy.c 87


static s32 txgbe_read_phy_if(struct txgbe_hw *hw)
{
  ....
  if (!hw->phy.phy_semaphore_mask) {
    if (hw->bus.lan_id)
      hw->phy.phy_semaphore_mask = TXGBE_MNGSEM_SWPHY;
    else
      hw->phy.phy_semaphore_mask = TXGBE_MNGSEM_SWPHY;
  }

  return 0;
}

DPDK

V523 The 'then' statement is equivalent to the 'else' statement. nthw_hif.c 90


struct nthw_hif {
  ....
  nthw_field_t *mp_fld_build_seed;
  ....
};

int nthw_hif_init(nthw_hif_t *p, nthw_fpga_t *p_fpga, int n_instance)
{
  ....
  p->mp_reg_build_seed = NULL;  /* Reg/Fld not present on HIF */

  if (p->mp_reg_build_seed)
    p->mp_fld_build_seed = NULL;  /* Reg/Fld not present on HIF */
  else
    p->mp_fld_build_seed = NULL;
  ....
}

DPDK

V523 The 'then' statement is equivalent to the subsequent code fragment. otx_ep_ethdev.c 728


static int
otx_ep_eth_dev_uninit(struct rte_eth_dev *eth_dev)
{
  if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
    eth_dev->dev_ops = NULL;
    eth_dev->rx_pkt_burst = NULL;
    eth_dev->tx_pkt_burst = NULL;
    return 0;
  }

  eth_dev->dev_ops = NULL;
  eth_dev->rx_pkt_burst = NULL;
  eth_dev->tx_pkt_burst = NULL;

  return 0;
}

close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam