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
60f72f0f
Commit
60f72f0f
authored
8 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/Storage: use std::unique_ptr
parent
debc8558
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
StorageCommands.cxx
src/command/StorageCommands.cxx
+7
-8
No files found.
src/command/StorageCommands.cxx
View file @
60f72f0f
...
@@ -40,6 +40,8 @@
...
@@ -40,6 +40,8 @@
#include "IOThread.hxx"
#include "IOThread.hxx"
#include "Idle.hxx"
#include "Idle.hxx"
#include <memory>
#include <inttypes.h>
/* for PRIu64 */
#include <inttypes.h>
/* for PRIu64 */
gcc_pure
gcc_pure
...
@@ -101,13 +103,11 @@ static bool
...
@@ -101,13 +103,11 @@ static bool
handle_listfiles_storage
(
Response
&
r
,
Storage
&
storage
,
const
char
*
uri
,
handle_listfiles_storage
(
Response
&
r
,
Storage
&
storage
,
const
char
*
uri
,
Error
&
error
)
Error
&
error
)
{
{
auto
reader
=
storage
.
OpenDirectory
(
uri
,
error
);
std
::
unique_ptr
<
StorageDirectoryReader
>
reader
(
storage
.
OpenDirectory
(
uri
,
error
)
);
if
(
reader
==
nullptr
)
if
(
reader
==
nullptr
)
return
false
;
return
false
;
bool
success
=
handle_listfiles_storage
(
r
,
*
reader
,
error
);
return
handle_listfiles_storage
(
r
,
*
reader
,
error
);
delete
reader
;
return
success
;
}
}
CommandResult
CommandResult
...
@@ -124,7 +124,8 @@ CommandResult
...
@@ -124,7 +124,8 @@ CommandResult
handle_listfiles_storage
(
Response
&
r
,
const
char
*
uri
)
handle_listfiles_storage
(
Response
&
r
,
const
char
*
uri
)
{
{
Error
error
;
Error
error
;
Storage
*
storage
=
CreateStorageURI
(
io_thread_get
(),
uri
,
error
);
std
::
unique_ptr
<
Storage
>
storage
(
CreateStorageURI
(
io_thread_get
(),
uri
,
error
));
if
(
storage
==
nullptr
)
{
if
(
storage
==
nullptr
)
{
if
(
error
.
IsDefined
())
if
(
error
.
IsDefined
())
return
print_error
(
r
,
error
);
return
print_error
(
r
,
error
);
...
@@ -133,9 +134,7 @@ handle_listfiles_storage(Response &r, const char *uri)
...
@@ -133,9 +134,7 @@ handle_listfiles_storage(Response &r, const char *uri)
return
CommandResult
::
ERROR
;
return
CommandResult
::
ERROR
;
}
}
bool
success
=
handle_listfiles_storage
(
r
,
*
storage
,
""
,
error
);
if
(
!
handle_listfiles_storage
(
r
,
*
storage
,
""
,
error
))
delete
storage
;
if
(
!
success
)
return
print_error
(
r
,
error
);
return
print_error
(
r
,
error
);
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
...
...
This diff is collapsed.
Click to expand it.
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