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
f951e535
Commit
f951e535
authored
Oct 17, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/Charset: don't allow nullptr arguments
parent
080ee87e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
Charset.cxx
src/fs/Charset.cxx
+3
-2
Charset.hxx
src/fs/Charset.hxx
+3
-3
Path.hxx
src/fs/Path.hxx
+2
-2
No files found.
src/fs/Charset.cxx
View file @
f951e535
...
...
@@ -79,8 +79,7 @@ GetFSCharset()
std
::
string
PathToUTF8
(
const
char
*
path_fs
)
{
if
(
path_fs
==
nullptr
)
return
std
::
string
();
assert
(
path_fs
!=
nullptr
);
GIConv
conv
=
g_iconv_open
(
"utf-8"
,
fs_charset
.
c_str
());
if
(
conv
==
reinterpret_cast
<
GIConv
>
(
-
1
))
...
...
@@ -107,6 +106,8 @@ PathToUTF8(const char *path_fs)
char
*
PathFromUTF8
(
const
char
*
path_utf8
)
{
assert
(
path_utf8
!=
nullptr
);
return
g_convert
(
path_utf8
,
-
1
,
fs_charset
.
c_str
(),
"utf-8"
,
nullptr
,
nullptr
,
nullptr
);
...
...
src/fs/Charset.hxx
View file @
f951e535
...
...
@@ -37,13 +37,13 @@ SetFSCharset(const char *charset);
/**
* Convert the path to UTF-8.
* Returns empty string on error
or if #path_fs is null pointer
.
* Returns empty string on error.
*/
gcc_pure
gcc_pure
gcc_nonnull_all
std
::
string
PathToUTF8
(
const
char
*
path_fs
);
gcc_malloc
gcc_malloc
gcc_nonnull_all
char
*
PathFromUTF8
(
const
char
*
path_utf8
);
...
...
src/fs/Path.hxx
View file @
f951e535
...
...
@@ -123,10 +123,10 @@ public:
* Convert a UTF-8 C string to a #Path instance.
* Returns return a "nulled" instance on error.
*/
gcc_pure
gcc_pure
gcc_nonnull_all
static
Path
FromUTF8
(
const
char
*
path_utf8
);
gcc_pure
gcc_pure
gcc_nonnull_all
static
Path
FromUTF8
(
const
char
*
path_utf8
,
Error
&
error
);
/**
...
...
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