mycroft/chainstate

Compilation warnings

PsyShark opened this issue · 0 comments

Hi, there were warnings during compilation, how can they affect the program's performance? How to fix it?
CentOS 7
g++ v.4.8.5

$ make
rm -f chainstate chainstate.o hex.o varint.o pubkey.o
g ++ -Wall -Wextra -pedantic -Wall -Wextra -Wold-style-cast -Woverloaded-virtual -Wfloat-equal -Wwrite-strings -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion -Wshadow -Weffc ++ -Wredundant- decls -Wdouble-promotion -Winit-self -Wswitch-default -Wswitch-enum -Wundef -Wlogical-op -Winline -I. -Ilibbase58 -Isecp256k1 / include -Ibech32 / ref / c -std = c ++ 0x -c -o chainstate.o chainstate.cc
chainstate.cc: In function "int main (int, char **)":
chainstate.cc:146:26: warning: conversion to "char" from "int" may alter its value [-Wconversion]
                 value [i] ^ = obfuscate_key [i% obfuscate_key.size ()];
                          ^
chainstate.cc:166:49: warning: conversion to "unsigned int" from "uint64_t {aka long unsigned int}" may alter its value [-Wconversion]
             unsigned int nMaskCode = (code / 8) + ((code & 6)! = 0? 0: 1);
                                                 ^
chainstate.cc:242:88: warning: using deprecated cast to type [-Wold-style-cast]
                         ret = pubkey_decompress (type, value.c_str (), (unsigned char *) & pub, & publen);
                                                                                        ^
chainstate.cc:247:141: warning: using deprecated cast to type [-Wold-style-cast]
                         addr = get_addr (current_prefix.pubkey_prefix, current_prefix.pubkey_prefix_size, str_to_ripesha (string ((const char *) pub, PUBLIC_KEY_SIZE)));
                                                                                                                                             ^
chainstate.cc:299:41: warning: conversion to "int" from "uint64_t {aka long unsigned int}" may alter its value [-Wconversion]
             txn = get_next_varint (tx_num);
                                         ^
chainstate.cc:304:22: warning: conversion to "char" from "int" may alter its value [-Wconversion]
             value [i] ^ = obfuscate_key [i% obfuscate_key.size ()];
                      ^
chainstate.cc:308:24: warning: conversion to "uint32_t {aka unsigned int}" from "uint64_t {aka long unsigned int}" may alter its value [-Wconversion]
         nHeight = code >> 1;
                        ^
chainstate.cc:370:81: warning: using deprecated cast to type [-Wold-style-cast]
                 pubkey_decompress (script_type, value.c_str (), (unsigned char *) & pub, & publen);
                                                                                 ^
chainstate.cc:371:133: warning: using deprecated cast to type [-Wold-style-cast]
                 addr = get_addr (current_prefix.pubkey_prefix, current_prefix.pubkey_prefix_size, str_to_ripesha (string ((const char *) pub, PUBLIC_KEY_SIZE)));
                                                                                                                                     ^
g ++ -Wall -Wextra -pedantic -Wall -Wextra -Wold-style-cast -Woverloaded-virtual -Wfloat-equal -Wwrite-strings -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion -Wshadow -Weffc ++ -Wredundant- decls -Wdouble-promotion -Winit-self -Wswitch-default -Wswitch-enum -Wundef -Wlogical-op -Winline -I. -Ilibbase58 -Isecp256k1 / include -Ibech32 / ref / c -std = c ++ 0x -c -o hex.o hex.cc
hex.cc: In the function "std :: string hex_to_string (const string &)":
hex.cc:39:43: warning: conversion to "char" from "long int" may alter its value [-Wconversion]
         output.push_back (((p - lut) << 4) | (q - lut));
                                           ^
