From 89f3cf8bbb9dc1fa0fe72f6af6638ac086c7e011 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 29 Nov 2017 09:33:41 +0300 Subject: libevent, telegram, whatsapp moved to deprecated coz doesn't work --- protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp | 113 ------------------------ 1 file changed, 113 deletions(-) delete mode 100644 protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp (limited to 'protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp') diff --git a/protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp b/protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp deleted file mode 100644 index 8dbc044e67..0000000000 --- a/protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * ByteArray.cpp - * - * Created on: 26/06/2012 - * Author: Antonio - */ - -#include "../stdafx.h" // #TODO Remove Miranda-dependency - -#include "ByteArray.h" -#include "WAException.h" -#include "utilities.h" - -ByteArrayOutputStream::ByteArrayOutputStream(int size) -{ - buf.reserve(size); - position = 0; -} - -void ByteArrayOutputStream::setLength(size_t length) -{ - buf.resize(length); -} - -void ByteArrayOutputStream::setPosition(size_t count) -{ - position = count; -} - - -std::vector& ByteArrayOutputStream::getBuffer() -{ - return buf; -} - -void ByteArrayOutputStream::write(int i) -{ - if (this->position == this->buf.size()) - buf.push_back((unsigned char)i); - else - buf[position] = (unsigned char)i; - position++; -} - -void ByteArrayOutputStream::write(unsigned char* b, size_t len) -{ - if (len == 0) - return; - - for (size_t i = 0; i < len; i++) - write(b[i]); -} - -void ByteArrayOutputStream::write(const std::string &s) -{ - for (size_t i = 0; i < s.size(); i++) - write((unsigned char)s[i]); -} - -ByteArrayOutputStream::~ByteArrayOutputStream() -{ -} - -ByteArrayInputStream::ByteArrayInputStream(std::vector* buf, size_t off, size_t length) -{ - this->buf = buf; - this->pos = off; - this->count = min(off + length, buf->size()); -} - -ByteArrayInputStream::ByteArrayInputStream(std::vector* buf) -{ - this->buf = buf; - this->pos = 0; - this->count = buf->size(); -} - -int ByteArrayInputStream::read() -{ - return (pos < count) ? ((*this->buf)[pos++]) : -1; -} - -int ByteArrayInputStream::read(std::vector& b, size_t off, size_t len) -{ - if (len > (b.size() - off)) - throw new WAException("Index out of bounds"); - - if (len == 0) - return 0; - - int c = read(); - if (c == -1) - return -1; - - b[off] = (unsigned char)c; - - size_t i = 1; - try { - for (; i < len; i++) { - c = read(); - if (c == -1) - break; - - b[off + i] = (unsigned char)c; - } - } - catch (std::exception&) { - } - return (int)i; -} - -ByteArrayInputStream::~ByteArrayInputStream() -{} -- cgit v1.2.3