V649. There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless.
V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 67, 70. cannonical_xml.h 70
class xmlInputCharData {
public:
static bool isBaseChar(wchar_t l) {
....
if (l >= 0x06BA && l <= 0x06BE) return true;
if (l >= 0x06C0 && l <= 0x06CE) return true;
if (l >= 0x06D0 && l <= 0x06D3) return true;
if (l == 0x06D5) return true; // <=
if (l >= 0x06E5 && l <= 0x06E6) return true;
if (l >= 0x0905 && l <= 0x0939) return true;
if (l == 0x06D5) return true; // <=
if (l >= 0x0958 && l <= 0x0961) return true;
if (l >= 0x0985 && l <= 0x098C) return true;
if (l >= 0x098F && l <= 0x0990) return true;
....
}
V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 693, 696. cluiframes.c 696
int CLUIFramesGetalClientFrame(void)
{
int i;
if(alclientFrame!=-1)
return alclientFrame;
if(alclientFrame!=-1)
{
/* this value could become invalid if RemoveItemFromList
* was called, so we double-check */
....
}
}
Similar errors can be found in some other places:
V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 243, 262. tr_animation.c 262
#define REFLAG_FULL_LOD 8 // force a FULL lod
#define REFLAG_FORCE_LOD 8 // force a low lod
float R_CalcMDSLod(....)
{
....
if ( refent->reFlags & REFLAG_FULL_LOD )
{
return 1.0f;
}
....
if ( refent->reFlags & REFLAG_FORCE_LOD )
{
flod *= 0.5;
}
....
}
V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 1205, 1206. sbprofilingdata.cpp 1206
int
SbProfilingData::operator == (const SbProfilingData & rhs) const
{
if (this->actionType != rhs.actionType) return FALSE;
if (this->actionStartTime != rhs.actionStopTime) return FALSE;
if (this->actionStartTime != rhs.actionStopTime) return FALSE;
....
}
V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 2918, 2922. LeicaDMI.cpp 2922
int AFC::Initialize()
{
int ret = DEVICE_OK;
....
if (ret != DEVICE_OK)
return ret;
AddAllowedValue("DichroicMirrorIn", "0", 0);
AddAllowedValue("DichroicMirrorIn", "1", 1);
if (ret != DEVICE_OK)
return ret;
....
}
Not terrible, but second if() does not make sense.
Similar errors can be found in some other places:
V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 1672, 1675. writeffmpeg.c 1675
bool BKE_ffmpeg_alpha_channel_is_supported(RenderData *rd)
{
int codec = rd->ffcodecdata.codec;
if (codec == AV_CODEC_ID_QTRLE)
return true;
if (codec == AV_CODEC_ID_PNG)
return true;
if (codec == AV_CODEC_ID_PNG)
return true;
....
}
V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 331, 332. writefile.c 332
static void writedata_do_write(....)
{
if ((wd == NULL) || wd->error ||
(mem == NULL) || memlen < 1) return;
if (wd->error) return;
....
}
V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 4410, 4413. MachODump.cpp 4413
static bool print_class_ro64_t(....) {
....
const char *r;
uint32_t offset, xoffset, left;
....
r = get_pointer_64(p, offset, left, S, info);
if (r == nullptr || left < sizeof(struct class_ro64_t)) // <=
return false; // <=
memset(&cro, '\0', sizeof(struct class_ro64_t));
if (left < sizeof(struct class_ro64_t)) { // <=
memcpy(&cro, r, left);
outs() << " (class_ro_t entends past the .......)\n";
} else
memcpy(&cro, r, sizeof(struct class_ro64_t));
....
}
V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 2282, 2285. ecore_con.c 2285
static Eina_Bool
_ecore_con_cl_handler(void *data,
Ecore_Fd_Handler *fd_handler)
{
Ecore_Con_Server *obj = data;
Eina_Bool want_read, want_write;
Ecore_Con_Server_Data *svr =
eo_data_scope_get(obj, ECORE_CON_SERVER_CLASS);
if (svr->delete_me)
return ECORE_CALLBACK_RENEW;
if (svr->delete_me)
return ECORE_CALLBACK_RENEW;
....
}
V649 CWE-561 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 67, 71. tsf_input_scope.cc 71
STDMETHOD(GetInputScopes)(InputScope** input_scopes,
UINT* count) override
{
if (!count || !input_scopes)
return E_INVALIDARG;
*input_scopes = static_cast<InputScope*>(CoTaskMemAlloc(
sizeof(InputScope) * input_scopes_.size()));
if (!input_scopes) {
*count = 0;
return E_OUTOFMEMORY;
}
....
}
Most likely, a developer forgot to dereference a pointer and the code should actually look like this: if (!*input_scopes) {
V649 CWE-561 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 758, 761. skpathref.cpp 761
bool SkPathRef::isValid() const {
....
if (nullptr == fPoints && 0 != fFreeSpace) {
return false;
}
if (nullptr == fPoints && 0 != fFreeSpace) {
return false;
}
....
}
The same check is performed twice. Or the second check is redundant. Or one forgot to check out something else.
V649 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 125, 137. acctable.cxx 137
STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
if(description == nullptr)
return E_INVALIDARG;
// #CHECK XInterface#
if(!pRXTable.is())
return E_FAIL;
....
SAFE_SYSFREESTRING(*description);
*description = SysAllocString(o3tl::toW(ouStr.getStr()));
if(description==nullptr) // <=
return E_FAIL;
return S_OK;
LEAVE_PROTECTED_BLOCK
}
Similar errors can be found in some other places: