亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? queue.cpp

?? 此文件是實現(xiàn)加解密算法的函數(shù)庫
?? CPP
字號:
// queue.cpp - written and placed in the public domain by Wei Dai

#include "pch.h"
#include "queue.h"
#include "filters.h"

NAMESPACE_BEGIN(CryptoPP)

// this class for use by ByteQueue only
class ByteQueueNode
{
public:
	ByteQueueNode(unsigned int maxSize)
		: buf(maxSize)
	{
		m_head = m_tail = 0;
		next = 0;
	}

	inline unsigned int MaxSize() const {return buf.size();}

	inline unsigned int CurrentSize() const
	{
		return m_tail-m_head;
	}

	inline bool UsedUp() const
	{
		return (m_head==MaxSize());
	}

	inline void Clear()
	{
		m_head = m_tail = 0;
	}

/*	inline unsigned int Put(byte inByte)
	{
		if (MaxSize()==m_tail)
			return 0;

		buf[m_tail++]=inByte;
		return 1;
	}
*/
	inline unsigned int Put(const byte *begin, unsigned int length)
	{
		unsigned int l = STDMIN(length, MaxSize()-m_tail);
		memcpy(buf+m_tail, begin, l);
		m_tail += l;
		return l;
	}

	inline unsigned int Peek(byte &outByte) const
	{
		if (m_tail==m_head)
			return 0;

		outByte=buf[m_head];
		return 1;
	}

	inline unsigned int Peek(byte *target, unsigned int copyMax) const
	{
		unsigned int len = STDMIN(copyMax, m_tail-m_head);
		memcpy(target, buf+m_head, len);
		return len;
	}

	inline unsigned int CopyTo(BufferedTransformation &target, const std::string &channel=BufferedTransformation::NULL_CHANNEL) const
	{
		unsigned int len = m_tail-m_head;
		target.ChannelPut(channel, buf+m_head, len);
		return len;
	}

	inline unsigned int CopyTo(BufferedTransformation &target, unsigned int copyMax, const std::string &channel=BufferedTransformation::NULL_CHANNEL) const
	{
		unsigned int len = STDMIN(copyMax, m_tail-m_head);
		target.ChannelPut(channel, buf+m_head, len);
		return len;
	}

	inline unsigned int Get(byte &outByte)
	{
		unsigned int len = Peek(outByte);
		m_head += len;
		return len;
	}

	inline unsigned int Get(byte *outString, unsigned int getMax)
	{
		unsigned int len = Peek(outString, getMax);
		m_head += len;
		return len;
	}

	inline unsigned int TransferTo(BufferedTransformation &target, const std::string &channel=BufferedTransformation::NULL_CHANNEL)
	{
		unsigned int len = m_tail-m_head;
		target.ChannelPutModifiable(channel, buf+m_head, len);
		m_head = m_tail;
		return len;
	}

	inline unsigned int TransferTo(BufferedTransformation &target, unsigned int transferMax, const std::string &channel=BufferedTransformation::NULL_CHANNEL)
	{
		unsigned int len = STDMIN(transferMax, m_tail-m_head);
		target.ChannelPutModifiable(channel, buf+m_head, len);
		m_head += len;
		return len;
	}

	inline unsigned int Skip(unsigned int skipMax)
	{
		unsigned int len = STDMIN(skipMax, m_tail-m_head);
		m_head += len;
		return len;
	}

	inline byte operator[](unsigned int i) const
	{
		return buf[m_head+i];
	}

	ByteQueueNode *next;

	SecByteBlock buf;
	unsigned int m_head, m_tail;
};

// ********************************************************

ByteQueue::ByteQueue(unsigned int m_nodeSize)
	: m_nodeSize(m_nodeSize), m_lazyLength(0)
{
	m_head = m_tail = new ByteQueueNode(m_nodeSize);
}

ByteQueue::ByteQueue(const ByteQueue &copy)
{
	CopyFrom(copy);
}

