summaryrefslogtreecommitdiff
path: root/src/safewritefile.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-06-25 23:51:29 +0200
committerTannin <devnull@localhost>2014-06-25 23:51:29 +0200
commit5e7c875b29b2dcff44201d2b6cd6815b20fb3945 (patch)
tree18b5212b480b060a633d93322fe93f3b6fb5bd0c /src/safewritefile.cpp
parentb2a7c7c223a10db31f34e7d870d9969fcf158246 (diff)
- test-plugins accidentally distributed in the 1.2.5 release are now automatically deleted
- some fixes to the tutorial (mostly wording but also some actual problems) - bugfix: could disable mods that aren't supposed to be disable-able - bugfix: mod list wasn't saved on some changes - bugfix: when trying to start directly to application, MO didn't start up correctly - bugfix: hook.dll didn't load mod bsas into its directory structure and thus didn't allow bsas to overwrite loose files - bugfix: in some constellations the tutorial files couldn't be found despite being in the right location
Diffstat (limited to 'src/safewritefile.cpp')
-rw-r--r--src/safewritefile.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/safewritefile.cpp b/src/safewritefile.cpp
index 626413dd..3bc1d1c4 100644
--- a/src/safewritefile.cpp
+++ b/src/safewritefile.cpp
@@ -20,6 +20,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "safewritefile.h"
#include <QStringList>
+#include <QCryptographicHash>
using namespace MOBase;
@@ -47,8 +48,8 @@ void SafeWriteFile::commit() {
m_TempFile.close();
}
-bool SafeWriteFile::commitIfDifferent(uint &inHash) {
- uint newHash = hash();
+bool SafeWriteFile::commitIfDifferent(QByteArray &inHash) {
+ QByteArray newHash = hash();
if (newHash != inHash) {
commit();
inHash = newHash;
@@ -58,11 +59,12 @@ bool SafeWriteFile::commitIfDifferent(uint &inHash) {
}
}
-uint SafeWriteFile::hash()
+QByteArray SafeWriteFile::hash()
{
+
qint64 pos = m_TempFile.pos();
m_TempFile.seek(0);
QByteArray data = m_TempFile.readAll();
m_TempFile.seek(pos);
- return qHash(data);
+ return QCryptographicHash::hash(data, QCryptographicHash::Md5);
}