Commit 00a3ac9b authored by knowledge4igor's avatar knowledge4igor

Tiny code style improvements

parent 6f2cb3fc
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#pragma once #pragma once
#include <pistache/os.h>
#include <cstddef> #include <cstddef>
#include <stdexcept> #include <stdexcept>
#include <cstring> #include <cstring>
...@@ -15,7 +17,6 @@ ...@@ -15,7 +17,6 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <pistache/os.h>
namespace Pistache { namespace Pistache {
...@@ -124,8 +125,8 @@ size_t ArrayStreamBuf<CharT>::maxSize = Const::DefaultMaxPayload; ...@@ -124,8 +125,8 @@ size_t ArrayStreamBuf<CharT>::maxSize = Const::DefaultMaxPayload;
struct Buffer struct Buffer
{ {
Buffer(); Buffer();
Buffer(std::string _data, int _length, bool _isDetached = false); Buffer(std::string data, int length, bool isDetached = false);
Buffer(const char * _data, int _length, bool _isDetached = false); Buffer(const char * data, int length, bool isDetached = false);
Buffer detach(size_t fromIndex); Buffer detach(size_t fromIndex);
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
*/ */
#include <pistache/stream.h>
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include <string> #include <string>
...@@ -12,7 +14,6 @@ ...@@ -12,7 +14,6 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <pistache/stream.h>
namespace Pistache { namespace Pistache {
...@@ -22,19 +23,19 @@ Buffer::Buffer() ...@@ -22,19 +23,19 @@ Buffer::Buffer()
, isDetached(false) , isDetached(false)
{ } { }
Buffer::Buffer(std::string _data, int _length, bool _isDetached) Buffer::Buffer(std::string data, int length, bool isDetached)
: data(std::move(_data)) : data(std::move(data))
, length(_length) , length(length)
, isDetached(_isDetached) , isDetached(isDetached)
{ } { }
Buffer::Buffer(const char * _data, int _length, bool _isDetached) Buffer::Buffer(const char* data, int length, bool isDetached)
: data() : data()
, length(_length) , length(length)
, isDetached(_isDetached) , isDetached(isDetached)
{ {
data.resize(_length + 1); this->data.resize(length + 1);
data.assign(_data, _length + 1); this->data.assign(data, length + 1);
} }
Buffer Buffer::detach(size_t fromIndex) Buffer Buffer::detach(size_t fromIndex)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment