diff options
Diffstat (limited to 'protocols/MSN/src/msn_msgsplit.cpp')
-rw-r--r-- | protocols/MSN/src/msn_msgsplit.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/protocols/MSN/src/msn_msgsplit.cpp b/protocols/MSN/src/msn_msgsplit.cpp index ab0e3bb11d..5f887a8585 100644 --- a/protocols/MSN/src/msn_msgsplit.cpp +++ b/protocols/MSN/src/msn_msgsplit.cpp @@ -21,7 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "msn_global.h"
#include "msn_proto.h"
-
chunkedmsg::chunkedmsg(const char* tid, const size_t totsz, const bool tbychunk)
: size(totsz), recvsz(0), bychunk(tbychunk)
{
@@ -37,19 +36,16 @@ chunkedmsg::~chunkedmsg() void chunkedmsg::add(const char* tmsg, size_t offset, size_t portion)
{
- if (bychunk)
- {
+ if (bychunk) {
size_t oldsz = recvsz;
recvsz += portion;
- msg = (char*)mir_realloc(msg, recvsz + 1);
- memcpy( msg + oldsz, tmsg, portion );
+ msg = (char*)mir_realloc(msg, recvsz + 1);
+ memcpy(msg + oldsz, tmsg, portion);
--size;
}
- else
- {
+ else {
size_t newsz = offset + portion;
- if (newsz > size)
- {
+ if (newsz > size) {
portion = size - offset;
newsz = size;
}
@@ -61,8 +57,7 @@ void chunkedmsg::add(const char* tmsg, size_t offset, size_t portion) bool chunkedmsg::get(char*& tmsg, size_t& tsize)
{
bool alldata = bychunk ? size == 0 : recvsz == size;
- if (alldata)
- {
+ if (alldata) {
msg[recvsz] = 0;
tmsg = msg;
tsize = recvsz;
@@ -74,11 +69,10 @@ bool chunkedmsg::get(char*& tmsg, size_t& tsize) int CMsnProto::addCachedMsg(const char* id, const char* msg, const size_t offset,
- const size_t portion, const size_t totsz, const bool bychunk)
+ const size_t portion, const size_t totsz, const bool bychunk)
{
int idx = msgCache.getIndex((chunkedmsg*)&id);
- if (idx == -1)
- {
+ if (idx == -1) {
msgCache.insert(new chunkedmsg(id, totsz, bychunk));
idx = msgCache.getIndex((chunkedmsg*)&id);
}
|