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
be081929
Commit
be081929
authored
Feb 07, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage/local: remove utf8 path from constructor
Build the UTF-8 version of the path automatically in the constructor.
parent
b0b086d4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
Main.cxx
src/Main.cxx
+1
-4
LocalStorage.cxx
src/storage/plugins/LocalStorage.cxx
+8
-5
LocalStorage.hxx
src/storage/plugins/LocalStorage.hxx
+1
-1
test_translate_song.cxx
test/test_translate_song.cxx
+4
-3
No files found.
src/Main.cxx
View file @
be081929
...
...
@@ -162,10 +162,7 @@ InitStorage(Error &error)
path_fs
.
ChopSeparators
();
CheckDirectoryReadable
(
path_fs
);
const
auto
utf8
=
path_fs
.
ToUTF8
();
assert
(
!
utf8
.
empty
());
instance
->
storage
=
CreateLocalStorage
(
utf8
.
c_str
(),
path_fs
);
instance
->
storage
=
CreateLocalStorage
(
path_fs
);
return
true
;
}
...
...
src/storage/plugins/LocalStorage.cxx
View file @
be081929
...
...
@@ -50,12 +50,15 @@ public:
};
class
LocalStorage
final
:
public
Storage
{
const
std
::
string
base_utf8
;
const
AllocatedPath
base_fs
;
const
std
::
string
base_utf8
;
public
:
LocalStorage
(
const
char
*
_base_utf8
,
Path
_base_fs
)
:
base_utf8
(
_base_utf8
),
base_fs
(
_base_fs
)
{}
explicit
LocalStorage
(
Path
_base_fs
)
:
base_fs
(
_base_fs
),
base_utf8
(
base_fs
.
ToUTF8
())
{
assert
(
!
base_fs
.
IsNull
());
assert
(
!
base_utf8
.
empty
());
}
/* virtual methods from class Storage */
virtual
bool
GetInfo
(
const
char
*
uri_utf8
,
bool
follow
,
FileInfo
&
info
,
...
...
@@ -203,7 +206,7 @@ LocalDirectoryReader::GetInfo(bool follow, FileInfo &info, Error &error)
}
Storage
*
CreateLocalStorage
(
const
char
*
base_utf8
,
Path
base_fs
)
CreateLocalStorage
(
Path
base_fs
)
{
return
new
LocalStorage
(
base_
utf8
,
base_
fs
);
return
new
LocalStorage
(
base_fs
);
}
src/storage/plugins/LocalStorage.hxx
View file @
be081929
...
...
@@ -28,6 +28,6 @@ class Path;
gcc_malloc
gcc_nonnull_all
Storage
*
CreateLocalStorage
(
const
char
*
base_utf8
,
Path
base_fs
);
CreateLocalStorage
(
Path
base_fs
);
#endif
test/test_translate_song.cxx
View file @
be081929
...
...
@@ -38,9 +38,8 @@ uri_supported_scheme(const char *uri)
return
memcmp
(
uri
,
"http://"
,
7
)
==
0
;
}
const
char
*
const
music_directory
=
"/music"
;
static
Storage
*
const
storage
=
CreateLocalStorage
(
music_directory
,
Path
::
FromFS
(
music_directory
));
static
const
char
*
const
music_directory
=
"/music"
;
static
Storage
*
storage
;
static
void
BuildTag
(
gcc_unused
TagBuilder
&
tag
)
...
...
@@ -308,6 +307,8 @@ CPPUNIT_TEST_SUITE_REGISTRATION(TranslateSongTest);
int
main
(
gcc_unused
int
argc
,
gcc_unused
char
**
argv
)
{
storage
=
CreateLocalStorage
(
Path
::
FromFS
(
music_directory
));
CppUnit
::
TextUi
::
TestRunner
runner
;
auto
&
registry
=
CppUnit
::
TestFactoryRegistry
::
getRegistry
();
runner
.
addTest
(
registry
.
makeTest
());
...
...
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