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
4817437d
Commit
4817437d
authored
Oct 17, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/Limits: convert macro to "constexpr"
parent
354b5a93
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
13 deletions
+12
-13
PlaylistFile.cxx
src/PlaylistFile.cxx
+1
-1
FileSystem.cxx
src/fs/FileSystem.cxx
+1
-1
Limits.hxx
src/fs/Limits.hxx
+9
-10
Path.cxx
src/fs/Path.cxx
+1
-1
No files found.
src/PlaylistFile.cxx
View file @
4817437d
...
...
@@ -384,7 +384,7 @@ spl_append_song(const char *utf8path, Song *song, Error &error)
return
false
;
}
if
(
st
.
st_size
/
(
MPD_PATH_MAX
+
1
)
>=
(
off_t
)
playlist_max_length
)
{
if
(
st
.
st_size
/
off_t
(
MPD_PATH_MAX
+
1
)
>=
(
off_t
)
playlist_max_length
)
{
fclose
(
file
);
error
.
Set
(
playlist_domain
,
PLAYLIST_RESULT_TOO_LARGE
,
"Stored playlist is too large"
);
...
...
src/fs/FileSystem.cxx
View file @
4817437d
...
...
@@ -34,7 +34,7 @@ Path ReadLink(const Path &path)
ssize_t
size
=
readlink
(
path
.
c_str
(),
buffer
,
MPD_PATH_MAX
);
if
(
size
<
0
)
return
Path
::
Null
();
if
(
size
>=
MPD_PATH_MAX
)
{
if
(
size
_t
(
size
)
>=
MPD_PATH_MAX
)
{
errno
=
ENOMEM
;
return
Path
::
Null
();
}
...
...
src/fs/Limits.hxx
View file @
4817437d
...
...
@@ -22,18 +22,17 @@
#include "check.h"
#include <stddef.h>
#include <limits.h>
#if !defined(MPD_PATH_MAX)
# if defined(WIN32)
# define MPD_PATH_MAX 260
# elif defined(MAXPATHLEN)
# define MPD_PATH_MAX MAXPATHLEN
# elif defined(PATH_MAX)
# define MPD_PATH_MAX PATH_MAX
# else
# define MPD_PATH_MAX 256
# endif
#if defined(WIN32)
static
constexpr
size_t
MPD_PATH_MAX
=
260
;
#elif defined(MAXPATHLEN)
static
constexpr
size_t
MPD_PATH_MAX
=
MAXPATHLEN
;
#elif defined(PATH_MAX)
static
constexpr
size_t
MPD_PATH_MAX
=
PATH_MAX
;
#else
static
constexpr
size_t
MPD_PATH_MAX
=
256
;
#endif
#endif
src/fs/Path.cxx
View file @
4817437d
...
...
@@ -45,7 +45,7 @@
* and assumption that some weird encoding could represent some UTF-8 4 byte
* sequences with single byte.
*/
#define MPD_PATH_MAX_UTF8 ((MPD_PATH_MAX - 1) * 4 + 1)
static
constexpr
size_t
MPD_PATH_MAX_UTF8
=
(
MPD_PATH_MAX
-
1
)
*
4
+
1
;
const
Domain
path_domain
(
"path"
);
...
...
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