mirror of
https://github.com/eosswedenorg/antelope-keygen
synced 2026-06-17 03:50:03 +02:00
Merge branch 'compiler-warnings' into develop
This commit is contained in:
parent
2b20f8aaf4
commit
2d1696a0e4
7 changed files with 24 additions and 16 deletions
|
|
@ -39,6 +39,10 @@ set( CMAKE_CXX_STANDARD 11 )
|
|||
set( CMAKE_CXX_STANDARD_REQUIRED ON )
|
||||
set( CMAKE_CXX_EXTENSIONS OFF )
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wconversion -Wno-sign-conversion -Wextra" )
|
||||
endif()
|
||||
|
||||
# Libraries
|
||||
find_package(OpenSSL 1.1 REQUIRED)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
*
|
||||
* Based on code from https://github.com/bitcoin/bitcoin/blob/f1e2f2a85962c1664e4e55471061af0eaa798d40/src/base58.cpp
|
||||
*/
|
||||
#include <cstddef>
|
||||
#include <cassert>
|
||||
#include "base58.h"
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ std::string base58_encode(const unsigned char* pbegin, const unsigned char* pend
|
|||
zeroes++;
|
||||
}
|
||||
// Allocate enough space in big-endian base58 representation.
|
||||
int size = (pend - pbegin) * 138 / 100 + 1; // log(256) / log(58), rounded up.
|
||||
std::size_t size = (pend - pbegin) * 138 / 100 + 1; // log(256) / log(58), rounded up.
|
||||
std::vector<unsigned char> b58(size);
|
||||
// Process the bytes.
|
||||
while (pbegin != pend) {
|
||||
|
|
@ -48,7 +49,7 @@ std::string base58_encode(const unsigned char* pbegin, const unsigned char* pend
|
|||
// Apply "b58 = b58 * 256 + ch".
|
||||
for (std::vector<unsigned char>::reverse_iterator it = b58.rbegin(); (carry != 0 || i < length) && (it != b58.rend()); it++, i++) {
|
||||
carry += 256 * (*it);
|
||||
*it = carry % 58;
|
||||
*it = static_cast<unsigned char>(carry % 58);
|
||||
carry /= 58;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@
|
|||
#include <cstring>
|
||||
#include "checksum.h"
|
||||
|
||||
inline void sha256d(const unsigned char *data, unsigned int len, unsigned char *out) {
|
||||
inline void sha256d(const unsigned char *data, std::size_t len, unsigned char *out) {
|
||||
SHA256(data, len, out);
|
||||
SHA256(out, 32, out);
|
||||
}
|
||||
|
||||
#define checksum_impl(name, func) \
|
||||
checksum_t checksum_##name(const unsigned char *data, unsigned int len) { \
|
||||
checksum_t checksum_##name(const unsigned char *data, std::size_t len) { \
|
||||
\
|
||||
checksum_t crc; \
|
||||
unsigned char hash[32]; \
|
||||
|
|
|
|||
|
|
@ -24,12 +24,13 @@
|
|||
#ifndef CHECKSUM_H
|
||||
#define CHECKSUM_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <array>
|
||||
|
||||
typedef std::array<unsigned char, 4> checksum_t;
|
||||
|
||||
checksum_t checksum_sha256d(const unsigned char *data, unsigned int len);
|
||||
checksum_t checksum_sha256d(const unsigned char *data, std::size_t len);
|
||||
|
||||
checksum_t checksum_ripemd160(const unsigned char *data, unsigned int len);
|
||||
checksum_t checksum_ripemd160(const unsigned char *data, std::size_t len);
|
||||
|
||||
#endif /* CHECKSUM_H */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
|
@ -7,10 +8,10 @@
|
|||
#include "key_search.h"
|
||||
|
||||
// Max keys to search for,
|
||||
unsigned int g_max;
|
||||
std::size_t g_max;
|
||||
|
||||
// How many keys we have found so far.
|
||||
unsigned int g_count;
|
||||
std::size_t g_count;
|
||||
|
||||
// Mutex guard for g_count.
|
||||
std::mutex g_count_mtx;
|
||||
|
|
@ -60,7 +61,7 @@ void KeySearch::_search_mt(size_t n)
|
|||
g_count = 0;
|
||||
|
||||
// Launch them.
|
||||
for(int i = 0; i < t.size(); i++) {
|
||||
for(std::size_t i = 0; i < t.size(); i++) {
|
||||
t[i] = std::thread(_thr_proc, m_words);
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ void KeySearch::_search_mt(size_t n)
|
|||
_thr_proc(m_words);
|
||||
|
||||
// Wait for all threads to compelete.
|
||||
for(int i = 0; i < t.size(); i++) {
|
||||
for(std::size_t i = 0; i < t.size(); i++) {
|
||||
t[i].join();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ void cmd_search(int argc, char **argv) {
|
|||
|
||||
if (option_l33t) {
|
||||
strlist_t tmp = strsplitwords(input);
|
||||
for(int i = 0; i < tmp.size(); i++) {
|
||||
for(std::size_t i = 0; i < tmp.size(); i++) {
|
||||
ks.addList(l33twords(tmp[i]));
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,9 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
#include "string.h"
|
||||
|
||||
strlist_t strsplitwords(const std::string& str, const std::string& delim) {
|
||||
|
|
@ -108,20 +109,20 @@ static bool is_l33t(char ch, char& r) {
|
|||
// '1', '2', '3', '4', '5', '6', '7', '8', '9'
|
||||
static char alphabet[9] = { 'l', 'z', 'e', 'a', 's', 'G', 't', 'B', 'g' };
|
||||
|
||||
for(int i = 0; i < sizeof(alphabet) / sizeof(char); i++) {
|
||||
for(std::size_t i = 0; i < sizeof(alphabet) / sizeof(char); i++) {
|
||||
|
||||
if (ch == alphabet[i]) {
|
||||
r = '1' + i;
|
||||
r = static_cast<char>('1' + i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void _l33t(strlist_t& list, const std::string& a, int pos) {
|
||||
static void _l33t(strlist_t& list, const std::string& a, std::size_t pos) {
|
||||
|
||||
// Find the next character to be replaced.
|
||||
for(int i = pos; i < a.length(); i++) {
|
||||
for(std::size_t i = pos; i < a.length(); i++) {
|
||||
|
||||
char ch;
|
||||
if (is_l33t(a[i], ch)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue