File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ namespace buffer {
37
37
inline auto message = std::array<char , 256 > {};
38
38
inline auto output = std::array<char , 512 > {};
39
39
40
- inline auto fifo = CircularQueue<char , 4096 > {};
40
+ inline auto fifo = CircularQueue<char , 4096 > {};
41
+ static auto process_buffer = std::array<char , 64 > {};
41
42
42
43
}; // namespace buffer
43
44
@@ -104,9 +105,8 @@ namespace internal {
104
105
inline void process_fifo ()
105
106
{
106
107
while (!buffer::fifo.empty ()) {
107
- auto c = char {};
108
- buffer::fifo.pop (c);
109
- internal::filehandle->write (&c, 1 );
108
+ auto length = buffer::fifo.pop (buffer::process_buffer.data (), std::size (buffer::process_buffer));
109
+ internal::filehandle->write (buffer::process_buffer.data (), length);
110
110
}
111
111
}
112
112
Original file line number Diff line number Diff line change @@ -50,21 +50,21 @@ TEST_F(LogKitFifoTest, processEmpty)
50
50
51
51
TEST_F (LogKitFifoTest, processNotEmpty)
52
52
{
53
- EXPECT_CALL (mockfh, write).Times (128 );
53
+ EXPECT_CALL (mockfh, write).Times (128 / std::size (logger::buffer::process_buffer) );
54
54
55
55
for (auto i = 0 ; i < 128 ; ++i) {
56
- logger::buffer::fifo.push (i );
56
+ logger::buffer::fifo.push (static_cast < char >(i) );
57
57
}
58
58
59
59
logger::process_fifo ();
60
60
}
61
61
62
62
TEST_F (LogKitFifoTest, processFull)
63
63
{
64
- EXPECT_CALL (mockfh, write).Times (4096 );
64
+ EXPECT_CALL (mockfh, write).Times (4096 / std::size (logger::buffer::process_buffer) );
65
65
66
66
for (auto i = 0 ; i < 4096 ; ++i) {
67
- logger::buffer::fifo.push (i );
67
+ logger::buffer::fifo.push (static_cast < char >(i) );
68
68
}
69
69
70
70
logger::process_fifo ();
You can’t perform that action at this time.
0 commit comments