Fix warning: comparison between signed and unsigned integer expressions

and unused variables

/retroshare-nogui/src/TerminalApiClient.cpp:233: warning: comparison
between signed and unsigned integer expressions [-Wsign-compare]
    while(selected_account_number >= accounts.size())

/retroshare-nogui/src/TerminalApiClient.cpp:243: warning: comparison
between signed and unsigned integer expressions [-Wsign-compare]
     if(selected_account_number >= accounts.size())

/retroshare-nogui/src/TerminalApiClient.cpp:121: warning: unused
variable ‘IO_POLL_PERIOD’ [-Wunused-variable]
     const int IO_POLL_PERIOD          = 20;

/retroshare-nogui/src/TerminalApiClient.cpp:124: warning: unused
variable ‘last_io_poll’ [-Wunused-variable]
     int last_io_poll  = 0;

/retroshare-nogui/src/TerminalApiClient.cpp:127: warning: unused
variable ‘last_char’ [-Wunused-variable]
     int last_char = 0;

/retroshare-nogui/src/TerminalApiClient.cpp:129: warning: unused
variable ‘enter_was_pressed’ [-Wunused-variable]
     bool enter_was_pressed = false;

/retroshare-nogui/src/TerminalApiClient.cpp:133: warning: variable
‘account_number_typed’ set but not used [-Wunused-but-set-variable]
  int account_number_typed = 0 ;
This commit is contained in:
Phenom 2017-07-15 13:01:39 +02:00 committed by csoler
parent 8455adf375
commit 9a4ed8012c

View File

@ -118,19 +118,21 @@ void TerminalApiClient::data_tick()
{ {
// values in milliseconds // values in milliseconds
const int MIN_WAIT_TIME = 20; // sleep time must be smaller or equal than the smallest period const int MIN_WAIT_TIME = 20; // sleep time must be smaller or equal than the smallest period
const int IO_POLL_PERIOD = 20;
const int API_EVENT_POLL_PERIOD = 1000; const int API_EVENT_POLL_PERIOD = 1000;
#ifdef TO_REMOVE
const int IO_POLL_PERIOD = 20;
int last_io_poll = 0; int last_io_poll = 0;
int last_event_api_poll = 0;
int last_char = 0; int last_char = 0;
std::string inbuf;
bool enter_was_pressed = false; bool enter_was_pressed = false;
std::string inbuf;
#endif
int last_event_api_poll = 0;
bool prev_is_bad = false ; bool prev_is_bad = false ;
int account_number_size = 1 ; int account_number_size = 1 ;
int selected_account_number = 0 ; size_t selected_account_number = 0 ;
int account_number_typed = 0 ; //int account_number_typed = 0 ;
StateToken runstate_state_token; StateToken runstate_state_token;
std::string runstate; std::string runstate;
@ -228,7 +230,7 @@ void TerminalApiClient::data_tick()
std::cout << "[" << std::setw(account_number_size) << std::setfill('0') << i << "] Location Id: " << accounts[i].ssl_id << " \"" << accounts[i].name << "\" (" << accounts[i].location << ")" << std::endl; std::cout << "[" << std::setw(account_number_size) << std::setfill('0') << i << "] Location Id: " << accounts[i].ssl_id << " \"" << accounts[i].name << "\" (" << accounts[i].location << ")" << std::endl;
selected_account_number = accounts.size() ; selected_account_number = accounts.size() ;
account_number_typed = 0 ; //account_number_typed = 0 ;
while(selected_account_number >= accounts.size()) while(selected_account_number >= accounts.size())
{ {
@ -237,7 +239,7 @@ void TerminalApiClient::data_tick()
std::string s = readStringFromKeyboard(false) ; std::string s = readStringFromKeyboard(false) ;
if(sscanf(s.c_str(),"%d",&selected_account_number) != 1) if(sscanf(s.c_str(),"%lu",&selected_account_number) != 1)
continue ; continue ;
if(selected_account_number >= accounts.size()) if(selected_account_number >= accounts.size())