1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 17:25:08 +00:00
serenity/Userland/Libraries/LibCrypto/Checksum/Adler32.h
Daniel Bertalan 4a81b33c07 Everywhere: Fix -Winconsistent-missing-override warnings from Clang
This option is already enabled when building Lagom, so let's enable it
for the main build too. We will no longer be surprised by Lagom Clang
CI builds failing while everything compiles locally.

Furthermore, the stronger `-Wsuggest-override` warning is enabled in
this commit, which enforces the use of the `override` keyword in all
classes, not just those which already have some methods marked as
`override`. This works with both GCC and Clang.
2021-12-11 13:14:15 -08:00

38 lines
693 B
C++

/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Span.h>
#include <AK/Types.h>
#include <LibCrypto/Checksum/ChecksumFunction.h>
namespace Crypto::Checksum {
class Adler32 : public ChecksumFunction<u32> {
public:
Adler32() { }
Adler32(ReadonlyBytes data)
{
update(data);
}
Adler32(u32 initial_a, u32 initial_b, ReadonlyBytes data)
: m_state_a(initial_a)
, m_state_b(initial_b)
{
update(data);
}
virtual void update(ReadonlyBytes data) override;
virtual u32 digest() override;
private:
u32 m_state_a { 1 };
u32 m_state_b { 0 };
};
}