File indexing completed on 2025-02-02 04:36:33
0001 /* 0002 Copyright (C) 2010 Adam Walczak 0003 Copyright (C) 2005-2014 Sergey A. Tachenov 0004 0005 This file is part of QuaZIP. 0006 0007 QuaZIP is free software: you can redistribute it and/or modify 0008 it under the terms of the GNU Lesser General Public License as published by 0009 the Free Software Foundation, either version 2.1 of the License, or 0010 (at your option) any later version. 0011 0012 QuaZIP is distributed in the hope that it will be useful, 0013 but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 GNU Lesser General Public License for more details. 0016 0017 You should have received a copy of the GNU Lesser General Public License 0018 along with QuaZIP. If not, see <http://www.gnu.org/licenses/>. 0019 0020 See COPYING file for the full LGPL text. 0021 0022 Original ZIP package is copyrighted by Gilles Vollant and contributors, 0023 see quazip/(un)zip.h files for details. Basically it's the zlib license. 0024 */ 0025 0026 #include "quaadler32.h" 0027 0028 #include "zlib.h" 0029 0030 QuaAdler32::QuaAdler32() 0031 { 0032 reset(); 0033 } 0034 0035 quint32 QuaAdler32::calculate(const QByteArray &data) 0036 { 0037 return adler32( adler32(0L, Z_NULL, 0), (const Bytef*)data.data(), data.size() ); 0038 } 0039 0040 void QuaAdler32::reset() 0041 { 0042 checksum = adler32(0L, Z_NULL, 0); 0043 } 0044 0045 void QuaAdler32::update(const QByteArray &buf) 0046 { 0047 checksum = adler32( checksum, (const Bytef*)buf.data(), buf.size() ); 0048 } 0049 0050 quint32 QuaAdler32::value() 0051 { 0052 return checksum; 0053 }