ckb-next
v0.2.8 at branch master
ckb-next driver for corsair devices
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
quacrc32.cpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2005-2014 Sergey A. Tachenov
3
4
This file is part of QuaZIP.
5
6
QuaZIP is free software: you can redistribute it and/or modify
7
it under the terms of the GNU Lesser General Public License as published by
8
the Free Software Foundation, either version 2.1 of the License, or
9
(at your option) any later version.
10
11
QuaZIP is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU Lesser General Public License for more details.
15
16
You should have received a copy of the GNU Lesser General Public License
17
along with QuaZIP. If not, see <http://www.gnu.org/licenses/>.
18
19
See COPYING file for the full LGPL text.
20
21
Original ZIP package is copyrighted by Gilles Vollant and contributors,
22
see quazip/(un)zip.h files for details. Basically it's the zlib license.
23
*/
24
25
#include "
quacrc32.h
"
26
27
#include "zlib.h"
28
29
QuaCrc32::QuaCrc32
()
30
{
31
reset
();
32
}
33
34
quint32
QuaCrc32::calculate
(
const
QByteArray &data)
35
{
36
return
crc32( crc32(0L, Z_NULL, 0), (
const
Bytef*)data.data(), data.size() );
37
}
38
39
void
QuaCrc32::reset
()
40
{
41
checksum
= crc32(0L, Z_NULL, 0);
42
}
43
44
void
QuaCrc32::update
(
const
QByteArray &buf)
45
{
46
checksum
= crc32(
checksum
, (
const
Bytef*)buf.data(), buf.size() );
47
}
48
49
quint32
QuaCrc32::value
()
50
{
51
return
checksum
;
52
}
QuaCrc32::value
quint32 value()
Value of the checksum calculated for the stream passed throw update().
Definition:
quacrc32.cpp:49
QuaCrc32::calculate
quint32 calculate(const QByteArray &data)
Calculates the checksum for data.
Definition:
quacrc32.cpp:34
QuaCrc32::reset
void reset()
Resets the calculation on a checksun for a stream.
Definition:
quacrc32.cpp:39
QuaCrc32::update
void update(const QByteArray &buf)
Updates the calculated checksum for the stream.
Definition:
quacrc32.cpp:44
quacrc32.h
QuaCrc32::checksum
quint32 checksum
Definition:
quacrc32.h:47
QuaCrc32::QuaCrc32
QuaCrc32()
Definition:
quacrc32.cpp:29
src
ckb
quazip
quacrc32.cpp
Generated on Sat Jan 20 2018 16:59:28 for ckb-next by
1.8.6