From 94c2ae932051bfd40cc817ec0be52c1d9543e01c Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Fri, 21 Nov 2008 20:10:36 +0000 Subject: [PATCH] size does not need to be calculated. Merge configuration parameters only if specified. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28711 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../network/protocols/l2cap/l2cap_command.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp b/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp index 7c0d705e64..d383bbbd44 100644 --- a/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp +++ b/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp @@ -130,8 +130,6 @@ l2cap_cmd_rej(uint8 _ident, uint16 _reason, uint16 _mtu, uint16 _scid, uint16 _d bufferHeader->hdr.length += sizeof(bufferHeader->data.cid); } - _m->size = sizeof(bufferHeader->hdr) + bufferHeader->hdr.length; /* TODO: needed ?*/ - bufferHeader->hdr.length = htole16(bufferHeader->hdr.length); bufferHeader.Sync(); @@ -211,8 +209,6 @@ l2cap_cfg_req(uint8 _ident, uint16 _dcid, uint16 _flags, net_buffer* _data) return NULL; } - (_m)->size = sizeof(struct _cfg_req); /* check if needed */ - NetBufferPrepend bufferHeader(_m); status_t status = bufferHeader.Status(); if (status < B_OK) { @@ -231,7 +227,8 @@ l2cap_cfg_req(uint8 _ident, uint16 _dcid, uint16 _flags, net_buffer* _data) /* Add the given data */ // TODO: given data can be freed... merge does it? - gBufferModule->merge(_m, _data, true); + if (_data != NULL) + gBufferModule->merge(_m, _data, true); return _m; } @@ -264,8 +261,9 @@ l2cap_cfg_rsp(uint8 _ident, uint16 _scid, uint16 _flags, uint16 _result, net_buf bufferHeader->param.result = htole16((_result)); bufferHeader.Sync(); - - gBufferModule->merge(_m, _data, true); + + if (_data != NULL) + gBufferModule->merge(_m, _data, true); return _m; @@ -414,8 +412,6 @@ l2cap_info_rsp(uint8 _ident, uint16 _type, uint16 _result, uint16 _mtu) } } - (_m)->size = sizeof(bufferHeader->hdr) + bufferHeader->hdr.length; - bufferHeader->hdr.length = htole16(bufferHeader->hdr.length); bufferHeader.Sync();