PIBinaryLog support for uint ID
This commit is contained in:
@@ -366,7 +366,7 @@ PIByteArray PIBinaryLog::readBinLog(int id, PISystemTime * time, int * readed_id
|
|||||||
fileEnd();
|
fileEnd();
|
||||||
return PIByteArray();
|
return PIByteArray();
|
||||||
}
|
}
|
||||||
if (id == 0 && br.id > 0) {
|
if ((id == 0) && (br.id != 0) && (br.id != -1)) {
|
||||||
if (time) *time = br.timestamp;
|
if (time) *time = br.timestamp;
|
||||||
if (readed_id) *readed_id = br.id;
|
if (readed_id) *readed_id = br.id;
|
||||||
return br.data;
|
return br.data;
|
||||||
@@ -434,7 +434,7 @@ ssize_t PIBinaryLog::readDevice(void * read_to, ssize_t max_size) {
|
|||||||
piCoutObj << "End of BinLog file";
|
piCoutObj << "End of BinLog file";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (br.id <= 0) {
|
if (br.id == 0) {
|
||||||
piCoutObj << "Read record error";
|
piCoutObj << "Read record error";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -516,7 +516,7 @@ bool PIBinaryLog::checkFileHeader() {
|
|||||||
|
|
||||||
|
|
||||||
PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
|
PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
|
||||||
// piCoutObj << "readRecord";
|
// piCoutObj << "readRecord pos =" << file.pos();
|
||||||
logmutex.lock();
|
logmutex.lock();
|
||||||
PIByteArray ba;
|
PIByteArray ba;
|
||||||
BinLogRecord br;
|
BinLogRecord br;
|
||||||
@@ -529,10 +529,10 @@ PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
|
|||||||
} else {
|
} else {
|
||||||
br.id = -1;
|
br.id = -1;
|
||||||
logmutex.unlock();
|
logmutex.unlock();
|
||||||
// piCoutObj << "readRecord done";
|
// piCoutObj << "readRecord done" << br.id;
|
||||||
return br;
|
return br;
|
||||||
}
|
}
|
||||||
if (br.id > 0 && br.size > 0) {
|
if ((br.id != 0) && (br.id != -1) && (br.size > 0)) {
|
||||||
ba.resize(br.size);
|
ba.resize(br.size);
|
||||||
if (file.read(ba.data(), ba.size_s()) > 0)
|
if (file.read(ba.data(), ba.size_s()) > 0)
|
||||||
br.data = ba;
|
br.data = ba;
|
||||||
@@ -750,7 +750,7 @@ bool PIBinaryLog::joinBinLogsSerial(const PIStringList & src,
|
|||||||
PISystemTime st;
|
PISystemTime st;
|
||||||
while (!slog.isEnd()) {
|
while (!slog.isEnd()) {
|
||||||
br = slog.readRecord();
|
br = slog.readRecord();
|
||||||
if (br.data.isEmpty() || br.id < 1) continue;
|
if (br.data.isEmpty() || br.id == 0 || br.id == -1) continue;
|
||||||
st = br.timestamp;
|
st = br.timestamp;
|
||||||
lt = dtime + br.timestamp;
|
lt = dtime + br.timestamp;
|
||||||
if (dlog.writeBinLog_raw(br.id, lt, br.data) <= 0) {
|
if (dlog.writeBinLog_raw(br.id, lt, br.data) <= 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user