Examples of errors detected by the V646 diagnostic.

V646. Consider inspecting the application's logic. It's possible that 'else' keyword is missing.


VirtualDub

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. VirtualDub optdlg.cpp 120


void VDDialogAudioConversionW32::RecomputeBandwidth() {
  ....
  if (IsDlgButtonChecked(mhdlg, IDC_PRECISION_NOCHANGE)) {
    if (mbSourcePrecisionKnown && mbSource16Bit)
      bps *= 2;
    else
      bps = 0;
  } if (IsDlgButtonChecked(mhdlg, IDC_PRECISION_16BIT))
    bps *= 2;
  ....
}

Geant4 software

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. _G4processes-archive g4embiasingmanager.cc 299


G4double
G4EmBiasingManager::ApplySecondaryBiasing(....)
{
  ....
  if(0 == nsplit) {
    if(safety > fSafetyMin) {
      ApplyRangeCut(vd, track, eloss, safety);
    }
  } if(1 == nsplit) {
    weight = ApplyRussianRoulette(vd, index);
  } else {
    G4double tmpEnergy = ....;
    G4ThreeVector tmpMomDir = ....;
    weight = ....;
    pPartChange->SetProposedKineticEnergy(tmpEnergy);
    pPartChange->ProposeMomentumDirection(tmpMomDir);
  }
  ....
}

Identical errors can be found in some other places:

  • V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. _G4processes-archive g4embiasingmanager.cc 347

K Desktop Environment

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. karchive.cpp 187


*bool KArchive::close()
{
  ....
  // if d->saveFile is not null then it is equal to d->dev.
  if ( d->saveFile ) {
    closeSucceeded = d->saveFile->finalize();
    delete d->saveFile;
    d->saveFile = 0;
  } if ( d->deviceOwned ) {                                 // <=
    delete d->dev; // we created it ourselves in open()
  }
  ....
}

Spring Engine

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. streflop s_atanf.cpp 90


Simple __atanf(Simple x)
{
  ....
  ix = hx&0x7fffffff;
  if(ix>=0x50800000) {  /* if |x| >= 2^34 */
      if(ix>0x7f800000)
    return x+x;    /* NaN */
      if(hx>0) return  atanhi[3]+atanlo[3];
      else     return -atanhi[3]-atanlo[3];
  } if (ix < 0x3ee00000) {  /* |x| < 0.4375f */             // <=
      if (ix < 0x31000000) {  /* |x| < 2^-29 */
    if(huge+x>one) return x;  /* raise inexact */
      }
      id = -1;
  } else {
    ....
  }
  ....
}

Simple DirectMedia Layer

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. SDL2 s_atan.c 82


double atan(double x)
{
  double w,s1,s2,z;
  int32_t ix,hx,id;

  GET_HIGH_WORD(hx,x);
  ix = hx&0x7fffffff;
  if(ix>=0x44100000) {  /* if |x| >= 2^66 */
    ....
  } if (ix < 0x3fdc0000) {  /* |x| < 0.4375 */        // <=
      if (ix < 0x3e200000) {  /* |x| < 2^-29 */
    if(huge+x>one) return x;  /* raise inexact */
      }
      id = -1;
  } else {
    ....
  }
  ....
}

Haiku Operation System

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. Filter.cpp 760


uchar
Scaler::Limit(intType value)
{
  if (value < 0) {
    value = 0;
  } if (value > 255) {
    value = 255;
  }
  return value;
}

Telegram

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. Telegram history.cpp 5181


void HistoryImageLink::getState(....
        const HistoryItem *parent, ....)
        const
{
  ....
  int skipx = 0, skipy = 0, height = _height;
  const HistoryReply *reply = toHistoryReply(parent);
  const HistoryForwarded *fwd = reply ? 0 :
                                 toHistoryForwarded(parent);
  ....
  if (reply) {
    skipy = st::msgReplyPadding.top() +
            st::msgReplyBarSize.height() +
            st::msgReplyPadding.bottom();
  } if (fwd) {
    skipy = st::msgServiceNameFont->height +
                st::msgPadding.top();
  }
  ....
}

FreeSWITCH

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. conference_api.c 1532


switch_status_t conference_api_sub_vid_logo_img(....)
{
  ....
  if (!strcasecmp(text, "allclear")) {
    switch_channel_set_variable(member->channel, "....", NULL);
    member->video_logo = NULL;
  } if (!strcasecmp(text, "clear")) {                       // <=
    member->video_logo = NULL;
  } else {
    member->video_logo = switch_core_strdup(member->pool, text);
  }
  ....
}

Mozilla Thunderbird

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. nsnativethemewin.cpp 924


nsresult
nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
                                       uint8_t aWidgetType,
                                       int32_t& aPart,
                                       int32_t& aState)
{
  ....
{
  ....
  if (!aFrame) {
    aState = TS_NORMAL;
  } else {
    if (GetCheckedOrSelected(aFrame, !isCheckbox)) {
      inputState = CHECKED;
  } if (isCheckbox && GetIndeterminate(aFrame)) {
      inputState = INDETERMINATE;
  }
  ....
}   ....
}

Identical errors can be found in some other places:

  • V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. debugger.cpp 4794

FreeBSD Kernel

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. mac_process.c 352


static void
mac_proc_vm_revoke_recurse(struct thread *td, struct ucred *cred,
    struct vm_map *map)
{
  ....
  if (!mac_mmap_revocation_via_cow) {
    vme->max_protection &= ~VM_PROT_WRITE;
    vme->protection &= ~VM_PROT_WRITE;
  } if ((revokeperms & VM_PROT_READ) == 0)   // <=
    vme->eflags |= MAP_ENTRY_COW |
        MAP_ENTRY_NEEDS_COPY;
  ....
}

Identical errors can be found in some other places:

  • V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. x86emu.c 7006
  • V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. x86emu.c 7032
  • V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. x86emu.c 7058
  • And 2 additional diagnostic messages.

Serious Engine 1 v.1.10

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. sessionstate.cpp 1191


void CSessionState::ProcessGameStream(void)
{
  ....
  if (res==CNetworkStream::R_OK) {
    ....
  } if (res==CNetworkStream::R_BLOCKNOTRECEIVEDYET) { // <=
    ....
  } else if (res==CNetworkStream::R_BLOCKMISSING) {
    ....
  }
  ....
}

Identical errors can be found in some other places:

  • V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. terrain.cpp 759

Inkscape

V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing. sp-item.cpp 204


void SPItem::resetEvaluated()
{
  if ( StatusCalculated == _evaluated_status ) {
    ....
  } if ( StatusSet == _evaluated_status ) { // <=
    ....
  }
}


Do you make errors in the code?

Check your code
with PVS-Studio

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

goto PVS-Studio;