PageRenderTime 16ms CodeModel.GetById 6ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/src/libtomahawk/thirdparty/quazip/quazip/quacrc32.cpp

http://github.com/tomahawk-player/tomahawk
C++ | 28 lines | 22 code | 6 blank | 0 comment | 0 complexity | dd3c0d3b42a2248a68c2ac918d222c0c MD5 | raw file
 1#include "quacrc32.h"
 2
 3#include "zlib.h"
 4
 5QuaCrc32::QuaCrc32()
 6{
 7	reset();
 8}
 9
10quint32 QuaCrc32::calculate(const QByteArray &data)
11{
12	return crc32( crc32(0L, Z_NULL, 0), (const Bytef*)data.data(), data.size() );
13}
14
15void QuaCrc32::reset()
16{
17	checksum = crc32(0L, Z_NULL, 0);
18}
19
20void QuaCrc32::update(const QByteArray &buf)
21{
22	checksum = crc32( checksum, (const Bytef*)buf.data(), buf.size() );
23}
24
25quint32 QuaCrc32::value()
26{
27	return checksum;
28}