Possible copy-paste error in nsStyleClipPath::nsStyleClipPath()

RESOLVED DUPLICATE of bug 1208901

Status

()

RESOLVED DUPLICATE of bug 1208901
3 years ago
3 years ago

People

(Reporter: ssitter, Unassigned)

Tracking

44 Branch
Points:
---

Firefox Tracking Flags

(firefox44 affected)

Details

(Whiteboard: [pvs-studio])

(Reporter)

Description

3 years ago
From http://www.viva64.com/en/b/0347/:

PVS-Studio's diagnostic message: V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 1060, 1062. nsstylestruct.cpp 1060

nsStyleClipPath::nsStyleClipPath(const nsStyleClipPath& aSource)
{
  if (aSource.mType == NS_STYLE_CLIP_PATH_URL) {
    SetURL(aSource.mURL);
  } else if (aSource.mType == NS_STYLE_CLIP_PATH_SHAPE) {
    SetBasicShape(aSource.mBasicShape, aSource.mSizingBox);
  } else if (aSource.mType == NS_STYLE_CLIP_PATH_SHAPE) {
    SetSizingBox(aSource.mSizingBox);
  }
}

The "if - else if" block contains a duplicated equality check, this error being caused by careless usage of the copy-paste method. It means that the last part of the code, corresponding to the second check for "NS_STYLE_CLIP_PATH_SHAPE", will never be executed.
Blocks: 1072894
Flags: needinfo?(krit)
Flags: needinfo?(cam)
Ehsan filed this too and provided a patch in bug 1208901.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Flags: needinfo?(krit)
Flags: needinfo?(cam)
Resolution: --- → DUPLICATE
Duplicate of bug: 1208901
You need to log in before you can comment on or make changes to this bug.