[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [libktorrent/frameworks] src/download: convert ifs to a simple logical statement
From: Nick Shaforostoff <shafff () ukr ! net>
Date: 2015-12-01 1:15:57
Message-ID: E1a3ZXx-0000Q4-UH () scm ! kde ! org
[Download RAW message or body]
Git commit eef66cdc8302824dee064a308ab8bf4cd5f7585c by Nick Shaforostoff.
Committed on 01/12/2015 at 01:15.
Pushed by shaforo into branch 'frameworks'.
convert ifs to a simple logical statement
M +5 -18 src/download/packet.cpp
http://commits.kde.org/libktorrent/eef66cdc8302824dee064a308ab8bf4cd5f7585c
diff --git a/src/download/packet.cpp b/src/download/packet.cpp
index 1f7f383..71f5048 100644
--- a/src/download/packet.cpp
+++ b/src/download/packet.cpp
@@ -93,20 +93,10 @@ namespace bt
bool Packet::isPiece(const Request & req) const
{
- if (data[4] == PIECE)
- {
- if (ReadUint32(data,5) != req.getIndex())
- return false;
-
- if (ReadUint32(data,9) != req.getOffset())
- return false;
-
- if (size - 13 != req.getLength())
- return false;
-
- return true;
- }
- return false;
+ return (data[4] == PIECE)
+ && (ReadUint32(data,5) == req.getIndex())
+ && (ReadUint32(data,9) == req.getOffset())
+ && (size - 13 == req.getLength());
}
Packet* Packet::makeRejectOfPiece()
@@ -145,10 +135,7 @@ namespace bt
*/
bool Packet::isOK() const
{
- if (!data)
- return false;
-
- return true;
+ return bool(data);
}
int Packet::send(net::SocketDevice* sock, Uint32 max_to_send)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic