PIChar ICU fixes
git-svn-id: svn://db.shs.com.ru/pip@95 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -54,9 +54,12 @@ bool PIFileTransfer::send(PIVector<PIFile::FileInfo> entries) {
|
||||
PIVector<PIFile::FileInfo> fls = d.allEntries();
|
||||
scanning = false;
|
||||
d.up();
|
||||
for (int j=0; j<fls.size(); j++) {
|
||||
//piCout << "files rel to" << d.absolutePath();
|
||||
for (int j = 0; j < fls.size(); j++) {
|
||||
allEntries << PFTFileInfo(fls[j]);
|
||||
allEntries.back().dest_path = d.relative(fls[j].path);
|
||||
//piCout << " abs path" << fls[j].path;
|
||||
//piCout << " rel path" << allEntries.back().dest_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,15 +104,15 @@ bool PIFileTransfer::sendFiles(const PIVector<PFTFileInfo> &files) {
|
||||
|
||||
|
||||
void PIFileTransfer::processFile(int id, ullong start, PIByteArray & data) {
|
||||
// piCout << "processFile" << id << files_.size();
|
||||
//piCout << "processFile" << id << files_.size();
|
||||
PFTFileInfo fi = files_[id-1];
|
||||
bytes_file_all = fi.size;
|
||||
bytes_file_cur = start;
|
||||
cur_file_string = fi.dest_path;
|
||||
PIString path = dir.absolutePath() + dir.separator + fi.dest_path;
|
||||
// piCout << "receive" << path << fi.size << data.size();
|
||||
//piCout << "receive" << path << fi.size << data.size();
|
||||
if (fi.isDir()) {
|
||||
// piCoutObj << "make dir" << fi.entry.path;
|
||||
//piCoutObj << "make dir" << fi.entry.path;
|
||||
if (!PIDir::make(path)) {
|
||||
cur_file_string = "ERROR! while create directory " + path;
|
||||
piCoutObj << cur_file_string;
|
||||
@@ -119,7 +122,9 @@ void PIFileTransfer::processFile(int id, ullong start, PIByteArray & data) {
|
||||
}
|
||||
if (fi.isFile()) {
|
||||
if (work_file.path() != path || !work_file.isOpened()) {
|
||||
//piCout << "file close";
|
||||
work_file.close();
|
||||
//piCout << "new file" << path << work_file.path() << work_file.isOpened();
|
||||
if (!work_file.open(path, PIIODevice::ReadWrite)) {
|
||||
cur_file_string = "ERROR! while open file " + path;
|
||||
piCoutObj << cur_file_string;
|
||||
@@ -128,17 +133,17 @@ void PIFileTransfer::processFile(int id, ullong start, PIByteArray & data) {
|
||||
}
|
||||
PIFile::applyFileInfo(path, fi);
|
||||
if (work_file.size() > fi.size) {
|
||||
// piCoutObj << "error size" << work_file.size() << fi.size;
|
||||
//piCoutObj << "error size" << work_file.size() << fi.size;
|
||||
work_file.clear();
|
||||
work_file.resize(fi.size);
|
||||
// piCoutObj << "correct size" << work_file.size() << fi.size;
|
||||
//piCoutObj << "correct size" << work_file.size() << fi.size;
|
||||
}
|
||||
}
|
||||
// piCoutObj << "write file" << path << work_file.path() << work_file.size() << fi.entry.size << work_file.pos() << fi.fstart << fi.fsize;
|
||||
//piCoutObj << "write file" << path << work_file.path() << work_file.size() << fi.entry.size << work_file.pos() << fi.fstart << fi.fsize;
|
||||
if (work_file.size() < (llong)start) {
|
||||
// piCoutObj << "error pos size" << work_file.pos() << fi.fstart;
|
||||
//piCoutObj << "error pos size" << work_file.pos() << fi.fstart;
|
||||
work_file.resize(start);
|
||||
// piCoutObj << "correct pos size" << work_file.pos() << fi.fstart;
|
||||
//piCoutObj << "correct pos size" << work_file.pos() << fi.fstart;
|
||||
}
|
||||
if (work_file.size() > fi.size) {
|
||||
piCoutObj << "****** error size" << work_file.size() << fi.size;
|
||||
@@ -146,7 +151,7 @@ void PIFileTransfer::processFile(int id, ullong start, PIByteArray & data) {
|
||||
work_file.resize(fi.size);
|
||||
piCoutObj << "****** correct size" << work_file.size() << fi.size;
|
||||
}
|
||||
// if (fi.fstart != work_file.pos()) piCoutObj << "error pos" << work_file.pos() << fi.fstart;
|
||||
//if (fi.fstart != work_file.pos()) piCoutObj << "error pos" << work_file.pos() << fi.fstart;
|
||||
work_file.seek(start);
|
||||
int rs = work_file.write(data.data(), data.size());
|
||||
if (rs != data.size_s()) {
|
||||
@@ -160,8 +165,8 @@ void PIFileTransfer::processFile(int id, ullong start, PIByteArray & data) {
|
||||
|
||||
|
||||
PIByteArray PIFileTransfer::buildPacket(Part p) {
|
||||
// piCoutObj << "Step" << pftheader.step;
|
||||
// piCoutObj << "session id" << pftheader.session_id;
|
||||
//piCoutObj << "Step" << pftheader.step;
|
||||
//piCoutObj << "session id" << pftheader.session_id;
|
||||
PIByteArray ba;
|
||||
switch(pftheader.step) {
|
||||
case pft_None:
|
||||
@@ -285,6 +290,7 @@ void PIFileTransfer::receive_finished(bool ok) {
|
||||
} else resume();
|
||||
}
|
||||
if (pftheader.step == pft_Data) {
|
||||
//piCout << "file close";
|
||||
work_file.close();
|
||||
started_ = false;
|
||||
receiveFilesFinished(ok);
|
||||
@@ -293,6 +299,7 @@ void PIFileTransfer::receive_finished(bool ok) {
|
||||
|
||||
|
||||
void PIFileTransfer::send_finished(bool ok) {
|
||||
//piCout << "file close";
|
||||
work_file.close();
|
||||
started_ = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user