Skip to content

Commit 8cf005d

Browse files
committed
Codebase modernization
1 parent bf4458c commit 8cf005d

10 files changed

Lines changed: 164 additions & 164 deletions

src/ByteBuffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ class ByteBuffer {
7777
}
7878

7979
public:
80-
ByteBuffer(unsigned int size = DEFAULT_SIZE);
81-
ByteBuffer(const byte* arr, unsigned int size);
80+
explicit ByteBuffer(unsigned int size = DEFAULT_SIZE);
81+
explicit ByteBuffer(const byte* arr, unsigned int size);
8282
virtual ~ByteBuffer();
8383

8484
unsigned int bytesRemaining() const; // Number of bytes from the current read position till the end of the buffer

src/HTTPMessage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ HTTPMessage::HTTPMessage(std::string const& sData) : ByteBuffer(sData.size() + 1
2525
putBytes((byte*)sData.c_str(), sData.size() + 1);
2626
}
2727

28-
HTTPMessage::HTTPMessage(byte* pData, unsigned int len) : ByteBuffer(pData, len) {
28+
HTTPMessage::HTTPMessage(const byte* pData, unsigned int len) : ByteBuffer(pData, len) {
2929
}
3030

3131
/**

src/HTTPMessage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class HTTPMessage : public ByteBuffer {
9393
public:
9494
HTTPMessage();
9595
explicit HTTPMessage(std::string const& sData);
96-
explicit HTTPMessage(byte *pData, unsigned int len);
96+
explicit HTTPMessage(const byte *pData, unsigned int len);
9797
virtual ~HTTPMessage() = default;
9898

9999
virtual byte* create() = 0;
@@ -124,7 +124,7 @@ class HTTPMessage : public ByteBuffer {
124124
return parseErrorStr;
125125
}
126126

127-
void setVersion(std::string v) {
127+
void setVersion(std::string const& v) {
128128
version = v;
129129
}
130130

src/HTTPRequest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ HTTPRequest::HTTPRequest() : HTTPMessage() {
2525
HTTPRequest::HTTPRequest(std::string const& sData) : HTTPMessage(sData) {
2626
}
2727

28-
HTTPRequest::HTTPRequest(byte* pData, unsigned int len) : HTTPMessage(pData, len) {
28+
HTTPRequest::HTTPRequest(const byte* pData, unsigned int len) : HTTPMessage(pData, len) {
2929
}
3030

3131
/**

src/HTTPRequest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121

2222
#include "HTTPMessage.h"
2323

24-
class HTTPRequest : public HTTPMessage {
24+
class HTTPRequest final : public HTTPMessage {
2525
private:
2626
int method = 0;
2727
std::string requestUri = "";
2828

2929
public:
3030
HTTPRequest();
3131
explicit HTTPRequest(std::string const& sData);
32-
explicit HTTPRequest(byte *pData, unsigned int len);
32+
explicit HTTPRequest(const byte *pData, unsigned int len);
3333
~HTTPRequest() = default;
3434

3535
virtual byte *create();

src/HTTPResponse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ HTTPResponse::HTTPResponse() : HTTPMessage() {
2525
HTTPResponse::HTTPResponse(std::string const& sData) : HTTPMessage(sData) {
2626
}
2727

28-
HTTPResponse::HTTPResponse(byte* pData, unsigned int len) : HTTPMessage(pData, len) {
28+
HTTPResponse::HTTPResponse(const byte* pData, unsigned int len) : HTTPMessage(pData, len) {
2929
}
3030

3131
/**

src/HTTPResponse.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include "HTTPMessage.h"
2323

24-
class HTTPResponse : public HTTPMessage {
24+
class HTTPResponse final : public HTTPMessage {
2525
private:
2626
// Response variables
2727
int status = 0;
@@ -33,7 +33,7 @@ class HTTPResponse : public HTTPMessage {
3333
public:
3434
HTTPResponse();
3535
explicit HTTPResponse(std::string const& sData);
36-
explicit HTTPResponse(byte *pData, unsigned int len);
36+
explicit HTTPResponse(const byte *pData, unsigned int len);
3737
~HTTPResponse() = default;
3838

3939
byte* create() final;

src/HTTPServer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ ResourceHost* HTTPServer::getResourceHostForRequest(HTTPRequest* req) {
662662

663663
// All vhosts have the port appended, so need to append it to the host if it doesnt exist
664664
if (!host.contains(":")) {
665-
host.append(":" + std::to_string(listenPort));
665+
host.append(std::format(":{}", listenPort));
666666
}
667667

668668
std::unordered_map<std::string, ResourceHost*>::const_iterator it = vhosts.find(host);

0 commit comments

Comments
 (0)