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

This commit is contained in:
2019-06-24 12:25:19 +00:00
parent 6da4f268d2
commit 8d712e54e5
2 changed files with 8 additions and 1 deletions

View File

@@ -384,7 +384,7 @@ PIByteArray & operator >>(PIByteArray & s, PIByteArray & v) {
int sz = 0;
s >> sz;
if (sz > s.size_s()) {
piCout << "[PIByteArray] Warning: operator >> wants too much data, discard!";
piCout << "[PIByteArray] Warning: operator >> wants too much data, discard!" << sz << s.size_s();
s.clear();
v.clear();
return s;

View File

@@ -362,6 +362,7 @@ int PIBinaryLog::readDevice(void *read_to, int max_size) {
return -1;
}
int sz = piMini(max_size, br.data.size());
if (sz < br.data.size_s()) piCoutObj << "too small read buffer:" << max_size << ", data size:" << br.data.size();
memcpy(read_to, br.data.data(), sz);
return sz;
}
@@ -371,6 +372,7 @@ void PIBinaryLog::restart() {
bool th = isRunning();
if (th) stopThreadedRead();
if (!canRead()) return;
logmutex.unlock();
lastrecord.timestamp = PISystemTime();
lastrecord.id = 0;
is_thread_ok = true;
@@ -418,6 +420,7 @@ bool PIBinaryLog::checkFileHeader() {
PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
// piCoutObj << "readRecord";
logmutex.lock();
PIByteArray ba;
BinLogRecord br;
@@ -430,6 +433,7 @@ PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
} else {
br.id = -1;
logmutex.unlock();
// piCoutObj << "readRecord done";
return br;
}
if (br.id > 0 && br.size > 0) {
@@ -441,6 +445,7 @@ PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
if (br.id == 0) fileError();
moveIndex(index_pos.value(file.pos(), -1));
logmutex.unlock();
// piCoutObj << "readRecord done";
return br;
}
@@ -576,6 +581,7 @@ bool PIBinaryLog::createIndex() {
void PIBinaryLog::seekTo(int rindex) {
// piCoutObj << "seekTo";
logmutex.lock();
if (rindex < index.size_s() && rindex >= 0) {
file.seek(index[rindex].pos);
@@ -583,6 +589,7 @@ void PIBinaryLog::seekTo(int rindex) {
play_time = index[rindex].timestamp.toMilliseconds();
lastrecord.timestamp = index[rindex].timestamp;
}
// piCoutObj << "seekTo done";
logmutex.unlock();
}