git-svn-id: svn://db.shs.com.ru/pip@812 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2019-06-25 12:12:45 +00:00
parent 6c7c81559c
commit 95fd35f9a7
2 changed files with 12 additions and 5 deletions

View File

@@ -26,17 +26,24 @@
#define PIQUEUE_H
#include "pideque.h"
#include "pivector.h"
template<typename T>
class PIP_EXPORT PIQueue: public PIDeque<T> {
public:
PIQueue() {;}
virtual ~PIQueue() {;}
PIQueue() {}
virtual ~PIQueue() {}
PIDeque<T> & enqueue(const T & v) {PIDeque<T>::push_front(v); return *this;}
T dequeue() {return PIDeque<T>::take_back();}
T & head() {return PIDeque<T>::back();}
const T & head() const {return PIDeque<T>::back();}
PIVector<T> toVector() {PIVector<T> v(PIDeque<T>::size()); for (uint i = 0; i < PIDeque<T>::size(); ++i) v[i] = PIDeque<T>::at(i); return v;}
PIVector<T> toVector() {
PIVector<T> v(PIDeque<T>::size());
for (uint i = 0; i < PIDeque<T>::size(); ++i)
v[i] = PIDeque<T>::at(i);
return v;
}
};
#endif // PIQUEUE_H

View File

@@ -487,13 +487,13 @@ void PIBinaryLog::parseLog(PIFile * f, PIBinaryLog::BinLogInfo * info, PIVector<
PIByteArray ba;
BinLogRecord br;
bool first = true;
llong hdr_size = sizeof(BinLogRecord) - sizeof(PIByteArray);
size_t hdr_size = sizeof(BinLogRecord) - sizeof(PIByteArray);
ba.resize(hdr_size);
while (1) {
ba.resize(hdr_size);
{
PIMutexLocker _ml(file_mutex);
if (f->read(ba.data(), ba.size_s()) > 0) {
if (f->read(ba.data(), ba.size()) > 0) {
ba >> br.id >> br.size >> br.timestamp;
} else
break;