Skip to content

Commit ba10597

Browse files
committed
Code analysis fixes
1 parent 96dab6a commit ba10597

5 files changed

Lines changed: 14 additions & 8 deletions

File tree

src/ByteBuffer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ void ByteBuffer::put(uint8_t b, uint32_t index) {
258258
insert<uint8_t>(b, index);
259259
}
260260

261-
void ByteBuffer::putBytes(const uint8_t* b, uint32_t len) {
261+
void ByteBuffer::putBytes(const uint8_t* const b, uint32_t len) {
262262
// Insert the data one byte at a time into the internal buffer at position i+starting index
263263
for (uint32_t i = 0; i < len; i++)
264264
append<uint8_t>(b[i]);
265265
}
266266

267-
void ByteBuffer::putBytes(const uint8_t* b, uint32_t len, uint32_t index) {
267+
void ByteBuffer::putBytes(const uint8_t* const b, uint32_t len, uint32_t index) {
268268
wpos = index;
269269

270270
// Insert the data one byte at a time into the internal buffer at position i+starting index

src/ByteBuffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ class ByteBuffer {
9595
void put(const ByteBuffer* src); // Relative write of the entire contents of another ByteBuffer (src)
9696
void put(uint8_t b); // Relative write
9797
void put(uint8_t b, uint32_t index); // Absolute write at index
98-
void putBytes(const uint8_t* b, uint32_t len); // Relative write
99-
void putBytes(const uint8_t* b, uint32_t len, uint32_t index); // Absolute write starting at index
98+
void putBytes(const uint8_t* const b, uint32_t len); // Relative write
99+
void putBytes(const uint8_t* const b, uint32_t len, uint32_t index); // Absolute write starting at index
100100
void putChar(char value); // Relative
101101
void putChar(char value, uint32_t index); // Absolute
102102
void putDouble(double value);

src/Client.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class Client {
3434
public:
3535
Client(int fd, sockaddr_in addr);
3636
~Client();
37+
Client& operator=(Client const&) = delete; // Copy assignment
38+
Client(Client &&) = delete; // Move
39+
Client& operator=(Client &&) = delete; // Move assignment
3740

3841
sockaddr_in getClientAddr() const {
3942
return clientAddr;

src/HTTPMessage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ HTTPMessage::HTTPMessage() : ByteBuffer(4096) {
2727
}
2828

2929
HTTPMessage::HTTPMessage(std::string const& sData) : ByteBuffer(sData.size() + 1) {
30-
putBytes((uint8_t*)sData.c_str(), sData.size() + 1);
30+
putBytes((const uint8_t* const)sData.c_str(), sData.size() + 1);
3131
}
3232

3333
HTTPMessage::HTTPMessage(const uint8_t* pData, uint32_t len) : ByteBuffer(pData, len) {
@@ -46,7 +46,7 @@ void HTTPMessage::putLine(std::string str, bool crlf_end) {
4646
str += "\r\n";
4747

4848
// Put the entire contents of str into the buffer
49-
putBytes((uint8_t*)str.c_str(), str.size());
49+
putBytes((const uint8_t* const)str.c_str(), str.size());
5050
}
5151

5252
/**

src/SendQueueItem.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ class SendQueueItem {
3939
SendQueueItem(std::unique_ptr<uint8_t[]> data, uint32_t size, bool dc) : sendData(std::move(data)), sendSize(size), disconnect(dc) {
4040
}
4141

42-
~SendQueueItem() {
43-
}
42+
~SendQueueItem() = default;
43+
SendQueueItem(SendQueueItem const&) = delete; // Copy constructor
44+
SendQueueItem& operator=(SendQueueItem const&) = delete; // Copy assignment
45+
SendQueueItem(SendQueueItem &&) = delete; // Move
46+
SendQueueItem& operator=(SendQueueItem &&) = delete; // Move assignment
4447

4548
void setOffset(uint32_t off) {
4649
sendOffset = off;

0 commit comments

Comments
 (0)