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
fc3e0dfc
Commit
fc3e0dfc
authored
Apr 12, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/AllocatedPath: add method FromUTF8Throw()
parent
6513ff92
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
10 deletions
+22
-10
PlaylistSave.cxx
src/PlaylistSave.cxx
+3
-4
AllocatedPath.cxx
src/fs/AllocatedPath.cxx
+10
-0
AllocatedPath.hxx
src/fs/AllocatedPath.hxx
+7
-0
EmbeddedCuePlaylistPlugin.cxx
src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx
+1
-3
FlacPlaylistPlugin.cxx
src/playlist/plugins/FlacPlaylistPlugin.cxx
+1
-3
No files found.
src/PlaylistSave.cxx
View file @
fc3e0dfc
...
...
@@ -43,9 +43,8 @@ playlist_print_song(BufferedOutputStream &os, const DetachedSong &song)
:
song
.
GetURI
();
try
{
const
auto
uri_fs
=
AllocatedPath
::
FromUTF8
(
uri_utf8
);
if
(
!
uri_fs
.
IsNull
())
os
.
Format
(
"%s
\n
"
,
NarrowPath
(
uri_fs
).
c_str
());
const
auto
uri_fs
=
AllocatedPath
::
FromUTF8Throw
(
uri_utf8
);
os
.
Format
(
"%s
\n
"
,
NarrowPath
(
uri_fs
).
c_str
());
}
catch
(
const
std
::
runtime_error
&
)
{
}
}
...
...
@@ -61,7 +60,7 @@ playlist_print_uri(BufferedOutputStream &os, const char *uri)
?
map_uri_fs
(
uri
)
:
#endif
AllocatedPath
::
FromUTF8
(
uri
);
AllocatedPath
::
FromUTF8
Throw
(
uri
);
if
(
!
path
.
IsNull
())
os
.
Format
(
"%s
\n
"
,
NarrowPath
(
path
).
c_str
());
...
...
src/fs/AllocatedPath.cxx
View file @
fc3e0dfc
...
...
@@ -44,6 +44,16 @@ AllocatedPath::FromUTF8(const char *path_utf8)
}
AllocatedPath
AllocatedPath
::
FromUTF8Throw
(
const
char
*
path_utf8
)
{
#if defined(HAVE_FS_CHARSET) || defined(WIN32)
return
AllocatedPath
(
::
PathFromUTF8
(
path_utf8
));
#else
return
FromFS
(
path_utf8
);
#endif
}
AllocatedPath
AllocatedPath
::
FromUTF8
(
const
char
*
path_utf8
,
Error
&
error
)
{
AllocatedPath
path
=
FromUTF8
(
path_utf8
);
...
...
src/fs/AllocatedPath.hxx
View file @
fc3e0dfc
...
...
@@ -157,6 +157,13 @@ public:
gcc_pure
gcc_nonnull_all
static
AllocatedPath
FromUTF8
(
const
char
*
path_utf8
);
/**
* Convert a UTF-8 C string to an #AllocatedPath instance.
* Throws a std::runtime_error on error.
*/
gcc_pure
gcc_nonnull_all
static
AllocatedPath
FromUTF8Throw
(
const
char
*
path_utf8
);
gcc_pure
gcc_nonnull_all
static
AllocatedPath
FromUTF8
(
const
char
*
path_utf8
,
Error
&
error
);
...
...
src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx
View file @
fc3e0dfc
...
...
@@ -96,9 +96,7 @@ embcue_playlist_open_uri(const char *uri,
/* only local files supported */
return
nullptr
;
const
auto
path_fs
=
AllocatedPath
::
FromUTF8
(
uri
);
if
(
path_fs
.
IsNull
())
return
nullptr
;
const
auto
path_fs
=
AllocatedPath
::
FromUTF8Throw
(
uri
);
const
auto
playlist
=
new
EmbeddedCuePlaylist
();
...
...
src/playlist/plugins/FlacPlaylistPlugin.cxx
View file @
fc3e0dfc
...
...
@@ -94,9 +94,7 @@ flac_playlist_open_uri(const char *uri,
/* only local files supported */
return
nullptr
;
const
auto
path_fs
=
AllocatedPath
::
FromUTF8
(
uri
);
if
(
path_fs
.
IsNull
())
return
nullptr
;
const
auto
path_fs
=
AllocatedPath
::
FromUTF8Throw
(
uri
);
const
NarrowPath
narrow_path_fs
(
path_fs
);
...
...
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