1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 04:11:35 +01:00

Fix compilation warnings on Windows x64.

This commit is contained in:
Matias Fontanini
2015-05-17 17:30:54 -07:00
parent 5cd0c8e41b
commit c42cd0114f
47 changed files with 167 additions and 137 deletions

View File

@@ -150,15 +150,16 @@ void RC4EAPOL::key(const key_type &new_key) {
}
uint32_t RC4EAPOL::header_size() const {
return sizeof(eapolhdr) + sizeof(_header) + _key.size();
return static_cast<uint32_t>(sizeof(eapolhdr) + sizeof(_header) + _key.size());
}
void RC4EAPOL::write_body(uint8_t *buffer, uint32_t total_sz) {
#ifdef TINS_DEBUG
assert(total_sz >= sizeof(_header) + _key.size());
#endif
if(_key.size())
_header.key_length = Endian::host_to_be(_key.size());
if(_key.size()) {
_header.key_length = Endian::host_to_be(static_cast<uint16_t>(_key.size()));
}
std::memcpy(buffer, &_header, sizeof(_header));
buffer += sizeof(_header);
std::copy(_key.begin(), _key.end(), buffer);
@@ -265,7 +266,7 @@ void RSNEAPOL::key_ack(small_uint<1> new_key_ack) {
}
uint32_t RSNEAPOL::header_size() const {
return sizeof(eapolhdr) + sizeof(_header) + _key.size();
return static_cast<uint32_t>(sizeof(eapolhdr) + sizeof(_header) + _key.size());
}
void RSNEAPOL::write_body(uint8_t *buffer, uint32_t total_sz) {
@@ -275,10 +276,10 @@ void RSNEAPOL::write_body(uint8_t *buffer, uint32_t total_sz) {
if(_key.size()) {
if(!_header.key_t) {
_header.key_length = Endian::host_to_be<uint16_t>(32);
wpa_length(_key.size());
wpa_length(static_cast<uint16_t>(_key.size()));
}
else if(_key.size()) {
wpa_length(_key.size());
wpa_length(static_cast<uint16_t>(_key.size()));
}
}
std::memcpy(buffer, &_header, sizeof(_header));