Skip to content

Commit

Permalink
A few changes suggested by clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
snej committed May 21, 2024
1 parent 71c578c commit 1176915
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/monocypher/base.hh
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ namespace monocypher {

//======== Utilities:

static inline const uint8_t* u8(const void *p) {return reinterpret_cast<const uint8_t*>(p);}
static inline uint8_t* u8(void *p) {return reinterpret_cast<uint8_t*>(p);}
static inline const uint8_t* u8(const void *p) {return static_cast<const uint8_t*>(p);}
static inline uint8_t* u8(void *p) {return static_cast<uint8_t*>(p);}


/// Fills the array with cryptographically-secure random bytes.
Expand Down
4 changes: 2 additions & 2 deletions include/monocypher/encryption.hh
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ namespace monocypher {


namespace { // internal stuff
static constexpr size_t boxedSize(size_t plaintextSize) {
constexpr size_t boxedSize(size_t plaintextSize) {
return plaintextSize + sizeof(mac);
}

static constexpr size_t unboxedSize(size_t ciphertextSize) {
constexpr size_t unboxedSize(size_t ciphertextSize) {
return std::max(ciphertextSize, sizeof(mac)) - sizeof(mac);
}

Expand Down
2 changes: 1 addition & 1 deletion include/monocypher/signatures.hh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace monocypher {
public_key() :byte_array<32>(0) { }
explicit public_key(const std::array<uint8_t,32> &a) :byte_array<32>(a) { }
public_key(const void *data, size_t size) :byte_array<32>(data, size) { }
explicit public_key(input_bytes k) :public_key(k.data, k.size) { }
explicit public_key(input_bytes k) :public_key(k.data, k.size) { }

/// Verifies a signature.
[[nodiscard]]
Expand Down
2 changes: 1 addition & 1 deletion src/Monocypher+xsalsa20.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include "monocypher/ext/xsalsa20.hh"
#include <memory>
#include <string.h>
#include <cstring>

// Wrap 3rd party tweetnacl.c in a namespace to avoid messing with global namespace:
namespace monocypher::tweetnacl {
Expand Down

0 comments on commit 1176915

Please sign in to comment.