g ++ -Wall -Wextra -pedantic -Wall -Wextra -Wold-style-cast -Woverloaded-virtual -Wfloat-equal -Wwrite-strings -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion -Wshadow -Weffc ++ -Wredundant- decls -Wdouble-promotion -Winit-self -Wswitch-default -Wswitch-enum -Wundef -Wlogical-op -Winline -I. -Ilibbase58 -Isecp256k1 / include -Ibech32 / ref / c -std = c ++ 0x -c -o varint.o varint.cc
varint.cc: In function "uint64_t compress_amount (uint64_t)":
varint.cc:37:20: warning: conversion to "int" from "uint64_t {aka long unsigned int}" may alter its value [-Wconversion]
         int d = (n% 10);
                    ^
varint.cc: In the function "uint64_t decompress_amount (uint64_t)":
varint.cc:53:15: warning: conversion to "int" from "uint64_t {aka long unsigned int}" may alter its value [-Wconversion]
     int e = x% 10;
               ^
varint.cc:58:25: warning: conversion to "int" from "uint64_t {aka long unsigned int}" may alter its value [-Wconversion]
         int d = (x% 9) + 1;
                         ^
g ++ -Wall -Wextra -pedantic -Wall -Wextra -Wold-style-cast -Woverloaded-virtual -Wfloat-equal -Wwrite-strings -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion -Wshadow -Weffc ++ -Wredundant- decls -Wdouble-promotion -Winit-self -Wswitch-default -Wswitch-enum -Wundef -Wlogical-op -Winline -I. -Ilibbase58 -Isecp256k1 / include -Ibech32 / ref / c -std = c ++ 0x -c -o pubkey.o pubkey.cc
pubkey.cc: In the function "bool pubkey_decompress (unsigned int, const char *, unsigned char *, size_t *)":
pubkey.cc:20:19: warning: conversion to "unsigned char" from "unsigned int" may alter its value [-Wconversion]
     vch [0] = size - 2;
                   ^
pubkey.cc: In the function "std :: string get_addr (unsigned char *, size_t, std :: string)":
pubkey.cc:65:40: warning: using deprecated cast to type [-Wold-style-cast]
     sha256 ((unsigned char *) value.c_str (), value.size (), output);
                                        ^
pubkey.cc:65:40: warning: cast from type "const char *" to type "unsigned char *" casts away qualifiers [-Wcast-qual]
pubkey.cc:68:26: warning: using deprecated cast to type [-Wold-style-cast]
     value.append ((char *) output, 4);
                          ^
pubkey.cc: In the function "std :: string str_to_ripesha (std :: string, int)":
pubkey.cc:82:36: warning: using deprecated cast to type [-Wold-style-cast]
     sha256 ((unsigned char *) v.c_str (), size, output);
                                    ^
pubkey.cc:82:36: warning: cast from type "const char *" to type "unsigned char *" casts away qualifiers [-Wcast-qual]
pubkey.cc:85:32: warning: using deprecated cast to type [-Wold-style-cast]
     return string ((const char *) ripe_output, RIPEMD160_DIGEST_LENGTH);
                                ^
pubkey.cc: In the function "std :: string str_to_ripesha (std :: string)":
pubkey.cc:90:45: warning: conversion to "int" from "std :: basic_string <char> :: size_type {aka long unsigned int}" may alter its value [-Wconversion]
     return str_to_ripesha (value, value.size ());
                                             ^
pubkey.cc: In the "std :: string rebuild_bech32 (std :: string)" function:
pubkey.cc:104:48: warning: using deprecated cast to type [-Wold-style-cast]
     scriptpubkey = (unsigned char *) value.c_str ();
                                                ^
pubkey.cc:104:48: warning: cast from type "const char *" to type "unsigned char *" casts away qualifiers [-Wcast-qual]
g ++ -o chainstate chainstate.o hex.o varint.o pubkey.o -Lsecp256k1 / .libs -lsecp256k1 -lcrypto -lleveldb -Llibbase58 / .libs -lbase58 -Lbech32 / ref / c -lbech32