void ByteQueue::CopyFrom(const ByteQueue &copy)
{
	m_lazyLength = 0;
	m_nodeSize = copy.m_nodeSize;
	m_head = m_tail = new ByteQueueNode(*copy.m_head);

	for (ByteQueueNode *current=copy.m_head->next; current; current=current->next)
	{
		m_tail->next = new ByteQueueNode(*current);
		m_tail = m_tail->next;
	}

	m_tail->next = NULL;

	Put(copy.m_lazyString, copy.m_lazyLength);
}

ByteQueue::~ByteQueue()
{
	Destroy();
}

void ByteQueue::Destroy()
{
	ByteQueueNode *next;

	for (ByteQueueNode *current=m_head; current; current=next)
	{
		next=current->next;
		delete current;
	}
}

void ByteQueue::IsolatedInitialize(const NameValuePairs &parameters)
{
	m_nodeSize = parameters.GetIntValueWithDefault("NodeSize", 256);
	Clear();
}

unsigned long ByteQueue::CurrentSize() const
{
	unsigned long size=0;

	for (ByteQueueNode *current=m_head; current; current=current->next)
		size += current->CurrentSize();

	return size + m_lazyLength;
}

bool ByteQueue::IsEmpty() const
{
	return m_head==m_tail && m_head->CurrentSize()==0 && m_lazyLength==0;
}

void ByteQueue::Clear()
{
	Destroy();
	m_head = m_tail = new ByteQueueNode(m_nodeSize);
	m_lazyLength = 0;
}

unsigned int ByteQueue::Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking)
{
	if (m_lazyLength > 0)
		FinalizeLazyPut();

	unsigned int len;
	while ((len=m_tail->Put(inString, length)) < length)
	{
		m_tail->next = new ByteQueueNode(m_nodeSize);
		m_tail = m_tail->next;
		inString += len;
		length -= len;
	}

	return 0;
}

void ByteQueue::CleanupUsedNodes()
{
	while (m_head != m_tail && m_head->UsedUp())
	{
		ByteQueueNode *temp=m_head;
		m_head=m_head->next;
		delete temp;
	}

	if (m_head->CurrentSize() == 0)
		m_head->Clear();
}

void ByteQueue::LazyPut(const byte *inString, unsigned int size)
{
	if (m_lazyLength > 0)
		FinalizeLazyPut();
	m_lazyString = inString;
	m_lazyLength = size;
}

void ByteQueue::UndoLazyPut(unsigned int size)
{
	if (m_lazyLength < size)
		throw InvalidArgument("ByteQueue: size specified for UndoLazyPut is too large");

	m_lazyLength -= size;
}

void ByteQueue::FinalizeLazyPut()
{
	unsigned int len = m_lazyLength;
	m_lazyLength = 0;
	if (len)
		Put(m_lazyString, len);
}

unsigned int ByteQueue::Get(byte &outByte)
{
	if (m_head->Get(outByte))
	{
		if (m_head->UsedUp())
			CleanupUsedNodes();
		return 1;
	}
	else if (m_lazyLength > 0)
	{
		outByte = *m_lazyString++;
		m_lazyLength--;
		return 1;
	}
	else
		return 0;
}

unsigned int ByteQueue::Get(byte *outString, unsigned int getMax)
{
	ArraySink sink(outString, getMax);
	return TransferTo(sink, getMax);
}

unsigned int ByteQueue::Peek(byte &outByte) const
{
	if (m_head->Peek(outByte))
		return 1;
	else if (m_lazyLength > 0)
	{
		outByte = *m_lazyString;
		return 1;
	}
	else
		return 0;
}

unsigned int ByteQueue::Peek(byte *outString, unsigned int peekMax) const
{
	ArraySink sink(outString, peekMax);
	return CopyTo(sink, peekMax);
}

unsigned int ByteQueue::TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel, bool blocking)
{
	if (blocking)
	{
		unsigned long bytesLeft = transferBytes;
		for (ByteQueueNode *current=m_head; bytesLeft && current; current=current->next)
			bytesLeft -= current->TransferTo(target, bytesLeft, channel);
		CleanupUsedNodes();

		unsigned int len = (unsigned int)STDMIN(bytesLeft, (unsigned long)m_lazyLength);
		if (len)
		{
			target.ChannelPut(channel, m_lazyString, len);
			m_lazyString += len;
			m_lazyLength -= len;
			bytesLeft -= len;
		}
		transferBytes -= bytesLeft;
		return 0;
	}
	else
	{
		Walker walker(*this);
		unsigned int blockedBytes = walker.TransferTo2(target, transferBytes, channel, blocking);
		Skip(transferBytes);
		return blockedBytes;
	}
}

unsigned int ByteQueue::CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end, const std::string &channel, bool blocking) const
{
	Walker walker(*this);
	walker.Skip(begin);
	unsigned long transferBytes = end-begin;
	unsigned int blockedBytes = walker.TransferTo2(target, transferBytes, channel, blocking);
	begin += transferBytes;
	return blockedBytes;
}

void ByteQueue::Unget(byte inByte)
{
	Unget(&inByte, 1);
}

void ByteQueue::Unget(const byte *inString, unsigned int length)
{
	// TODO: make this more efficient
	ByteQueueNode *newHead = new ByteQueueNode(length);
	newHead->next = m_head;
	m_head = newHead;
	m_head->Put(inString, length);
}

const byte * ByteQueue::Spy(unsigned int &contiguousSize) const
{
	contiguousSize = m_head->m_tail - m_head->m_head;
	if (contiguousSize == 0 && m_lazyLength > 0)
	{
		contiguousSize = m_lazyLength;
		return m_lazyString;
	}
	else
		return m_head->buf + m_head->m_head;
}

byte * ByteQueue::CreatePutSpace(unsigned int &size)
{
	if (m_lazyLength > 0)
		FinalizeLazyPut();

	if (m_tail->m_tail == m_tail->MaxSize())
	{
		m_tail->next = new ByteQueueNode(size < m_nodeSize ? m_nodeSize : STDMAX(m_nodeSize, 1024U));
		m_tail = m_tail->next;
	}

	size = m_tail->MaxSize() - m_tail->m_tail;
	return m_tail->buf + m_tail->m_tail;
}

ByteQueue & ByteQueue::operator=(const ByteQueue &rhs)
{
	Destroy();
	CopyFrom(rhs);
	return *this;
}

bool ByteQueue::operator==(const ByteQueue &rhs) const
{
	const unsigned long currentSize = CurrentSize();

	if (currentSize != rhs.CurrentSize())
		return false;

	Walker walker1(*this), walker2(rhs);
	byte b1, b2;

	while (walker1.Get(b1) && walker2.Get(b2))
		if (b1 != b2)
			return false;

	return true;
}

byte ByteQueue::operator[](unsigned long i) const
{
	for (ByteQueueNode *current=m_head; current; current=current->next)
	{
		if (i < current->CurrentSize())
			return (*current)[i];
		
		i -= current->CurrentSize();
	}

	assert(i < m_lazyLength);
	return m_lazyString[i];
}

void ByteQueue::swap(ByteQueue &rhs)
{
	std::swap(m_nodeSize, rhs.m_nodeSize);
	std::swap(m_head, rhs.m_head);
	std::swap(m_tail, rhs.m_tail);
	std::swap(m_lazyString, rhs.m_lazyString);
	std::swap(m_lazyLength, rhs.m_lazyLength);
}

// ********************************************************

void ByteQueue::Walker::IsolatedInitialize(const NameValuePairs &parameters)
{
	m_node = m_queue.m_head;
	m_position = 0;
	m_offset = 0;
	m_lazyString = m_queue.m_lazyString;
	m_lazyLength = m_queue.m_lazyLength;
}

unsigned int ByteQueue::Walker::Get(byte &outByte)
{
	ArraySink sink(&outByte, 1);
	return TransferTo(sink, 1);
}

unsigned int ByteQueue::Walker::Get(byte *outString, unsigned int getMax)
{
	ArraySink sink(outString, getMax);
	return TransferTo(sink, getMax);
}

unsigned int ByteQueue::Walker::Peek(byte &outByte) const
{
	ArraySink sink(&outByte, 1);
	return CopyTo(sink, 1);
}

unsigned int ByteQueue::Walker::Peek(byte *outString, unsigned int peekMax) const
{
	ArraySink sink(outString, peekMax);
	return CopyTo(sink, peekMax);
}

