summaryrefslogtreecommitdiff
path: root/protocols/AimOscar/src/flap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/AimOscar/src/flap.cpp')
-rw-r--r--protocols/AimOscar/src/flap.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/protocols/AimOscar/src/flap.cpp b/protocols/AimOscar/src/flap.cpp
index 96b164fa9c..960034d8a0 100644
--- a/protocols/AimOscar/src/flap.cpp
+++ b/protocols/AimOscar/src/flap.cpp
@@ -18,23 +18,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdafx.h"
-FLAP::FLAP(char* buf,int num_bytes)
+FLAP::FLAP(char* buf, int num_bytes)
{
- if (FLAP_SIZE>num_bytes)
- {
- length_=0;
- }
- else
- {
- length_=_htons((*(unsigned short*)&buf[4]));
- if (FLAP_SIZE+length_>num_bytes)
- {
- length_=0;
- }
- else
- {
- type_=buf[1];
- value_=&buf[FLAP_SIZE];
+ if (FLAP_SIZE > num_bytes)
+ length_ = 0;
+ else {
+ length_ = _htons((*(unsigned short*)&buf[4]));
+ if (FLAP_SIZE + length_ > num_bytes)
+ length_ = 0;
+ else {
+ type_ = buf[1];
+ value_ = &buf[FLAP_SIZE];
}
}
}
@@ -42,17 +36,17 @@ unsigned short FLAP::len()
{
return length_;
}
+
unsigned short FLAP::snaclen()
{
- return length_-10;
+ return length_ - 10;
}
+
int FLAP::cmp(unsigned short type)
{
- if (type_==type)
- return 1;
- else
- return 0;
+ return (type_ == type);
}
+
char* FLAP::val()
{
return value_;