ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
quaadler32.cpp
Go to the documentation of this file.
1 /*
2 Copyright (C) 2010 Adam Walczak
3 Copyright (C) 2005-2014 Sergey A. Tachenov
4 
5 This file is part of QuaZIP.
6 
7 QuaZIP is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 2.1 of the License, or
10 (at your option) any later version.
11 
12 QuaZIP is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License
18 along with QuaZIP. If not, see <http://www.gnu.org/licenses/>.
19 
20 See COPYING file for the full LGPL text.
21 
22 Original ZIP package is copyrighted by Gilles Vollant and contributors,
23 see quazip/(un)zip.h files for details. Basically it's the zlib license.
24 */
25 
26 #include "quaadler32.h"
27 
28 #include "zlib.h"
29 
31 
32 quint32 QuaAdler32::calculate(const QByteArray &data) {
33  return adler32(adler32(0L, Z_NULL, 0), (const Bytef *)data.data(),
34  data.size());
35 }
36 
37 void QuaAdler32::reset() { checksum = adler32(0L, Z_NULL, 0); }
38 
39 void QuaAdler32::update(const QByteArray &buf) {
40  checksum = adler32(checksum, (const Bytef *)buf.data(), buf.size());
41 }
42 
43 quint32 QuaAdler32::value() { return checksum; }
quint32 value()
Value of the checksum calculated for the stream passed throw update().
Definition: quaadler32.cpp:43
void reset()
Resets the calculation on a checksun for a stream.
Definition: quaadler32.cpp:37
quint32 calculate(const QByteArray &data)
Calculates the checksum for data.
Definition: quaadler32.cpp:32
void update(const QByteArray &buf)
Updates the calculated checksum for the stream.
Definition: quaadler32.cpp:39