source: s10k/CommonLibs/quazip-0.7.2/quazip/quaadler32.cpp @ 1096

Last change on this file since 1096 was 1096, checked in by s10k, 22 months ago

Added zlib, quazip, basicxmlsyntaxhighlighter, conditionalsemaphore and linenumberdisplay libraries. zlib and quazip are pre-compiled, but you can compile them yourself, just delete the dll files (or equivalent binary files to your OS)

File size: 1.4 KB
Line 
1/*
2Copyright (C) 2010 Adam Walczak
3Copyright (C) 2005-2014 Sergey A. Tachenov
4
5This file is part of QuaZIP.
6
7QuaZIP is free software: you can redistribute it and/or modify
8it under the terms of the GNU Lesser General Public License as published by
9the Free Software Foundation, either version 2.1 of the License, or
10(at your option) any later version.
11
12QuaZIP is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License
18along with QuaZIP.  If not, see <http://www.gnu.org/licenses/>.
19
20See COPYING file for the full LGPL text.
21
22Original ZIP package is copyrighted by Gilles Vollant and contributors,
23see 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
30QuaAdler32::QuaAdler32()
31{
32        reset();
33}
34
35quint32 QuaAdler32::calculate(const QByteArray &data)
36{
37        return adler32( adler32(0L, Z_NULL, 0), (const Bytef*)data.data(), data.size() );
38}
39
40void QuaAdler32::reset()
41{
42        checksum = adler32(0L, Z_NULL, 0);
43}
44
45void QuaAdler32::update(const QByteArray &buf)
46{
47        checksum = adler32( checksum, (const Bytef*)buf.data(), buf.size() );
48}
49
50quint32 QuaAdler32::value()
51{
52        return checksum;
53}
Note: See TracBrowser for help on using the repository browser.