Fix redundant condition: '!A || (A && B)' is equivalent to '!A || B'

This commit is contained in:
Ai Lin Chia
2016-06-21 13:15:12 +02:00
parent 1951a30c4a
commit f78c43d82a

@ -239,12 +239,12 @@ bool UrlComponent::Validator::isValid( const UrlComponent &urlPart ) const {
}
if ( m_mandatoryCriteria != MANDATORY_NONE ) {
validMandatory = ( !m_mandatoryAlpha || ( m_mandatoryAlpha && hasAlpha ) ) &&
( !m_mandatoryAlphaLower || ( m_mandatoryAlphaLower && ( hasAlphaHexLower || hasAlphaNoHexLower ) ) ) &&
( !m_mandatoryAlphaUpper || ( m_mandatoryAlphaUpper && ( hasAlphaHexUpper || hasAlphaNoHexUpper ) ) ) &&
( !m_mandatoryAlphaHex || ( m_mandatoryAlphaHex && ( hasAlphaHexLower || hasAlphaHexUpper ) ) ) &&
( !m_mandatoryDigit || ( m_mandatoryDigit && hasDigit ) ) &&
( !m_mandatoryPunctuation || ( m_mandatoryPunctuation && hasPunctuation ) );
validMandatory = ( !m_mandatoryAlpha || hasAlpha ) &&
( !m_mandatoryAlphaLower || hasAlphaHexLower || hasAlphaNoHexLower ) &&
( !m_mandatoryAlphaUpper || hasAlphaHexUpper || hasAlphaNoHexUpper ) &&
( !m_mandatoryAlphaHex || hasAlphaHexLower || hasAlphaHexUpper ) &&
( !m_mandatoryDigit || hasDigit ) &&
( !m_mandatoryPunctuation || hasPunctuation );
}
return ( validAllow && validMandatory );