fix(types): uint64_t -> size_t
This commit is contained in:
@ -13,27 +13,27 @@ namespace base58
|
||||
extern const char digits[59];
|
||||
extern const int8_t map[256];
|
||||
|
||||
bool isValid(const char *str, uint64_t str_size) noexcept;
|
||||
bool isValid(const char *str, size_t str_size) noexcept;
|
||||
bool isValid(std::string_view str) noexcept;
|
||||
|
||||
/**
|
||||
* @throw std::overflow_error if if there is an overflow
|
||||
*/
|
||||
uint64_t sizeEncoded(std::span<const uint8_t> data) noexcept;
|
||||
uint64_t sizeDecoded(std::string_view str) noexcept;
|
||||
size_t sizeEncoded(std::span<const uint8_t> data) noexcept;
|
||||
size_t sizeDecoded(std::string_view str) noexcept;
|
||||
|
||||
/**
|
||||
* @return number of leading chars, which should be trimmed
|
||||
* @warning contain leading zeros, returns count of them
|
||||
*/
|
||||
uint64_t encode(const uint8_t *data, uint64_t data_size, char *str, uint64_t str_size) noexcept;
|
||||
size_t encode(const uint8_t *data, size_t data_size, char *str, size_t str_size) noexcept;
|
||||
std::string encode(std::span<const uint8_t> data) noexcept;
|
||||
|
||||
/**
|
||||
* @return number of leading chars, which should be trimmed
|
||||
* @warning contain leading zeros, returns count of them
|
||||
*/
|
||||
uint64_t decode(const char *str, uint64_t str_size, uint8_t *data, uint64_t data_size) noexcept;
|
||||
size_t decode(const char *str, size_t str_size, uint8_t *data, size_t data_size) noexcept;
|
||||
std::vector<uint8_t> decode(std::string_view str) noexcept;
|
||||
|
||||
/**
|
||||
|
||||
@ -10,20 +10,20 @@ namespace base64
|
||||
extern const char digits[65];
|
||||
extern const int8_t map[256];
|
||||
|
||||
bool isValid(const char *str, uint64_t str_size) noexcept;
|
||||
bool isValid(const char *str, size_t str_size) noexcept;
|
||||
bool isValid(std::string_view str) noexcept;
|
||||
|
||||
/**
|
||||
* @throw std::overflow_error if if there is an overflow
|
||||
*/
|
||||
uint64_t sizeEncoded(std::span<const uint8_t> data);
|
||||
uint64_t sizeDecoded(std::string_view str) noexcept;
|
||||
size_t sizeEncoded(std::span<const uint8_t> data);
|
||||
size_t sizeDecoded(std::string_view str) noexcept;
|
||||
|
||||
/**
|
||||
* @throw std::length_error if not enough allocated length
|
||||
* @warning contain leading zeros, returns count of them
|
||||
*/
|
||||
void encode(const uint8_t *data, uint64_t data_size, char *str, uint64_t str_size);
|
||||
void encode(const uint8_t *data, size_t data_size, char *str, size_t str_size);
|
||||
std::string encode(std::span<const uint8_t> data) noexcept;
|
||||
|
||||
/**
|
||||
@ -32,6 +32,6 @@ namespace base64
|
||||
* @throw std::logic_error if incorrect padding
|
||||
* @warning contain leading zeros, returns count of them
|
||||
*/
|
||||
void decode(const char *str, uint64_t str_size, uint8_t *data, uint64_t data_size);
|
||||
void decode(const char *str, size_t str_size, uint8_t *data, size_t data_size);
|
||||
std::vector<uint8_t> decode(std::string_view str) noexcept;
|
||||
}
|
||||
@ -20,7 +20,7 @@ namespace baseN
|
||||
* @param map int8_t[256] array, where at an index equal to the value of the symbol is the index of this symbol in the digits array. -1 if there is no symbol
|
||||
* @return that string doesn't contain unnecessary symbols
|
||||
*/
|
||||
bool isValid(const char *str, uint64_t str_size, const int8_t *map) noexcept;
|
||||
bool isValid(const char *str, size_t str_size, const int8_t *map) noexcept;
|
||||
/**
|
||||
* @param str string or string_view which you want to decode
|
||||
* @param map int8_t[256] array, where at an index equal to the value of the symbol is the index of this symbol in the digits array. -1 if there is no symbol
|
||||
@ -33,7 +33,7 @@ namespace baseN
|
||||
* @param base from 1 to 255
|
||||
* @return estimated size after encoding
|
||||
*/
|
||||
uint64_t sizeEncoded(std::span<const uint8_t> data, uint8_t base);
|
||||
size_t sizeEncoded(std::span<const uint8_t> data, uint8_t base);
|
||||
/**
|
||||
* @param str string or string_view which you want to decode
|
||||
* @param base from 1 to 255
|
||||
@ -41,7 +41,7 @@ namespace baseN
|
||||
* @return estimated size after decoding
|
||||
* @throw std::overflow_error if if there is an overflow
|
||||
*/
|
||||
uint64_t sizeDecoded(std::string_view str, uint8_t base, const char *digits) noexcept;
|
||||
size_t sizeDecoded(std::string_view str, uint8_t base, const char *digits) noexcept;
|
||||
|
||||
/**
|
||||
* @param data [in] pointer to data which you want encode
|
||||
@ -61,7 +61,7 @@ namespace baseN
|
||||
* @return number of leading chars, which should be trimmed
|
||||
* @warning contain leading zeros, returns count of them
|
||||
*/
|
||||
uint64_t encode(const uint8_t *data, uint64_t data_size, char *str, uint64_t str_size, uint8_t base, const char *digits);
|
||||
size_t encode(const uint8_t *data, size_t data_size, char *str, size_t str_size, uint8_t base, const char *digits);
|
||||
/**
|
||||
* @param data vector or span of data which you want to encode
|
||||
* @param base from 1 to 255
|
||||
@ -93,7 +93,7 @@ namespace baseN
|
||||
* @return number of leading chars, which should be trimmed
|
||||
* @warning contain leading zeros, returns count of them
|
||||
*/
|
||||
uint64_t decode(const char *str, uint64_t str_size, uint8_t *data, uint64_t data_size, uint8_t base, const char *digits, const int8_t *map);
|
||||
size_t decode(const char *str, size_t str_size, uint8_t *data, size_t data_size, uint8_t base, const char *digits, const int8_t *map);
|
||||
/**
|
||||
* @param str string or string_view which you want to decode
|
||||
* @param base from 1 to 255
|
||||
|
||||
@ -6,6 +6,6 @@
|
||||
|
||||
namespace hash
|
||||
{
|
||||
void sha256(const uint8_t *data, uint64_t data_size, uint8_t *hash) noexcept;
|
||||
void sha256(const uint8_t *data, size_t data_size, uint8_t *hash) noexcept;
|
||||
std::vector<uint8_t> sha256(std::span<const uint8_t> data) noexcept;
|
||||
}
|
||||
@ -10,20 +10,20 @@ namespace hex
|
||||
extern const char digits[17];
|
||||
extern const int8_t map[256];
|
||||
|
||||
bool isValid(const char *str, uint64_t str_size) noexcept;
|
||||
bool isValid(const char *str, size_t str_size) noexcept;
|
||||
bool isValid(std::string_view str) noexcept;
|
||||
|
||||
/**
|
||||
* @throw std::overflow_error if if there is an overflow
|
||||
*/
|
||||
uint64_t sizeEncoded(std::span<const uint8_t> data);
|
||||
uint64_t sizeDecoded(std::string_view str) noexcept;
|
||||
size_t sizeEncoded(std::span<const uint8_t> data);
|
||||
size_t sizeDecoded(std::string_view str) noexcept;
|
||||
|
||||
/**
|
||||
* @throw std::length_error if not enough allocated length
|
||||
* @warning contain leading zeros, returns count of them
|
||||
*/
|
||||
void encode(const uint8_t *data, uint64_t data_size, char *str, uint64_t str_size);
|
||||
void encode(const uint8_t *data, size_t data_size, char *str, size_t str_size);
|
||||
std::string encode(std::span<const uint8_t> data) noexcept;
|
||||
|
||||
/**
|
||||
@ -32,6 +32,6 @@ namespace hex
|
||||
* @throw std::logic_error if str_size %2 != 0 (isn't hex)
|
||||
* @warning contain leading zeros, returns count of them
|
||||
*/
|
||||
void decode(const char *str, uint64_t str_size, uint8_t *data, uint64_t data_size);
|
||||
void decode(const char *str, size_t str_size, uint8_t *data, size_t data_size);
|
||||
std::vector<uint8_t> decode(std::string_view str) noexcept;
|
||||
}
|
||||
Reference in New Issue
Block a user