Zip and Socket patches applied

git-svn-id: svn://ultimatepp.org/upp/trunk@1917 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-01-21 21:47:17 +00:00
commit e13a8cffe1
2 changed files with 17 additions and 15 deletions

View file

@ -40,7 +40,7 @@ void Zip::WriteFile(const void *ptr, int size, const char *path, Gate2<int, int>
zip->Put16le(0);
zip->Put(f.path);
zip->Put(r, csize);
done += 5 * 2 + 5 * 4 + data.GetCount() + f.path.GetCount();
done += 5 * 2 + 5 * 4 + csize + f.path.GetCount();
}
void Zip::WriteFile(const String& s, const char *path, Gate2<int, int> progress, Time tm)
@ -60,26 +60,28 @@ void Zip::Finish()
if(!zip)
return;
dword off = done;
dword rof = 0;
for(int i = 0; i < file.GetCount(); i++) {
File& f = file[i];
zip->Put32le(0x02014b50);
zip->Put16le(20);
zip->Put16le(20);
zip->Put16le(0); // general purpose bit flag
zip->Put16le(f.method);
zip->Put32le(f.time);
zip->Put32le(f.crc);
zip->Put32le(f.csize);
zip->Put32le(f.usize);
zip->Put16le(f.path.GetCount());
zip->Put16le(f.method);
zip->Put32le(f.time);
zip->Put32le(f.crc);
zip->Put32le(f.csize);
zip->Put32le(f.usize);
zip->Put16le(f.path.GetCount());
zip->Put16le(0); // extra field length 2 bytes
zip->Put16le(0); // file comment length 2 bytes
zip->Put16le(0); // disk number start 2 bytes
zip->Put16le(0); // internal file attributes 2 bytes
zip->Put32le(0); // external file attributes 4 bytes
zip->Put32le(0); // relative offset of local header 4 bytes
zip->Put(f.path);
done += 7 * 4 + 9 * 2 + f.path.GetCount();
zip->Put16le(0); // file comment length 2 bytes
zip->Put16le(0); // disk number start 2 bytes
zip->Put16le(0); // internal file attributes 2 bytes
zip->Put32le(0); // external file attributes 4 bytes
zip->Put32le(rof); // relative offset of local header 4 bytes
rof+=5 * 2 + 5 * 4 + f.csize + f.path.GetCount();
zip->Put(f.path);
done += 7 * 4 + 9 * 2 + f.path.GetCount();
}
zip->Put32le(0x06054b50);
zip->Put16le(0); // number of this disk