Simplity some code (#11000)
Motivation: There was some code that could be simplified. Modification: Simplify code. Result: Code cleanup
This commit is contained in:
parent
ecc12903c5
commit
bb9370f2a2
@ -69,12 +69,10 @@ public class WebSocket00FrameEncoder extends MessageToMessageEncoder<WebSocketFr
|
|||||||
int b4 = dataLen & 0x7F;
|
int b4 = dataLen & 0x7F;
|
||||||
if (b1 == 0) {
|
if (b1 == 0) {
|
||||||
if (b2 == 0) {
|
if (b2 == 0) {
|
||||||
if (b3 == 0) {
|
if (b3 != 0) {
|
||||||
buf.writeByte(b4);
|
|
||||||
} else {
|
|
||||||
buf.writeByte(b3 | 0x80);
|
buf.writeByte(b3 | 0x80);
|
||||||
buf.writeByte(b4);
|
|
||||||
}
|
}
|
||||||
|
buf.writeByte(b4);
|
||||||
} else {
|
} else {
|
||||||
buf.writeByte(b2 | 0x80);
|
buf.writeByte(b2 | 0x80);
|
||||||
buf.writeByte(b3 | 0x80);
|
buf.writeByte(b3 | 0x80);
|
||||||
|
@ -507,9 +507,9 @@ public final class MqttDecoder extends ReplayingDecoder<DecoderState> {
|
|||||||
decodedClientId.value,
|
decodedClientId.value,
|
||||||
willProperties,
|
willProperties,
|
||||||
decodedWillTopic != null ? decodedWillTopic.value : null,
|
decodedWillTopic != null ? decodedWillTopic.value : null,
|
||||||
decodedWillMessage != null ? decodedWillMessage : null,
|
decodedWillMessage,
|
||||||
decodedUserName != null ? decodedUserName.value : null,
|
decodedUserName != null ? decodedUserName.value : null,
|
||||||
decodedPassword != null ? decodedPassword : null);
|
decodedPassword);
|
||||||
return new Result<MqttConnectPayload>(mqttConnectPayload, numberOfBytesConsumed);
|
return new Result<MqttConnectPayload>(mqttConnectPayload, numberOfBytesConsumed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,11 +47,7 @@ public class XmlElementStart extends XmlElement {
|
|||||||
|
|
||||||
XmlElementStart that = (XmlElementStart) o;
|
XmlElementStart that = (XmlElementStart) o;
|
||||||
|
|
||||||
if (!attributes.equals(that.attributes)) {
|
return attributes.equals(that.attributes);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,11 +50,7 @@ public class XmlEntityReference {
|
|||||||
if (name != null ? !name.equals(that.name) : that.name != null) {
|
if (name != null ? !name.equals(that.name) : that.name != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (text != null ? !text.equals(that.text) : that.text != null) {
|
return text != null ? text.equals(that.text) : that.text == null;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,7 +34,7 @@ public final class ConstantTimeUtils {
|
|||||||
* @return {@code 0} if not equal. {@code 1} if equal.
|
* @return {@code 0} if not equal. {@code 1} if equal.
|
||||||
*/
|
*/
|
||||||
public static int equalsConstantTime(int x, int y) {
|
public static int equalsConstantTime(int x, int y) {
|
||||||
int z = -1 ^ (x ^ y);
|
int z = ~(x ^ y);
|
||||||
z &= z >> 16;
|
z &= z >> 16;
|
||||||
z &= z >> 8;
|
z &= z >> 8;
|
||||||
z &= z >> 4;
|
z &= z >> 4;
|
||||||
@ -59,7 +59,7 @@ public final class ConstantTimeUtils {
|
|||||||
* @return {@code 0} if not equal. {@code 1} if equal.
|
* @return {@code 0} if not equal. {@code 1} if equal.
|
||||||
*/
|
*/
|
||||||
public static int equalsConstantTime(long x, long y) {
|
public static int equalsConstantTime(long x, long y) {
|
||||||
long z = -1L ^ (x ^ y);
|
long z = ~(x ^ y);
|
||||||
z &= z >> 32;
|
z &= z >> 32;
|
||||||
z &= z >> 16;
|
z &= z >> 16;
|
||||||
z &= z >> 8;
|
z &= z >> 8;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user