@@ -51,7 +51,7 @@ namespace SimpleWeb {
5151 SendStream () noexcept : std::iostream(&streambuf) {}
5252
5353 // / Returns the size of the buffer
54- size_t size () const noexcept {
54+ std:: size_t size () const noexcept {
5555 return streambuf.size ();
5656 }
5757 };
@@ -143,7 +143,7 @@ namespace SimpleWeb {
143143 void send_from_queue () {
144144 auto self = this ->shared_from_this ();
145145 strand.post ([self]() {
146- asio::async_write (*self->socket , self->send_queue .begin ()->send_stream ->streambuf , self->strand .wrap ([self](const error_code &ec, size_t /* bytes_transferred*/ ) {
146+ asio::async_write (*self->socket , self->send_queue .begin ()->send_stream ->streambuf , self->strand .wrap ([self](const error_code &ec, std:: size_t /* bytes_transferred*/ ) {
147147 auto lock = self->handler_runner ->continue_lock ();
148148 if (!lock)
149149 return ;
@@ -186,17 +186,17 @@ namespace SimpleWeb {
186186 mask.resize (4 );
187187 std::uniform_int_distribution<unsigned short > dist (0 , 255 );
188188 std::random_device rd;
189- for (size_t c = 0 ; c < 4 ; c++)
189+ for (std:: size_t c = 0 ; c < 4 ; c++)
190190 mask[c] = static_cast <unsigned char >(dist (rd));
191191
192192 auto send_stream = std::make_shared<SendStream>();
193193
194- size_t length = message_stream->size ();
194+ std:: size_t length = message_stream->size ();
195195
196196 send_stream->put (static_cast <char >(fin_rsv_opcode));
197197 // Masked (first length byte>=128)
198198 if (length >= 126 ) {
199- size_t num_bytes;
199+ std:: size_t num_bytes;
200200 if (length > 0xffff ) {
201201 num_bytes = 8 ;
202202 send_stream->put (static_cast <char >(127 + 128 ));
@@ -206,16 +206,16 @@ namespace SimpleWeb {
206206 send_stream->put (static_cast <char >(126 + 128 ));
207207 }
208208
209- for (size_t c = num_bytes - 1 ; c != static_cast <size_t >(-1 ); c--)
209+ for (std:: size_t c = num_bytes - 1 ; c != static_cast <std:: size_t >(-1 ); c--)
210210 send_stream->put ((static_cast <unsigned long long >(length) >> (8 * c)) % 256 );
211211 }
212212 else
213213 send_stream->put (static_cast <char >(length + 128 ));
214214
215- for (size_t c = 0 ; c < 4 ; c++)
215+ for (std:: size_t c = 0 ; c < 4 ; c++)
216216 send_stream->put (static_cast <char >(mask[c]));
217217
218- for (size_t c = 0 ; c < length; c++)
218+ for (std:: size_t c = 0 ; c < length; c++)
219219 send_stream->put (message_stream->get () ^ mask[c % 4 ]);
220220
221221 auto self = this ->shared_from_this ();
@@ -250,7 +250,7 @@ namespace SimpleWeb {
250250
251251 public:
252252 unsigned char fin_rsv_opcode;
253- size_t size () noexcept {
253+ std:: size_t size () noexcept {
254254 return length;
255255 }
256256
@@ -268,7 +268,7 @@ namespace SimpleWeb {
268268
269269 private:
270270 Message () noexcept : std::istream(&streambuf) {}
271- size_t length;
271+ std:: size_t length;
272272 asio::streambuf streambuf;
273273 };
274274
@@ -342,8 +342,8 @@ namespace SimpleWeb {
342342 std::shared_ptr<ScopeRunner> handler_runner;
343343
344344 SocketClientBase (const std::string &host_port_path, unsigned short default_port) noexcept : handler_runner(new ScopeRunner()) {
345- size_t host_end = host_port_path.find (' :' );
346- size_t host_port_end = host_port_path.find (' /' );
345+ std:: size_t host_end = host_port_path.find (' :' );
346+ std:: size_t host_port_end = host_port_path.find (' /' );
347347 if (host_end == std::string::npos) {
348348 host_end = host_port_end;
349349 port = default_port;
@@ -384,7 +384,7 @@ namespace SimpleWeb {
384384 nonce.resize (16 );
385385 std::uniform_int_distribution<unsigned short > dist (0 , 255 );
386386 std::random_device rd;
387- for (size_t c = 0 ; c < 16 ; c++)
387+ for (std:: size_t c = 0 ; c < 16 ; c++)
388388 nonce[c] = static_cast <char >(dist (rd));
389389
390390 auto nonce_base64 = std::make_shared<std::string>(Crypto::Base64::encode (nonce));
@@ -397,14 +397,14 @@ namespace SimpleWeb {
397397 connection->message = std::shared_ptr<Message>(new Message ());
398398
399399 connection->set_timeout (config.timeout_request );
400- asio::async_write (*connection->socket , *write_buffer, [this , connection, write_buffer, nonce_base64](const error_code &ec, size_t /* bytes_transferred*/ ) {
400+ asio::async_write (*connection->socket , *write_buffer, [this , connection, write_buffer, nonce_base64](const error_code &ec, std:: size_t /* bytes_transferred*/ ) {
401401 connection->cancel_timeout ();
402402 auto lock = connection->handler_runner ->continue_lock ();
403403 if (!lock)
404404 return ;
405405 if (!ec) {
406406 connection->set_timeout (this ->config .timeout_request );
407- asio::async_read_until (*connection->socket , connection->message ->streambuf , " \r\n\r\n " , [this , connection, nonce_base64](const error_code &ec, size_t /* bytes_transferred*/ ) {
407+ asio::async_read_until (*connection->socket , connection->message ->streambuf , " \r\n\r\n " , [this , connection, nonce_base64](const error_code &ec, std:: size_t /* bytes_transferred*/ ) {
408408 connection->cancel_timeout ();
409409 auto lock = connection->handler_runner ->continue_lock ();
410410 if (!lock)
@@ -435,7 +435,7 @@ namespace SimpleWeb {
435435 }
436436
437437 void read_message (const std::shared_ptr<Connection> &connection) {
438- asio::async_read (*connection->socket , connection->message ->streambuf , asio::transfer_exactly (2 ), [this , connection](const error_code &ec, size_t bytes_transferred) {
438+ asio::async_read (*connection->socket , connection->message ->streambuf , asio::transfer_exactly (2 ), [this , connection](const error_code &ec, std:: size_t bytes_transferred) {
439439 auto lock = connection->handler_runner ->continue_lock ();
440440 if (!lock)
441441 return ;
@@ -458,11 +458,11 @@ namespace SimpleWeb {
458458 return ;
459459 }
460460
461- size_t length = (first_bytes[1 ] & 127 );
461+ std:: size_t length = (first_bytes[1 ] & 127 );
462462
463463 if (length == 126 ) {
464464 // 2 next bytes is the size of content
465- asio::async_read (*connection->socket , connection->message ->streambuf , asio::transfer_exactly (2 ), [this , connection](const error_code &ec, size_t /* bytes_transferred*/ ) {
465+ asio::async_read (*connection->socket , connection->message ->streambuf , asio::transfer_exactly (2 ), [this , connection](const error_code &ec, std:: size_t /* bytes_transferred*/ ) {
466466 auto lock = connection->handler_runner ->continue_lock ();
467467 if (!lock)
468468 return ;
@@ -471,10 +471,10 @@ namespace SimpleWeb {
471471 length_bytes.resize (2 );
472472 connection->message ->read (reinterpret_cast <char *>(&length_bytes[0 ]), 2 );
473473
474- size_t length = 0 ;
475- size_t num_bytes = 2 ;
476- for (size_t c = 0 ; c < num_bytes; c++)
477- length += static_cast <size_t >(length_bytes[c]) << (8 * (num_bytes - 1 - c));
474+ std:: size_t length = 0 ;
475+ std:: size_t num_bytes = 2 ;
476+ for (std:: size_t c = 0 ; c < num_bytes; c++)
477+ length += static_cast <std:: size_t >(length_bytes[c]) << (8 * (num_bytes - 1 - c));
478478
479479 connection->message ->length = length;
480480 this ->read_message_content (connection);
@@ -485,7 +485,7 @@ namespace SimpleWeb {
485485 }
486486 else if (length == 127 ) {
487487 // 8 next bytes is the size of content
488- asio::async_read (*connection->socket , connection->message ->streambuf , asio::transfer_exactly (8 ), [this , connection](const error_code &ec, size_t /* bytes_transferred*/ ) {
488+ asio::async_read (*connection->socket , connection->message ->streambuf , asio::transfer_exactly (8 ), [this , connection](const error_code &ec, std:: size_t /* bytes_transferred*/ ) {
489489 auto lock = connection->handler_runner ->continue_lock ();
490490 if (!lock)
491491 return ;
@@ -494,10 +494,10 @@ namespace SimpleWeb {
494494 length_bytes.resize (8 );
495495 connection->message ->read (reinterpret_cast <char *>(&length_bytes[0 ]), 8 );
496496
497- size_t length = 0 ;
498- size_t num_bytes = 8 ;
499- for (size_t c = 0 ; c < num_bytes; c++)
500- length += static_cast <size_t >(length_bytes[c]) << (8 * (num_bytes - 1 - c));
497+ std:: size_t length = 0 ;
498+ std:: size_t num_bytes = 8 ;
499+ for (std:: size_t c = 0 ; c < num_bytes; c++)
500+ length += static_cast <std:: size_t >(length_bytes[c]) << (8 * (num_bytes - 1 - c));
501501
502502 connection->message ->length = length;
503503 this ->read_message_content (connection);
@@ -517,7 +517,7 @@ namespace SimpleWeb {
517517 }
518518
519519 void read_message_content (const std::shared_ptr<Connection> &connection) {
520- asio::async_read (*connection->socket , connection->message ->streambuf , asio::transfer_exactly (connection->message ->length ), [this , connection](const error_code &ec, size_t /* bytes_transferred*/ ) {
520+ asio::async_read (*connection->socket , connection->message ->streambuf , asio::transfer_exactly (connection->message ->length ), [this , connection](const error_code &ec, std:: size_t /* bytes_transferred*/ ) {
521521 auto lock = connection->handler_runner ->continue_lock ();
522522 if (!lock)
523523 return ;
0 commit comments