unsigned int ByteQueue::Walker::TransferTo2(BufferedTransformation &target, unsigned long &transferBytes, const std::string &channel, bool blocking)
{
	unsigned long bytesLeft = transferBytes;
	unsigned int blockedBytes = 0;

	while (m_node)
	{
		unsigned int len = STDMIN(bytesLeft, (unsigned long)m_node->CurrentSize()-m_offset);
		blockedBytes = target.ChannelPut2(channel, m_node->buf+m_node->m_head+m_offset, len, 0, blocking);

		if (blockedBytes)
			goto done;

		m_position += len;
		bytesLeft -= len;

		if (!bytesLeft)
		{
			m_offset += len;
			goto done;
		}

		m_node = m_node->next;
		m_offset = 0;
	}

	if (bytesLeft && m_lazyLength)
	{
		unsigned int len = (unsigned int)STDMIN(bytesLeft, (unsigned long)m_lazyLength);
		unsigned int blockedBytes = target.ChannelPut2(channel, m_lazyString, len, 0, blocking);
		if (blockedBytes)
			goto done;

		m_lazyString += len;
		m_lazyLength -= len;
		bytesLeft -= len;
	}

done:
	transferBytes -= bytesLeft;
	return blockedBytes;
}

unsigned int ByteQueue::Walker::CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end, const std::string &channel, bool blocking) const
{
	Walker walker(*this);
	walker.Skip(begin);
	unsigned long transferBytes = end-begin;
	unsigned int blockedBytes = walker.TransferTo2(target, transferBytes, channel, blocking);
	begin += transferBytes;
	return blockedBytes;
}

