Changeset 128 for smplayer/trunk/src/findsubtitles/osparser.cpp
- Timestamp:
- Mar 29, 2012, 4:53:15 PM (13 years ago)
- Location:
- smplayer/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/trunk
- Property svn:mergeinfo changed
/smplayer/vendor/current merged: 127
- Property svn:mergeinfo changed
-
smplayer/trunk/src/findsubtitles/osparser.cpp
r124 r128 19 19 #include "osparser.h" 20 20 #include <QDomDocument> 21 #include <QFile>22 #include <QDataStream>21 //#include <QFile> 22 //#include <QDataStream> 23 23 24 24 OSParser::OSParser() { … … 81 81 } 82 82 83 // From the patch by Kamil Dziobek turbos11(at)gmail.com84 // (c) Kamil Dziobek turbos11(at)gmail.com | BSD or GPL or public domain85 QString OSParser::calculateHash(QString filename) {86 QFile file(filename);87 88 if (!file.exists()) {89 qWarning("OSParser:calculateHash: error hashing file. File doesn't exist.");90 return QString();91 }92 93 file.open(QIODevice::ReadOnly);94 QDataStream in(&file);95 in.setByteOrder(QDataStream::LittleEndian);96 quint64 size=file.size ();97 quint64 hash=size;98 quint64 a;99 for(int i = 0; i < 8192; i++) {100 in >> a ; hash += a;101 };102 file.seek(size-65536);103 for(int i = 0; i < 8192; i++) {104 in >> a ; hash += a;105 };106 107 QString hexhash = QString("%1").arg(hash, 16, 16, QChar('0'));108 109 return hexhash;110 }111
Note:
See TracChangeset
for help on using the changeset viewer.