Hash calculation uses wxCryptoHash::HashFile() method now.
This commit is contained in:
parent
c425de942c
commit
348e4a461f
@ -469,17 +469,10 @@ bool wxUpdCheckApp::ReadUpdatePackageMeta()
|
||||
|
||||
bool wxUpdCheckApp::DownloadUpdatePackage(const wxString &fileName)
|
||||
{
|
||||
if (wxFileExists(fileName)) {
|
||||
// The update package file already exists. Do the integrity check.
|
||||
wxFFile file(fileName, wxT("rb"));
|
||||
if (file.IsOpened()) {
|
||||
// Calculate file hash.
|
||||
// Calculate file hash (if exists).
|
||||
wxCryptoHashSHA1 ch(*m_cs);
|
||||
wxMemoryBuffer buf(4*1024);
|
||||
char *data = (char*)buf.GetData();
|
||||
size_t nBlock = buf.GetBufSize();
|
||||
while (!file.Eof())
|
||||
ch.Hash(data, file.Read(data, nBlock));
|
||||
if (ch.HashFile(fileName)) {
|
||||
wxMemoryBuffer buf;
|
||||
ch.GetValue(buf);
|
||||
|
||||
if (buf.GetDataLen() == m_hash.GetDataLen() &&
|
||||
@ -490,7 +483,6 @@ bool wxUpdCheckApp::DownloadUpdatePackage(const wxString &fileName)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxFFile file(fileName, wxT("wb"));
|
||||
if (!file.IsOpened()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user