NAMESPACE_END

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美中文字幕不卡| 国产宾馆实践打屁股91| 欧美日韩一区高清| 亚洲一区二区三区中文字幕 | 日本一区二区三区国色天香 | 99r国产精品| 亚洲天天做日日做天天谢日日欢| www.日韩精品| 亚洲一区二区三区爽爽爽爽爽| 欧美伊人精品成人久久综合97| 亚洲成人黄色小说| 日韩免费福利电影在线观看| 久久99久国产精品黄毛片色诱| 精品国产乱码91久久久久久网站| 国产综合色精品一区二区三区| 国产偷国产偷精品高清尤物| gogogo免费视频观看亚洲一| 一区二区三区美女视频| 欧美男人的天堂一二区| 另类调教123区| 国产精品三级在线观看| 欧美艳星brazzers| 蜜桃av噜噜一区| 国产精品日产欧美久久久久| 色妹子一区二区| 美女视频黄频大全不卡视频在线播放| 久久香蕉国产线看观看99| av电影在线观看一区| 亚洲成人免费视频| 久久精品亚洲一区二区三区浴池| 99久久精品国产导航| 免费国产亚洲视频| 中文字幕一区二区不卡| 欧美精品久久天天躁| 国产超碰在线一区| 亚洲国产三级在线| 欧美激情综合五月色丁香小说| 在线亚洲人成电影网站色www| 奇米精品一区二区三区在线观看一| 久久久久久久综合狠狠综合| 欧美性大战久久久久久久蜜臀| 六月婷婷色综合| 一区二区三区中文在线观看| 精品999在线播放| 欧美日韩一区二区电影| 成人性生交大合| 蜜臀久久久久久久| 亚洲美女免费视频| 国产三区在线成人av| 在线播放中文一区| 色偷偷成人一区二区三区91 | 国产麻豆一精品一av一免费| 亚洲裸体在线观看| 国产亚洲美州欧州综合国| 欧美日韩一区二区三区高清| 成人涩涩免费视频| 精品一区二区免费视频| 亚洲一区二区三区四区五区黄| 国产欧美精品国产国产专区 | 日韩欧美中文一区二区| 91福利区一区二区三区| 成人激情开心网| 国产一区二区免费视频| 日本视频一区二区| 亚洲成人av电影| 夜夜亚洲天天久久| 最好看的中文字幕久久| 国产网站一区二区| 国产片一区二区三区| 欧美成人性战久久| 日韩免费高清av| 日韩欧美激情一区| 日韩精品一区二区在线| 欧美一卡二卡在线| 欧美一区二区福利在线| 日韩一区二区三区三四区视频在线观看 | 99久久国产综合精品女不卡| 国产成人免费网站| 国产精品99久| 成人午夜看片网址| 成人激情小说乱人伦| 成人一级片网址| av网站免费线看精品| 99综合电影在线视频| 99re这里只有精品6| 99这里只有精品| 在线看一区二区| 欧美日韩精品欧美日韩精品一 | 91麻豆免费观看| 色综合天天做天天爱| 色婷婷av一区二区三区软件| www.综合网.com| 欧美亚洲日本一区| 欧美高清视频在线高清观看mv色露露十八 | 2022国产精品视频| 国产免费观看久久| 亚洲蜜臀av乱码久久精品| 亚洲在线观看免费| 日本欧美在线看| 国产一区视频网站| aaa欧美日韩| 色综合色综合色综合| 欧美日韩一区精品| 久久一区二区三区四区| 国产精品视频观看| 亚洲自拍另类综合| 久久精品国产免费| 成人av在线资源网站| www.亚洲在线| 成人精品国产一区二区4080| 成人毛片老司机大片| 99国产精品99久久久久久| 欧美体内she精视频| 精品美女在线播放| 亚洲欧美成人一区二区三区| 日本不卡高清视频| 成人中文字幕合集| 欧美日韩国产乱码电影| 2022国产精品视频| 亚洲一二三专区| 美腿丝袜在线亚洲一区 | 国产精品视频你懂的| 亚洲一区二区视频在线观看| 韩国v欧美v日本v亚洲v| av成人老司机| 精品日产卡一卡二卡麻豆| 亚洲欧美另类图片小说| 久久www免费人成看片高清| www.欧美日韩| 精品国产免费一区二区三区香蕉| 国产精品久久精品日日| 美国十次了思思久久精品导航| 成人av午夜电影| 欧美成人一区二区三区| 一区二区三区四区在线| 国产精品 日产精品 欧美精品| 欧美亚日韩国产aⅴ精品中极品| 久久在线观看免费| 日韩av电影天堂| 在线视频观看一区| 国产女同互慰高潮91漫画| 天堂资源在线中文精品| 99久久精品国产麻豆演员表| 久久亚洲精精品中文字幕早川悠里| 一区二区不卡在线播放| 高清不卡在线观看av| 精品免费日韩av| 五月婷婷激情综合| 色婷婷综合中文久久一本| 中文字幕不卡在线播放| 麻豆精品视频在线观看视频| 欧美综合一区二区三区| 亚洲国产精品二十页| 国产在线播放一区| 精品国产乱码91久久久久久网站| 石原莉奈在线亚洲二区| 在线看日本不卡| 亚洲色图色小说| 99热国产精品| 中文字幕中文字幕一区二区| 国产精品一二三四区| 精品99一区二区三区| 九色porny丨国产精品| 日韩欧美成人激情| 蜜臀av性久久久久蜜臀aⅴ流畅| 欧美色综合天天久久综合精品| 亚洲日本青草视频在线怡红院| 99久久精品国产观看| 国产精品国产自产拍高清av| 国产99精品视频| 国产欧美日韩卡一| 成人深夜视频在线观看| 国产精品久久久爽爽爽麻豆色哟哟| 国产成人综合精品三级| 亚洲国产精品精华液2区45| 成人在线视频首页| 国产精品久久久久影院| 93久久精品日日躁夜夜躁欧美| 亚洲色图欧美在线| 一本大道综合伊人精品热热| 一区二区三区四区国产精品| 欧美日韩国产高清一区二区| 日韩制服丝袜av| 久久综合九色欧美综合狠狠| 国产在线麻豆精品观看| 国产欧美精品一区| 色综合中文字幕| 日韩国产高清影视| www久久久久| 99久久99久久精品国产片果冻| 亚洲精品成人在线| 欧美一级理论片| 国产福利视频一区二区三区| 国产精品国产三级国产有无不卡| 色欲综合视频天天天| 午夜精品久久久久影视| 日韩三级电影网址| 成人av在线影院| 日韩和欧美一区二区| 国产亚洲视频系列|