Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
eea0e084
Commit
eea0e084
authored
Jan 21, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/PeakBuffer: use std::byte instead of std::uint8_t
parent
fa82f558
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
PeakBuffer.cxx
src/util/PeakBuffer.cxx
+5
-5
PeakBuffer.hxx
src/util/PeakBuffer.hxx
+1
-2
No files found.
src/util/PeakBuffer.cxx
View file @
eea0e084
...
...
@@ -76,7 +76,7 @@ PeakBuffer::Consume(std::size_t length) noexcept
}
static
std
::
size_t
AppendTo
(
DynamicFifoBuffer
<
uint8_t
>
&
buffer
,
AppendTo
(
DynamicFifoBuffer
<
std
::
byte
>
&
buffer
,
const
void
*
data
,
size_t
length
)
noexcept
{
assert
(
data
!=
nullptr
);
...
...
@@ -93,7 +93,7 @@ AppendTo(DynamicFifoBuffer<uint8_t> &buffer,
memcpy
(
p
.
data
,
data
,
nbytes
);
buffer
.
Append
(
nbytes
);
data
=
(
const
uint8_t
*
)
data
+
nbytes
;
data
=
(
const
std
::
byte
*
)
data
+
nbytes
;
length
-=
nbytes
;
total
+=
nbytes
;
}
while
(
length
>
0
);
...
...
@@ -113,11 +113,11 @@ PeakBuffer::Append(const void *data, std::size_t length)
}
if
(
normal_buffer
==
nullptr
)
normal_buffer
=
new
DynamicFifoBuffer
<
uint8_t
>
(
normal_size
);
normal_buffer
=
new
DynamicFifoBuffer
<
std
::
byte
>
(
normal_size
);
std
::
size_t
nbytes
=
AppendTo
(
*
normal_buffer
,
data
,
length
);
if
(
nbytes
>
0
)
{
data
=
(
const
uint8_t
*
)
data
+
nbytes
;
data
=
(
const
std
::
byte
*
)
data
+
nbytes
;
length
-=
nbytes
;
if
(
length
==
0
)
return
true
;
...
...
@@ -125,7 +125,7 @@ PeakBuffer::Append(const void *data, std::size_t length)
if
(
peak_buffer
==
nullptr
)
{
if
(
peak_size
>
0
)
peak_buffer
=
new
DynamicFifoBuffer
<
uint8_t
>
(
peak_size
);
peak_buffer
=
new
DynamicFifoBuffer
<
std
::
byte
>
(
peak_size
);
if
(
peak_buffer
==
nullptr
)
return
false
;
}
...
...
src/util/PeakBuffer.hxx
View file @
eea0e084
...
...
@@ -23,7 +23,6 @@
#include "Compiler.h"
#include <cstddef>
#include <cstdint>
template
<
typename
T
>
struct
WritableBuffer
;
template
<
typename
T
>
class
DynamicFifoBuffer
;
...
...
@@ -36,7 +35,7 @@ template<typename T> class DynamicFifoBuffer;
class
PeakBuffer
{
std
::
size_t
normal_size
,
peak_size
;
DynamicFifoBuffer
<
uint8_t
>
*
normal_buffer
,
*
peak_buffer
;
DynamicFifoBuffer
<
std
::
byte
>
*
normal_buffer
,
*
peak_buffer
;
public
:
PeakBuffer
(
std
::
size_t
_normal_size
,
std
::
size_t
_peak_size
)
noexcept
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment