aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-03-31 13:43:11 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-31 14:20:58 +0200
commitbf289b885768ae5db4e15e18f66390595a2b20f3 (patch)
tree65c99289e58c9492d2510a7f4d918318c71c7e10
parent9892ae74c8e828d163e797b9a309972bbe8ef367 (diff)
downloadlibnitrokey-bf289b885768ae5db4e15e18f66390595a2b20f3.tar.gz
libnitrokey-bf289b885768ae5db4e15e18f66390595a2b20f3.tar.bz2
Fix compilation warnings
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--NitrokeyManager.cc1
-rw-r--r--device.cc11
-rw-r--r--include/device.h3
-rw-r--r--include/stick10_commands.h14
-rw-r--r--misc.cc4
5 files changed, 16 insertions, 17 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 40e166e..159d647 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -197,6 +197,7 @@ namespace nitrokey{
}
break;
}
+ return "NA";
}
stick10::GetStatus::ResponsePayload NitrokeyManager::get_status(){
diff --git a/device.cc b/device.cc
index 97197ee..101ebd0 100644
--- a/device.cc
+++ b/device.cc
@@ -22,15 +22,16 @@ std::chrono::milliseconds Device::default_delay {0} ;
Device::Device(const uint16_t vid, const uint16_t pid, const DeviceModel model,
const milliseconds send_receive_delay, const int retry_receiving_count,
const milliseconds retry_timeout)
- : m_vid(vid),
+ :
+ last_command_status(0),
+ m_vid(vid),
m_pid(pid),
+ m_model(model),
m_retry_sending_count(3),
m_retry_receiving_count(retry_receiving_count),
m_retry_timeout(retry_timeout),
- mp_devhandle(nullptr),
- last_command_status(0),
- m_model(model),
- m_send_receive_delay(send_receive_delay)
+ m_send_receive_delay(send_receive_delay),
+ mp_devhandle(nullptr)
{
instances_count++;
}
diff --git a/include/device.h b/include/device.h
index 674d66b..8bc661a 100644
--- a/include/device.h
+++ b/include/device.h
@@ -121,12 +121,9 @@ protected:
const int m_retry_receiving_count;
std::chrono::milliseconds m_retry_timeout;
std::chrono::milliseconds m_send_receive_delay;
-
std::atomic<hid_device *>mp_devhandle;
-
static std::atomic_int instances_count;
-
static std::chrono::milliseconds default_delay ;
};
diff --git a/include/stick10_commands.h b/include/stick10_commands.h
index a50d0ae..74b73a8 100644
--- a/include/stick10_commands.h
+++ b/include/stick10_commands.h
@@ -476,7 +476,7 @@ class GetPasswordSafeSlotName : Command<CommandID::GET_PW_SAFE_SLOT_NAME> {
bool isValid() const { return true; }
std::string dissect() const {
std::stringstream ss;
- ss << " slot_name\t" << (char*)slot_name << std::endl;
+ ss << " slot_name\t" << (const char*) slot_name << std::endl;
return ss.str();
}
} __packed;
@@ -505,7 +505,7 @@ class GetPasswordSafeSlotPassword
bool isValid() const { return true; }
std::string dissect() const {
std::stringstream ss;
- ss << " slot_password\t" << (char*)slot_password << std::endl;
+ ss << " slot_password\t" << (const char*) slot_password << std::endl;
return ss.str();
}
} __packed;
@@ -534,7 +534,7 @@ class GetPasswordSafeSlotLogin
bool isValid() const { return true; }
std::string dissect() const {
std::stringstream ss;
- ss << " slot_login\t" << (char*)slot_login << std::endl;
+ ss << " slot_login\t" << (const char*) slot_login << std::endl;
return ss.str();
}
} __packed;
@@ -554,8 +554,8 @@ class SetPasswordSafeSlotData : Command<CommandID::SET_PW_SAFE_SLOT_DATA_1> {
std::string dissect() const {
std::stringstream ss;
ss << " slot_number\t" << (int)slot_number << std::endl;
- ss << " slot_name\t" << (char*)slot_name << std::endl;
- ss << " slot_password\t" << (char*)slot_password << std::endl;
+ ss << " slot_name\t" << (const char*) slot_name << std::endl;
+ ss << " slot_password\t" << (const char*) slot_password << std::endl;
return ss.str();
}
} __packed;
@@ -574,7 +574,7 @@ class SetPasswordSafeSlotData2 : Command<CommandID::SET_PW_SAFE_SLOT_DATA_2> {
std::string dissect() const {
std::stringstream ss;
ss << " slot_number\t" << (int)slot_number << std::endl;
- ss << " slot_login_name\t" << (char*)slot_login_name << std::endl;
+ ss << " slot_login_name\t" << (const char*) slot_login_name << std::endl;
return ss.str();
}
} __packed;
@@ -609,7 +609,7 @@ class EnablePasswordSafe : Command<CommandID::PW_SAFE_ENABLE> {
bool isValid() const { return true; }
std::string dissect() const {
std::stringstream ss;
- ss << " user_password\t" << (char*) user_password << std::endl;
+ ss << " user_password\t" << (const char*) user_password << std::endl;
return ss.str();
}
} __packed;
diff --git a/misc.cc b/misc.cc
index 5eb81b5..0c71de2 100644
--- a/misc.cc
+++ b/misc.cc
@@ -23,7 +23,7 @@ namespace misc {
data.reserve(d_size);
char buf[2];
- for(int i=0; i<s_size; i++){
+ for(size_t i=0; i<s_size; i++){
char c = hexString[i];
bool char_from_range = (('0' <= c && c <='9') || ('A' <= c && c <= 'F') || ('a' <= c && c<= 'f'));
@@ -47,7 +47,7 @@ namespace misc {
for (const char *pend = p + size; p < pend;) {
if (print_header){
- snprintf(formatbuf, 128, "%04lx\t", p - pstart);
+ snprintf(formatbuf, 128, "%04dx\t", static_cast<int> (p - pstart));
out << formatbuf;
}