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
31aa6d0c
Commit
31aa6d0c
authored
Nov 11, 2021
by
Rosen Penev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use auto with make_unique
C arrays can be used with make_unique in C++17. Signed-off-by:
Rosen Penev
<
rosenp@gmail.com
>
parent
061dd2df
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
10 additions
and
11 deletions
+10
-11
FileCommands.cxx
src/command/FileCommands.cxx
+1
-1
MadDecoderPlugin.cxx
src/decoder/plugins/MadDecoderPlugin.cxx
+1
-1
SidplayDecoderPlugin.cxx
src/decoder/plugins/SidplayDecoderPlugin.cxx
+2
-2
Util.cxx
src/lib/icu/Util.cxx
+1
-1
VorbisPicture.cxx
src/lib/xiph/VorbisPicture.cxx
+1
-2
OSXOutputPlugin.cxx
src/output/plugins/OSXOutputPlugin.cxx
+1
-1
ApeLoader.cxx
src/tag/ApeLoader.cxx
+1
-1
Id3Load.cxx
src/tag/Id3Load.cxx
+2
-2
No files found.
src/command/FileCommands.cxx
View file @
31aa6d0c
...
...
@@ -213,7 +213,7 @@ read_stream_art(Response &r, const std::string_view art_directory,
std
::
min
<
offset_type
>
(
art_file_size
-
offset
,
r
.
GetClient
().
binary_limit
);
std
::
unique_ptr
<
std
::
byte
[]
>
buffer
(
new
std
::
byte
[
buffer_size
]
);
auto
buffer
=
std
::
make_unique
<
std
::
byte
[]
>
(
buffer_size
);
std
::
size_t
read_size
=
0
;
if
(
buffer_size
>
0
)
{
...
...
src/decoder/plugins/MadDecoderPlugin.cxx
View file @
31aa6d0c
...
...
@@ -310,7 +310,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag *mpd_tag) noexcept
id3_data
=
stream
.
this_frame
;
mad_stream_skip
(
&
(
stream
),
tagsize
);
}
else
{
allocated
.
reset
(
new
id3_byte_t
[
tagsize
]
);
allocated
=
std
::
make_unique
<
id3_byte_t
[]
>
(
tagsize
);
memcpy
(
allocated
.
get
(),
stream
.
this_frame
,
count
);
mad_stream_skip
(
&
(
stream
),
count
);
...
...
src/decoder/plugins/SidplayDecoderPlugin.cxx
View file @
31aa6d0c
...
...
@@ -137,7 +137,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block)
const
auto
kernal_path
=
block
.
GetPath
(
"kernal"
);
if
(
!
kernal_path
.
IsNull
())
{
kernal
.
reset
(
new
uint8_t
[
rom_size
]
);
kernal
=
std
::
make_unique
<
uint8_t
[]
>
(
rom_size
);
loadRom
(
kernal_path
,
kernal
.
get
());
}
...
...
@@ -145,7 +145,7 @@ SidplayGlobal::SidplayGlobal(const ConfigBlock &block)
const
auto
basic_path
=
block
.
GetPath
(
"basic"
);
if
(
!
basic_path
.
IsNull
())
{
basic
.
reset
(
new
uint8_t
[
rom_size
]
);
basic
=
std
::
make_unique
<
uint8_t
[]
>
(
rom_size
);
loadRom
(
basic_path
,
basic
.
get
());
}
#endif
...
...
src/lib/icu/Util.cxx
View file @
31aa6d0c
...
...
@@ -54,7 +54,7 @@ UCharToUTF8(std::basic_string_view<UChar> src)
/* worst-case estimate */
size_t
dest_capacity
=
4
*
src
.
size
();
std
::
unique_ptr
<
char
[]
>
dest
(
new
char
[
dest_capacity
+
1
]
);
auto
dest
=
std
::
make_unique
<
char
[]
>
(
dest_capacity
+
1
);
UErrorCode
error_code
=
U_ZERO_ERROR
;
int32_t
dest_length
;
...
...
src/lib/xiph/VorbisPicture.cxx
View file @
31aa6d0c
...
...
@@ -36,8 +36,7 @@ ScanVorbisPicture(StringView value, TagHandler &handler) noexcept
return
;
size_t
debase64_size
=
CalculateBase64OutputSize
(
value
.
size
);
std
::
unique_ptr
<
uint8_t
[]
>
debase64_buffer
;
debase64_buffer
.
reset
(
new
uint8_t
[
debase64_size
]);
auto
debase64_buffer
=
std
::
make_unique
<
uint8_t
[]
>
(
debase64_size
);
try
{
debase64_size
=
...
...
src/output/plugins/OSXOutputPlugin.cxx
View file @
31aa6d0c
...
...
@@ -291,7 +291,7 @@ osx_output_set_channel_map(OSXOutput *oo)
OSStatus
status
;
const
UInt32
num_channels
=
AudioUnitGetChannelsPerFrame
(
oo
->
au
);
std
::
unique_ptr
<
SInt32
[]
>
channel_map
(
new
SInt32
[
num_channels
]
);
auto
channel_map
=
std
::
make_unique
<
SInt32
[]
>
(
num_channels
);
osx_output_parse_channel_map
(
oo
->
device_name
,
oo
->
channel_map
,
channel_map
.
get
(),
...
...
src/tag/ApeLoader.cxx
View file @
31aa6d0c
...
...
@@ -66,7 +66,7 @@ try {
remaining
-=
sizeof
(
footer
);
assert
(
remaining
>
10
);
std
::
unique_ptr
<
char
[]
>
buffer
(
new
char
[
remaining
]
);
auto
buffer
=
std
::
make_unique
<
char
[]
>
(
remaining
);
is
.
ReadFull
(
lock
,
buffer
.
get
(),
remaining
);
/* read tags */
...
...
src/tag/Id3Load.cxx
View file @
31aa6d0c
...
...
@@ -63,7 +63,7 @@ try {
/* we have enough data already */
return
UniqueId3Tag
(
id3_tag_parse
(
query_buffer
,
tag_size
));
std
::
unique_ptr
<
id3_byte_t
[]
>
tag_buffer
(
new
id3_byte_t
[
tag_size
]
);
auto
tag_buffer
=
std
::
make_unique
<
id3_byte_t
[]
>
(
tag_size
);
/* copy the start of the tag we already have to the allocated
buffer */
...
...
@@ -198,7 +198,7 @@ try {
/* too large, don't allocate so much memory */
return
nullptr
;
std
::
unique_ptr
<
id3_byte_t
[]
>
buffer
(
new
id3_byte_t
[
size
]
);
auto
buffer
=
std
::
make_unique
<
id3_byte_t
[]
>
(
size
);
is
.
ReadFull
(
lock
,
buffer
.
get
(),
size
);
return
UniqueId3Tag
(
id3_tag_parse
(
buffer
.
get
(),
size
));
...
...
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