This commit is contained in:
azw 2023-05-13 03:23:27 +00:00
parent 0cda98b651
commit 56e52ca357
2 changed files with 9 additions and 9 deletions

View File

@ -10,7 +10,7 @@ struct BufHead
namespace a8 namespace a8
{ {
FifoBuffer::FifoBuffer(unsigned int buf_len) FifoBuffer::FifoBuffer(int buf_len)
{ {
if (buf_len <= 0) { if (buf_len <= 0) {
abort(); abort();
@ -27,12 +27,12 @@ namespace a8
buf_len_ = 0; buf_len_ = 0;
} }
char* FifoBuffer::Alloc(unsigned int len) char* FifoBuffer::Alloc(int len)
{ {
if (len <= 0) { if (len <= 0) {
abort(); abort();
} }
unsigned int real_len = len + sizeof(BufHead); int real_len = len + sizeof(BufHead);
} }
void FifoBuffer::Free(char* p) void FifoBuffer::Free(char* p)

View File

@ -9,19 +9,19 @@ namespace a8
{ {
public: public:
FifoBuffer(unsigned int buf_len); FifoBuffer(int buf_len);
~FifoBuffer(); ~FifoBuffer();
char* Alloc(unsigned int len); char* Alloc(int len);
void Free(char* p); void Free(char* p);
private: private:
char* buf_ = nullptr; char* buf_ = nullptr;
unsigned int buf_len_ = 0; int buf_len_ = 0;
std::atomic<unsigned int> head_ = 0; std::atomic<int> head_ = 0;
std::atomic<unsigned int> tail_ = 0; std::atomic<int> tail_ = 0;
std::atomic<unsigned int> capacity_ = 0; std::atomic<int> capacity_ = 0;
}; };