Skip to content

Commit b9aeec6

Browse files
authored
Merge pull request #955 from cyberiada-com/pr/static-casts-for-msvc
Static casts for MSVC
2 parents 25954be + dc3bde1 commit b9aeec6

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

websocketpp/common/md5.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ void md5_append(md5_state_t *pms, md5_byte_t const * data, size_t nbytes) {
364364
return;
365365

366366
/* Update the message length. */
367-
pms->count[1] += nbytes >> 29;
367+
pms->count[1] += static_cast<md5_word_t>(nbytes >> 29);
368368
pms->count[0] += nbits;
369369
if (pms->count[0] < nbits)
370370
pms->count[1]++;

websocketpp/frame.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,17 +234,17 @@ struct basic_header {
234234
/// The variable size component of a WebSocket frame header
235235
struct extended_header {
236236
extended_header() {
237-
std::fill_n(this->bytes,MAX_EXTENDED_HEADER_LENGTH,0x00);
237+
std::fill_n(this->bytes,MAX_EXTENDED_HEADER_LENGTH, static_cast<uint8_t>(0x00));
238238
}
239239

240240
extended_header(uint64_t payload_size) {
241-
std::fill_n(this->bytes,MAX_EXTENDED_HEADER_LENGTH,0x00);
241+
std::fill_n(this->bytes,MAX_EXTENDED_HEADER_LENGTH, static_cast<uint8_t>(0x00));
242242

243243
copy_payload(payload_size);
244244
}
245245

246246
extended_header(uint64_t payload_size, uint32_t masking_key) {
247-
std::fill_n(this->bytes,MAX_EXTENDED_HEADER_LENGTH,0x00);
247+
std::fill_n(this->bytes,MAX_EXTENDED_HEADER_LENGTH, static_cast<uint8_t>(0x00));
248248

249249
// Copy payload size
250250
int offset = copy_payload(payload_size);
@@ -831,7 +831,7 @@ inline size_t byte_mask_circ(uint8_t * input, uint8_t * output, size_t length,
831831
size_t prepared_key)
832832
{
833833
uint32_converter key;
834-
key.i = prepared_key;
834+
key.i = static_cast<uint32_t>(prepared_key);
835835

836836
for (size_t i = 0; i < length; ++i) {
837837
output[i] = input[i] ^ key.c[i % 4];

websocketpp/processors/hybi00.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ class hybi00 : public processor<config> {
435435
reinterpret_cast<char*>(&num)+4,
436436
result);
437437
} else {
438-
std::fill(result,result+4,0);
438+
std::fill(result,result+4,static_cast<char>(0));
439439
}
440440
}
441441

websocketpp/processors/hybi13.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ class hybi13 : public processor<config> {
555555
std::fill_n(
556556
m_extended_header.bytes,
557557
frame::MAX_EXTENDED_HEADER_LENGTH,
558-
0x00
558+
static_cast<uint8_t>(0x00)
559559
);
560560
}
561561

websocketpp/sha1/sha1.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ inline void calc(void const * src, size_t bytelength, unsigned char * hash) {
175175
innerHash(result, w);
176176
clearWBuffert(w);
177177
}
178-
w[15] = bytelength << 3;
178+
w[15] = static_cast<unsigned int>(bytelength << 3);
179179
innerHash(result, w);
180180

181181
// Store hash in result pointer, and make sure we get in in the correct

0 commit comments

Comments
 (0)