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
e4dad42c
Commit
e4dad42c
authored
Apr 30, 2020
by
Rosen Penev
Committed by
Max Kellermann
May 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use std chr functions
The ones in std have overloads for const char/char. Signed-off-by:
Rosen Penev
<
rosenp@gmail.com
>
parent
99afe8e6
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
71 additions
and
77 deletions
+71
-77
Permission.cxx
src/Permission.cxx
+2
-3
PlaylistDatabase.cxx
src/PlaylistDatabase.cxx
+5
-4
PlaylistFile.cxx
src/PlaylistFile.cxx
+4
-5
SongSave.cxx
src/SongSave.cxx
+1
-1
SongUpdate.cxx
src/SongUpdate.cxx
+2
-2
Read.cxx
src/client/Read.cxx
+2
-2
StorageCommands.cxx
src/command/StorageCommands.cxx
+2
-2
Path.cxx
src/config/Path.cxx
+1
-1
Archive.cxx
src/db/update/Archive.cxx
+1
-1
InotifyUpdate.cxx
src/db/update/InotifyUpdate.cxx
+1
-1
Walk.cxx
src/db/update/Walk.cxx
+2
-2
FaadDecoderPlugin.cxx
src/decoder/plugins/FaadDecoderPlugin.cxx
+3
-5
StandardDirectory.cxx
src/fs/StandardDirectory.cxx
+1
-1
Traits.hxx
src/fs/Traits.hxx
+1
-1
CdioParanoiaInputPlugin.cxx
src/input/plugins/CdioParanoiaInputPlugin.cxx
+1
-1
FileReader.cxx
src/lib/nfs/FileReader.cxx
+3
-3
HostParser.cxx
src/net/HostParser.cxx
+1
-1
Resolver.cxx
src/net/Resolver.cxx
+1
-1
SocketAddress.cxx
src/net/SocketAddress.cxx
+1
-1
ToString.cxx
src/net/ToString.cxx
+2
-3
HttpdClient.cxx
src/output/plugins/httpd/HttpdClient.cxx
+3
-3
PlaylistSong.cxx
src/playlist/PlaylistSong.cxx
+1
-1
CueParser.cxx
src/playlist/cue/CueParser.cxx
+2
-2
CurlStorage.cxx
src/storage/plugins/CurlStorage.cxx
+1
-1
NfsStorage.cxx
src/storage/plugins/NfsStorage.cxx
+1
-1
UdisksStorage.cxx
src/storage/plugins/UdisksStorage.cxx
+1
-1
ApeLoader.cxx
src/tag/ApeLoader.cxx
+2
-3
DivideString.cxx
src/util/DivideString.cxx
+2
-2
MimeType.cxx
src/util/MimeType.cxx
+2
-2
StringAPI.hxx
src/util/StringAPI.hxx
+7
-7
TextFile.hxx
src/util/TextFile.hxx
+2
-2
UriExtract.cxx
src/util/UriExtract.cxx
+3
-3
UriUtil.cxx
src/util/UriUtil.cxx
+4
-5
WStringAPI.hxx
src/util/WStringAPI.hxx
+3
-3
No files found.
src/Permission.cxx
View file @
e4dad42c
...
@@ -27,12 +27,11 @@
...
@@ -27,12 +27,11 @@
#include "util/StringView.hxx"
#include "util/StringView.hxx"
#include <cassert>
#include <cassert>
#include <cstring>
#include <map>
#include <map>
#include <string>
#include <string>
#include <utility>
#include <utility>
#include <string.h>
static
constexpr
char
PERMISSION_PASSWORD_CHAR
=
'@'
;
static
constexpr
char
PERMISSION_PASSWORD_CHAR
=
'@'
;
static
constexpr
char
PERMISSION_SEPARATOR
=
','
;
static
constexpr
char
PERMISSION_SEPARATOR
=
','
;
...
@@ -89,7 +88,7 @@ initPermissions(const ConfigData &config)
...
@@ -89,7 +88,7 @@ initPermissions(const ConfigData &config)
permission_default
=
0
;
permission_default
=
0
;
param
.
With
([](
const
char
*
value
){
param
.
With
([](
const
char
*
value
){
const
char
*
separator
=
strchr
(
value
,
const
char
*
separator
=
st
d
::
st
rchr
(
value
,
PERMISSION_PASSWORD_CHAR
);
PERMISSION_PASSWORD_CHAR
);
if
(
separator
==
nullptr
)
if
(
separator
==
nullptr
)
...
...
src/PlaylistDatabase.cxx
View file @
e4dad42c
...
@@ -25,7 +25,8 @@
...
@@ -25,7 +25,8 @@
#include "util/StringStrip.hxx"
#include "util/StringStrip.hxx"
#include "util/RuntimeError.hxx"
#include "util/RuntimeError.hxx"
#include <string.h>
#include <cstring>
#include <stdlib.h>
#include <stdlib.h>
void
void
...
@@ -49,8 +50,8 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name)
...
@@ -49,8 +50,8 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name)
const
char
*
value
;
const
char
*
value
;
while
((
line
=
file
.
ReadLine
())
!=
nullptr
&&
while
((
line
=
file
.
ReadLine
())
!=
nullptr
&&
strcmp
(
line
,
"playlist_end"
)
!=
0
)
{
st
d
::
st
rcmp
(
line
,
"playlist_end"
)
!=
0
)
{
colon
=
strchr
(
line
,
':'
);
colon
=
st
d
::
st
rchr
(
line
,
':'
);
if
(
colon
==
nullptr
||
colon
==
line
)
if
(
colon
==
nullptr
||
colon
==
line
)
throw
FormatRuntimeError
(
"unknown line in db: %s"
,
throw
FormatRuntimeError
(
"unknown line in db: %s"
,
line
);
line
);
...
@@ -58,7 +59,7 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name)
...
@@ -58,7 +59,7 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name)
*
colon
++
=
0
;
*
colon
++
=
0
;
value
=
StripLeft
(
colon
);
value
=
StripLeft
(
colon
);
if
(
strcmp
(
line
,
"mtime"
)
==
0
)
if
(
st
d
::
st
rcmp
(
line
,
"mtime"
)
==
0
)
pm
.
mtime
=
std
::
chrono
::
system_clock
::
from_time_t
(
strtol
(
value
,
nullptr
,
10
));
pm
.
mtime
=
std
::
chrono
::
system_clock
::
from_time_t
(
strtol
(
value
,
nullptr
,
10
));
else
else
throw
FormatRuntimeError
(
"unknown line in db: %s"
,
throw
FormatRuntimeError
(
"unknown line in db: %s"
,
...
...
src/PlaylistFile.cxx
View file @
e4dad42c
...
@@ -43,8 +43,7 @@
...
@@ -43,8 +43,7 @@
#include "util/UriExtract.hxx"
#include "util/UriExtract.hxx"
#include <cassert>
#include <cassert>
#include <cstring>
#include <string.h>
static
const
char
PLAYLIST_COMMENT
=
'#'
;
static
const
char
PLAYLIST_COMMENT
=
'#'
;
...
@@ -81,9 +80,9 @@ spl_valid_name(const char *name_utf8)
...
@@ -81,9 +80,9 @@ spl_valid_name(const char *name_utf8)
* filenames isn't going to happen, either.
* filenames isn't going to happen, either.
*/
*/
return
strchr
(
name_utf8
,
'/'
)
==
nullptr
&&
return
st
d
::
st
rchr
(
name_utf8
,
'/'
)
==
nullptr
&&
strchr
(
name_utf8
,
'\n'
)
==
nullptr
&&
st
d
::
st
rchr
(
name_utf8
,
'\n'
)
==
nullptr
&&
strchr
(
name_utf8
,
'\r'
)
==
nullptr
;
st
d
::
st
rchr
(
name_utf8
,
'\r'
)
==
nullptr
;
}
}
static
const
AllocatedPath
&
static
const
AllocatedPath
&
...
...
src/SongSave.cxx
View file @
e4dad42c
...
@@ -96,7 +96,7 @@ song_load(TextFile &file, const char *uri,
...
@@ -96,7 +96,7 @@ song_load(TextFile &file, const char *uri,
char
*
line
;
char
*
line
;
while
((
line
=
file
.
ReadLine
())
!=
nullptr
&&
while
((
line
=
file
.
ReadLine
())
!=
nullptr
&&
!
StringIsEqual
(
line
,
SONG_END
))
{
!
StringIsEqual
(
line
,
SONG_END
))
{
char
*
colon
=
strchr
(
line
,
':'
);
char
*
colon
=
st
d
::
st
rchr
(
line
,
':'
);
if
(
colon
==
nullptr
||
colon
==
line
)
{
if
(
colon
==
nullptr
||
colon
==
line
)
{
throw
FormatRuntimeError
(
"unknown line in db: %s"
,
line
);
throw
FormatRuntimeError
(
"unknown line in db: %s"
,
line
);
}
}
...
...
src/SongUpdate.cxx
View file @
e4dad42c
...
@@ -44,7 +44,7 @@ SongPtr
...
@@ -44,7 +44,7 @@ SongPtr
Song
::
LoadFile
(
Storage
&
storage
,
const
char
*
path_utf8
,
Directory
&
parent
)
Song
::
LoadFile
(
Storage
&
storage
,
const
char
*
path_utf8
,
Directory
&
parent
)
{
{
assert
(
!
uri_has_scheme
(
path_utf8
));
assert
(
!
uri_has_scheme
(
path_utf8
));
assert
(
strchr
(
path_utf8
,
'\n'
)
==
nullptr
);
assert
(
st
d
::
st
rchr
(
path_utf8
,
'\n'
)
==
nullptr
);
auto
song
=
std
::
make_unique
<
Song
>
(
path_utf8
,
parent
);
auto
song
=
std
::
make_unique
<
Song
>
(
path_utf8
,
parent
);
if
(
!
song
->
UpdateFile
(
storage
))
if
(
!
song
->
UpdateFile
(
storage
))
...
@@ -95,7 +95,7 @@ Song::LoadFromArchive(ArchiveFile &archive, const char *name_utf8,
...
@@ -95,7 +95,7 @@ Song::LoadFromArchive(ArchiveFile &archive, const char *name_utf8,
Directory
&
parent
)
noexcept
Directory
&
parent
)
noexcept
{
{
assert
(
!
uri_has_scheme
(
name_utf8
));
assert
(
!
uri_has_scheme
(
name_utf8
));
assert
(
strchr
(
name_utf8
,
'\n'
)
==
nullptr
);
assert
(
st
d
::
st
rchr
(
name_utf8
,
'\n'
)
==
nullptr
);
auto
song
=
std
::
make_unique
<
Song
>
(
name_utf8
,
parent
);
auto
song
=
std
::
make_unique
<
Song
>
(
name_utf8
,
parent
);
if
(
!
song
->
UpdateFileInArchive
(
archive
))
if
(
!
song
->
UpdateFileInArchive
(
archive
))
...
...
src/client/Read.cxx
View file @
e4dad42c
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
#include "Instance.hxx"
#include "Instance.hxx"
#include "util/StringStrip.hxx"
#include "util/StringStrip.hxx"
#include <
string.h
>
#include <
cstring
>
BufferedSocket
::
InputResult
BufferedSocket
::
InputResult
Client
::
OnSocketInput
(
void
*
data
,
size_t
length
)
noexcept
Client
::
OnSocketInput
(
void
*
data
,
size_t
length
)
noexcept
...
@@ -32,7 +32,7 @@ Client::OnSocketInput(void *data, size_t length) noexcept
...
@@ -32,7 +32,7 @@ Client::OnSocketInput(void *data, size_t length) noexcept
return
InputResult
::
PAUSE
;
return
InputResult
::
PAUSE
;
char
*
p
=
(
char
*
)
data
;
char
*
p
=
(
char
*
)
data
;
char
*
newline
=
(
char
*
)
memchr
(
p
,
'\n'
,
length
);
char
*
newline
=
(
char
*
)
std
::
memchr
(
p
,
'\n'
,
length
);
if
(
newline
==
nullptr
)
if
(
newline
==
nullptr
)
return
InputResult
::
MORE
;
return
InputResult
::
MORE
;
...
...
src/command/StorageCommands.cxx
View file @
e4dad42c
...
@@ -44,7 +44,7 @@ gcc_pure
...
@@ -44,7 +44,7 @@ gcc_pure
static
bool
static
bool
skip_path
(
const
char
*
name_utf8
)
noexcept
skip_path
(
const
char
*
name_utf8
)
noexcept
{
{
return
strchr
(
name_utf8
,
'\n'
)
!=
nullptr
;
return
st
d
::
st
rchr
(
name_utf8
,
'\n'
)
!=
nullptr
;
}
}
#if defined(_WIN32) && GCC_CHECK_VERSION(4,6)
#if defined(_WIN32) && GCC_CHECK_VERSION(4,6)
...
@@ -185,7 +185,7 @@ handle_mount(Client &client, Request args, Response &r)
...
@@ -185,7 +185,7 @@ handle_mount(Client &client, Request args, Response &r)
return
CommandResult
::
ERROR
;
return
CommandResult
::
ERROR
;
}
}
if
(
strchr
(
local_uri
,
'/'
)
!=
nullptr
)
{
if
(
st
d
::
st
rchr
(
local_uri
,
'/'
)
!=
nullptr
)
{
/* allow only top-level mounts for now */
/* allow only top-level mounts for now */
/* TODO: eliminate this limitation after ensuring that
/* TODO: eliminate this limitation after ensuring that
UpdateQueue::Erase() really gets called for every
UpdateQueue::Erase() really gets called for every
...
...
src/config/Path.cxx
View file @
e4dad42c
...
@@ -103,7 +103,7 @@ ParsePath(const char *path)
...
@@ -103,7 +103,7 @@ ParsePath(const char *path)
++
path
;
++
path
;
}
else
{
}
else
{
const
char
*
slash
=
strchr
(
path
,
'/'
);
const
char
*
slash
=
st
d
::
st
rchr
(
path
,
'/'
);
const
char
*
end
=
slash
==
nullptr
const
char
*
end
=
slash
==
nullptr
?
path
+
strlen
(
path
)
?
path
+
strlen
(
path
)
:
slash
;
:
slash
;
...
...
src/db/update/Archive.cxx
View file @
e4dad42c
...
@@ -55,7 +55,7 @@ void
...
@@ -55,7 +55,7 @@ void
UpdateWalk
::
UpdateArchiveTree
(
ArchiveFile
&
archive
,
Directory
&
directory
,
UpdateWalk
::
UpdateArchiveTree
(
ArchiveFile
&
archive
,
Directory
&
directory
,
const
char
*
name
)
noexcept
const
char
*
name
)
noexcept
{
{
const
char
*
tmp
=
strchr
(
name
,
'/'
);
const
char
*
tmp
=
st
d
::
st
rchr
(
name
,
'/'
);
if
(
tmp
)
{
if
(
tmp
)
{
const
std
::
string_view
child_name
(
name
,
tmp
-
name
);
const
std
::
string_view
child_name
(
name
,
tmp
-
name
);
//add dir is not there already
//add dir is not there already
...
...
src/db/update/InotifyUpdate.cxx
View file @
e4dad42c
...
@@ -148,7 +148,7 @@ WatchDirectory::GetUriFS() const noexcept
...
@@ -148,7 +148,7 @@ WatchDirectory::GetUriFS() const noexcept
static
bool
skip_path
(
const
char
*
path
)
static
bool
skip_path
(
const
char
*
path
)
{
{
return
PathTraitsFS
::
IsSpecialFilename
(
path
)
||
return
PathTraitsFS
::
IsSpecialFilename
(
path
)
||
strchr
(
path
,
'\n'
)
!=
nullptr
;
st
d
::
st
rchr
(
path
,
'\n'
)
!=
nullptr
;
}
}
static
void
static
void
...
...
src/db/update/Walk.cxx
View file @
e4dad42c
...
@@ -191,7 +191,7 @@ UpdateWalk::UpdateDirectoryChild(Directory &directory,
...
@@ -191,7 +191,7 @@ UpdateWalk::UpdateDirectoryChild(Directory &directory,
const
ExcludeList
&
exclude_list
,
const
ExcludeList
&
exclude_list
,
const
char
*
name
,
const
StorageFileInfo
&
info
)
noexcept
const
char
*
name
,
const
StorageFileInfo
&
info
)
noexcept
try
{
try
{
assert
(
strchr
(
name
,
'/'
)
==
nullptr
);
assert
(
st
d
::
st
rchr
(
name
,
'/'
)
==
nullptr
);
if
(
info
.
IsRegular
())
{
if
(
info
.
IsRegular
())
{
UpdateRegularFile
(
directory
,
name
,
info
);
UpdateRegularFile
(
directory
,
name
,
info
);
...
@@ -223,7 +223,7 @@ gcc_pure
...
@@ -223,7 +223,7 @@ gcc_pure
static
bool
static
bool
skip_path
(
const
char
*
name_utf8
)
noexcept
skip_path
(
const
char
*
name_utf8
)
noexcept
{
{
return
strchr
(
name_utf8
,
'\n'
)
!=
nullptr
;
return
st
d
::
st
rchr
(
name_utf8
,
'\n'
)
!=
nullptr
;
}
}
gcc_pure
gcc_pure
...
...
src/decoder/plugins/FaadDecoderPlugin.cxx
View file @
e4dad42c
...
@@ -29,11 +29,10 @@
...
@@ -29,11 +29,10 @@
#include "util/Math.hxx"
#include "util/Math.hxx"
#include "Log.hxx"
#include "Log.hxx"
#include <neaacdec.h>
#include <cassert>
#include <cassert>
#include <cstring>
#include <
string
.h>
#include <
neaacdec
.h>
static
const
unsigned
adts_sample_rates
[]
=
static
const
unsigned
adts_sample_rates
[]
=
{
96000
,
88200
,
64000
,
48000
,
44100
,
32000
,
24000
,
22050
,
{
96000
,
88200
,
64000
,
48000
,
44100
,
32000
,
24000
,
22050
,
...
@@ -72,8 +71,7 @@ adts_find_frame(DecoderBuffer &buffer)
...
@@ -72,8 +71,7 @@ adts_find_frame(DecoderBuffer &buffer)
return
0
;
return
0
;
/* find the 0xff marker */
/* find the 0xff marker */
const
auto
*
p
=
(
const
uint8_t
*
)
auto
p
=
(
const
uint8_t
*
)
std
::
memchr
(
data
.
data
,
0xff
,
data
.
size
);
memchr
(
data
.
data
,
0xff
,
data
.
size
);
if
(
p
==
nullptr
)
{
if
(
p
==
nullptr
)
{
/* no marker - discard the buffer */
/* no marker - discard the buffer */
buffer
.
Clear
();
buffer
.
Clear
();
...
...
src/fs/StandardDirectory.cxx
View file @
e4dad42c
...
@@ -164,7 +164,7 @@ ParseConfigLine(char *line, const char *dir_name, AllocatedPath &result_dir)
...
@@ -164,7 +164,7 @@ ParseConfigLine(char *line, const char *dir_name, AllocatedPath &result_dir)
char
*
line_end
;
char
*
line_end
;
// find end of the string
// find end of the string
if
(
quoted
)
{
if
(
quoted
)
{
line_end
=
strrchr
(
line
,
'"'
);
line_end
=
st
d
::
st
rrchr
(
line
,
'"'
);
if
(
line_end
==
nullptr
)
if
(
line_end
==
nullptr
)
return
true
;
return
true
;
}
else
{
}
else
{
...
...
src/fs/Traits.hxx
View file @
e4dad42c
...
@@ -196,7 +196,7 @@ struct PathTraitsUTF8 {
...
@@ -196,7 +196,7 @@ struct PathTraitsUTF8 {
assert
(
p
!=
nullptr
);
assert
(
p
!=
nullptr
);
#endif
#endif
return
strrchr
(
p
,
SEPARATOR
);
return
st
d
::
st
rrchr
(
p
,
SEPARATOR
);
}
}
#ifdef _WIN32
#ifdef _WIN32
...
...
src/input/plugins/CdioParanoiaInputPlugin.cxx
View file @
e4dad42c
...
@@ -133,7 +133,7 @@ parse_cdio_uri(const char *src)
...
@@ -133,7 +133,7 @@ parse_cdio_uri(const char *src)
return
dest
;
return
dest
;
}
}
const
char
*
slash
=
strrchr
(
src
,
'/'
);
const
char
*
slash
=
st
d
::
st
rrchr
(
src
,
'/'
);
if
(
slash
==
nullptr
)
{
if
(
slash
==
nullptr
)
{
/* play the whole CD in the specified drive */
/* play the whole CD in the specified drive */
CopyTruncateString
(
dest
.
device
,
src
,
sizeof
(
dest
.
device
));
CopyTruncateString
(
dest
.
device
,
src
,
sizeof
(
dest
.
device
));
...
...
src/lib/nfs/FileReader.cxx
View file @
e4dad42c
...
@@ -25,10 +25,10 @@
...
@@ -25,10 +25,10 @@
#include "util/ASCII.hxx"
#include "util/ASCII.hxx"
#include <cassert>
#include <cassert>
#include <cstring>
#include <stdexcept>
#include <stdexcept>
#include <utility>
#include <utility>
#include <string.h>
#include <fcntl.h>
#include <fcntl.h>
NfsFileReader
::
NfsFileReader
()
noexcept
NfsFileReader
::
NfsFileReader
()
noexcept
...
@@ -97,7 +97,7 @@ NfsFileReader::Open(const char *uri)
...
@@ -97,7 +97,7 @@ NfsFileReader::Open(const char *uri)
uri
+=
6
;
uri
+=
6
;
const
char
*
slash
=
strchr
(
uri
,
'/'
);
const
char
*
slash
=
st
d
::
st
rchr
(
uri
,
'/'
);
if
(
slash
==
nullptr
)
if
(
slash
==
nullptr
)
throw
std
::
runtime_error
(
"Malformed nfs:// URI"
);
throw
std
::
runtime_error
(
"Malformed nfs:// URI"
);
...
@@ -112,7 +112,7 @@ NfsFileReader::Open(const char *uri)
...
@@ -112,7 +112,7 @@ NfsFileReader::Open(const char *uri)
new_path
=
"/"
;
new_path
=
"/"
;
path
=
new_path
;
path
=
new_path
;
}
else
{
}
else
{
slash
=
strrchr
(
uri
+
1
,
'/'
);
slash
=
st
d
::
st
rrchr
(
uri
+
1
,
'/'
);
if
(
slash
==
nullptr
||
slash
[
1
]
==
0
)
if
(
slash
==
nullptr
||
slash
[
1
]
==
0
)
throw
std
::
runtime_error
(
"Malformed nfs:// URI"
);
throw
std
::
runtime_error
(
"Malformed nfs:// URI"
);
...
...
src/net/HostParser.cxx
View file @
e4dad42c
...
@@ -124,7 +124,7 @@ ExtractHost(const char *src) noexcept
...
@@ -124,7 +124,7 @@ ExtractHost(const char *src) noexcept
/* "[hostname]:port" (IPv6?) */
/* "[hostname]:port" (IPv6?) */
hostname
=
++
src
;
hostname
=
++
src
;
const
char
*
end
=
strchr
(
hostname
,
']'
);
const
char
*
end
=
st
d
::
st
rchr
(
hostname
,
']'
);
if
(
end
==
nullptr
||
end
==
hostname
)
if
(
end
==
nullptr
||
end
==
hostname
)
/* failed, return nullptr */
/* failed, return nullptr */
return
result
;
return
result
;
...
...
src/net/Resolver.cxx
View file @
e4dad42c
...
@@ -65,7 +65,7 @@ ai_is_passive(const struct addrinfo *ai)
...
@@ -65,7 +65,7 @@ ai_is_passive(const struct addrinfo *ai)
static
void
static
void
FindAndResolveInterfaceName
(
char
*
host
,
size_t
size
)
FindAndResolveInterfaceName
(
char
*
host
,
size_t
size
)
{
{
char
*
percent
=
strchr
(
host
,
'%'
);
char
*
percent
=
st
d
::
st
rchr
(
host
,
'%'
);
if
(
percent
==
nullptr
||
percent
+
64
>
host
+
size
)
if
(
percent
==
nullptr
||
percent
+
64
>
host
+
size
)
return
;
return
;
...
...
src/net/SocketAddress.cxx
View file @
e4dad42c
...
@@ -84,7 +84,7 @@ SocketAddress::GetLocalPath() const noexcept
...
@@ -84,7 +84,7 @@ SocketAddress::GetLocalPath() const noexcept
/* must be null-terminated */
/* must be null-terminated */
raw
.
back
()
==
0
&&
raw
.
back
()
==
0
&&
/* there must not be any other null byte */
/* there must not be any other null byte */
memchr
(
raw
.
data
,
0
,
raw
.
size
-
1
)
==
nullptr
std
::
memchr
(
raw
.
data
,
0
,
raw
.
size
-
1
)
==
nullptr
?
raw
.
data
?
raw
.
data
:
nullptr
;
:
nullptr
;
}
}
...
...
src/net/ToString.cxx
View file @
e4dad42c
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include <algorithm>
#include <algorithm>
#include <cassert>
#include <cassert>
#include <cstring>
#ifdef _WIN32
#ifdef _WIN32
#include <ws2tcpip.h>
#include <ws2tcpip.h>
...
@@ -49,8 +50,6 @@
...
@@ -49,8 +50,6 @@
#include <sys/un.h>
#include <sys/un.h>
#endif
#endif
#include <string.h>
#ifdef HAVE_UN
#ifdef HAVE_UN
static
std
::
string
static
std
::
string
...
@@ -104,7 +103,7 @@ ToString(SocketAddress address) noexcept
...
@@ -104,7 +103,7 @@ ToString(SocketAddress address) noexcept
return
"unknown"
;
return
"unknown"
;
#ifdef HAVE_IPV6
#ifdef HAVE_IPV6
if
(
strchr
(
host
,
':'
)
!=
nullptr
)
{
if
(
st
d
::
st
rchr
(
host
,
':'
)
!=
nullptr
)
{
std
::
string
result
(
"["
);
std
::
string
result
(
"["
);
result
.
append
(
host
);
result
.
append
(
host
);
result
.
append
(
"]:"
);
result
.
append
(
"]:"
);
...
...
src/output/plugins/httpd/HttpdClient.cxx
View file @
e4dad42c
...
@@ -28,8 +28,8 @@
...
@@ -28,8 +28,8 @@
#include "Log.hxx"
#include "Log.hxx"
#include <cassert>
#include <cassert>
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <stdio.h>
HttpdClient
::~
HttpdClient
()
noexcept
HttpdClient
::~
HttpdClient
()
noexcept
...
@@ -95,7 +95,7 @@ HttpdClient::HandleLine(const char *line) noexcept
...
@@ -95,7 +95,7 @@ HttpdClient::HandleLine(const char *line) noexcept
should_reject
=
true
;
should_reject
=
true
;
}
}
line
=
strchr
(
line
,
' '
);
line
=
st
d
::
st
rchr
(
line
,
' '
);
if
(
line
==
nullptr
||
strncmp
(
line
+
1
,
"HTTP/"
,
5
)
!=
0
)
{
if
(
line
==
nullptr
||
strncmp
(
line
+
1
,
"HTTP/"
,
5
)
!=
0
)
{
/* HTTP/0.9 without request headers */
/* HTTP/0.9 without request headers */
...
@@ -413,7 +413,7 @@ HttpdClient::OnSocketInput(void *data, size_t length) noexcept
...
@@ -413,7 +413,7 @@ HttpdClient::OnSocketInput(void *data, size_t length) noexcept
}
}
char
*
line
=
(
char
*
)
data
;
char
*
line
=
(
char
*
)
data
;
char
*
newline
=
(
char
*
)
memchr
(
line
,
'\n'
,
length
);
char
*
newline
=
(
char
*
)
std
::
memchr
(
line
,
'\n'
,
length
);
if
(
newline
==
nullptr
)
if
(
newline
==
nullptr
)
return
InputResult
::
MORE
;
return
InputResult
::
MORE
;
...
...
src/playlist/PlaylistSong.cxx
View file @
e4dad42c
...
@@ -78,7 +78,7 @@ playlist_check_translate_song(DetachedSong &song, std::string_view base_uri,
...
@@ -78,7 +78,7 @@ playlist_check_translate_song(DetachedSong &song, std::string_view base_uri,
const
char
*
uri
=
song
.
GetURI
();
const
char
*
uri
=
song
.
GetURI
();
#ifdef _WIN32
#ifdef _WIN32
if
(
!
PathTraitsUTF8
::
IsAbsolute
(
uri
)
&&
strchr
(
uri
,
'\\'
)
!=
nullptr
)
{
if
(
!
PathTraitsUTF8
::
IsAbsolute
(
uri
)
&&
st
d
::
st
rchr
(
uri
,
'\\'
)
!=
nullptr
)
{
/* Windows uses the backslash as path separator, but
/* Windows uses the backslash as path separator, but
the MPD protocol uses the (forward) slash by
the MPD protocol uses the (forward) slash by
definition; to allow backslashes in relative URIs
definition; to allow backslashes in relative URIs
...
...
src/playlist/cue/CueParser.cxx
View file @
e4dad42c
...
@@ -24,8 +24,8 @@
...
@@ -24,8 +24,8 @@
#include "util/CharUtil.hxx"
#include "util/CharUtil.hxx"
#include <cassert>
#include <cassert>
#include <cstring>
#include <string.h>
#include <stdlib.h>
#include <stdlib.h>
static
const
char
*
static
const
char
*
...
@@ -49,7 +49,7 @@ cue_next_quoted(char *p, char **pp)
...
@@ -49,7 +49,7 @@ cue_next_quoted(char *p, char **pp)
assert
(
p
>=
*
pp
);
assert
(
p
>=
*
pp
);
assert
(
p
[
-
1
]
==
'"'
);
assert
(
p
[
-
1
]
==
'"'
);
char
*
end
=
strchr
(
p
,
'"'
);
char
*
end
=
st
d
::
st
rchr
(
p
,
'"'
);
if
(
end
==
nullptr
)
{
if
(
end
==
nullptr
)
{
/* syntax error - ignore it silently */
/* syntax error - ignore it silently */
*
pp
=
p
+
strlen
(
p
);
*
pp
=
p
+
strlen
(
p
);
...
...
src/storage/plugins/CurlStorage.cxx
View file @
e4dad42c
...
@@ -175,7 +175,7 @@ static unsigned
...
@@ -175,7 +175,7 @@ static unsigned
ParseStatus
(
const
char
*
s
)
ParseStatus
(
const
char
*
s
)
{
{
/* skip the "HTTP/1.1" prefix */
/* skip the "HTTP/1.1" prefix */
const
char
*
space
=
strchr
(
s
,
' '
);
const
char
*
space
=
st
d
::
st
rchr
(
s
,
' '
);
if
(
space
==
nullptr
)
if
(
space
==
nullptr
)
return
0
;
return
0
;
...
...
src/storage/plugins/NfsStorage.cxx
View file @
e4dad42c
...
@@ -412,7 +412,7 @@ CreateNfsStorageURI(EventLoop &event_loop, const char *base)
...
@@ -412,7 +412,7 @@ CreateNfsStorageURI(EventLoop &event_loop, const char *base)
if
(
p
==
nullptr
)
if
(
p
==
nullptr
)
return
nullptr
;
return
nullptr
;
const
char
*
mount
=
strchr
(
p
,
'/'
);
const
char
*
mount
=
st
d
::
st
rchr
(
p
,
'/'
);
if
(
mount
==
nullptr
)
if
(
mount
==
nullptr
)
throw
std
::
runtime_error
(
"Malformed nfs:// URI"
);
throw
std
::
runtime_error
(
"Malformed nfs:// URI"
);
...
...
src/storage/plugins/UdisksStorage.cxx
View file @
e4dad42c
...
@@ -357,7 +357,7 @@ CreateUdisksStorageURI(EventLoop &event_loop, const char *base_uri)
...
@@ -357,7 +357,7 @@ CreateUdisksStorageURI(EventLoop &event_loop, const char *base_uri)
std
::
string
id
;
std
::
string
id
;
const
char
*
relative_path
=
strchr
(
id_begin
,
'/'
);
const
char
*
relative_path
=
st
d
::
st
rchr
(
id_begin
,
'/'
);
if
(
relative_path
==
nullptr
)
{
if
(
relative_path
==
nullptr
)
{
id
=
id_begin
;
id
=
id_begin
;
relative_path
=
""
;
relative_path
=
""
;
...
...
src/tag/ApeLoader.cxx
View file @
e4dad42c
...
@@ -24,10 +24,9 @@
...
@@ -24,10 +24,9 @@
#include <cassert>
#include <cassert>
#include <cstdint>
#include <cstdint>
#include <cstring>
#include <memory>
#include <memory>
#include <string.h>
struct
ApeFooter
{
struct
ApeFooter
{
unsigned
char
id
[
8
];
unsigned
char
id
[
8
];
uint32_t
version
;
uint32_t
version
;
...
@@ -83,7 +82,7 @@ try {
...
@@ -83,7 +82,7 @@ try {
/* get the key */
/* get the key */
const
char
*
key
=
p
;
const
char
*
key
=
p
;
const
char
*
key_end
=
(
const
char
*
)
memchr
(
p
,
'\0'
,
remaining
);
const
char
*
key_end
=
(
const
char
*
)
std
::
memchr
(
p
,
'\0'
,
remaining
);
if
(
key_end
==
nullptr
)
if
(
key_end
==
nullptr
)
break
;
break
;
...
...
src/util/DivideString.cxx
View file @
e4dad42c
...
@@ -20,12 +20,12 @@
...
@@ -20,12 +20,12 @@
#include "DivideString.hxx"
#include "DivideString.hxx"
#include "StringStrip.hxx"
#include "StringStrip.hxx"
#include <
string.h
>
#include <
cstring
>
DivideString
::
DivideString
(
const
char
*
s
,
char
separator
,
bool
strip
)
noexcept
DivideString
::
DivideString
(
const
char
*
s
,
char
separator
,
bool
strip
)
noexcept
:
first
(
nullptr
)
:
first
(
nullptr
)
{
{
const
char
*
x
=
strchr
(
s
,
separator
);
const
char
*
x
=
st
d
::
st
rchr
(
s
,
separator
);
if
(
x
==
nullptr
)
if
(
x
==
nullptr
)
return
;
return
;
...
...
src/util/MimeType.cxx
View file @
e4dad42c
...
@@ -20,12 +20,12 @@
...
@@ -20,12 +20,12 @@
#include "MimeType.hxx"
#include "MimeType.hxx"
#include "SplitString.hxx"
#include "SplitString.hxx"
#include <
string.h
>
#include <
cstring
>
std
::
string
std
::
string
GetMimeTypeBase
(
const
char
*
s
)
noexcept
GetMimeTypeBase
(
const
char
*
s
)
noexcept
{
{
const
char
*
semicolon
=
strchr
(
s
,
';'
);
const
char
*
semicolon
=
st
d
::
st
rchr
(
s
,
';'
);
return
semicolon
!=
nullptr
return
semicolon
!=
nullptr
?
std
::
string
(
s
,
semicolon
)
?
std
::
string
(
s
,
semicolon
)
:
std
::
string
(
s
);
:
std
::
string
(
s
);
...
...
src/util/StringAPI.hxx
View file @
e4dad42c
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#include "Compiler.h"
#include "Compiler.h"
#include <
string.h
>
#include <
cstring
>
#ifdef _UNICODE
#ifdef _UNICODE
#include "WStringAPI.hxx"
#include "WStringAPI.hxx"
...
@@ -56,42 +56,42 @@ gcc_pure gcc_nonnull_all
...
@@ -56,42 +56,42 @@ gcc_pure gcc_nonnull_all
static
inline
char
*
static
inline
char
*
StringFind
(
char
*
haystack
,
char
needle
,
size_t
size
)
noexcept
StringFind
(
char
*
haystack
,
char
needle
,
size_t
size
)
noexcept
{
{
return
(
char
*
)
memchr
(
haystack
,
needle
,
size
);
return
(
char
*
)
std
::
memchr
(
haystack
,
needle
,
size
);
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
inline
const
char
*
static
inline
const
char
*
StringFind
(
const
char
*
haystack
,
char
needle
,
size_t
size
)
noexcept
StringFind
(
const
char
*
haystack
,
char
needle
,
size_t
size
)
noexcept
{
{
return
(
const
char
*
)
memchr
(
haystack
,
needle
,
size
);
return
(
const
char
*
)
std
::
memchr
(
haystack
,
needle
,
size
);
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
inline
const
char
*
static
inline
const
char
*
StringFind
(
const
char
*
haystack
,
char
needle
)
noexcept
StringFind
(
const
char
*
haystack
,
char
needle
)
noexcept
{
{
return
strchr
(
haystack
,
needle
);
return
st
d
::
st
rchr
(
haystack
,
needle
);
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
inline
char
*
static
inline
char
*
StringFind
(
char
*
haystack
,
char
needle
)
noexcept
StringFind
(
char
*
haystack
,
char
needle
)
noexcept
{
{
return
strchr
(
haystack
,
needle
);
return
st
d
::
st
rchr
(
haystack
,
needle
);
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
inline
const
char
*
static
inline
const
char
*
StringFindLast
(
const
char
*
haystack
,
char
needle
)
noexcept
StringFindLast
(
const
char
*
haystack
,
char
needle
)
noexcept
{
{
return
strrchr
(
haystack
,
needle
);
return
st
d
::
st
rrchr
(
haystack
,
needle
);
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
inline
char
*
static
inline
char
*
StringFindLast
(
char
*
haystack
,
char
needle
)
noexcept
StringFindLast
(
char
*
haystack
,
char
needle
)
noexcept
{
{
return
strrchr
(
haystack
,
needle
);
return
st
d
::
st
rrchr
(
haystack
,
needle
);
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
...
...
src/util/TextFile.hxx
View file @
e4dad42c
...
@@ -30,14 +30,14 @@
...
@@ -30,14 +30,14 @@
#ifndef TEXT_FILE_HXX
#ifndef TEXT_FILE_HXX
#define TEXT_FILE_HXX
#define TEXT_FILE_HXX
#include <
string.h
>
#include <
cstring
>
template
<
typename
B
>
template
<
typename
B
>
char
*
char
*
ReadBufferedLine
(
B
&
buffer
)
ReadBufferedLine
(
B
&
buffer
)
{
{
auto
r
=
buffer
.
Read
();
auto
r
=
buffer
.
Read
();
char
*
newline
=
reinterpret_cast
<
char
*>
(
memchr
(
r
.
data
,
'\n'
,
r
.
size
));
char
*
newline
=
reinterpret_cast
<
char
*>
(
std
::
memchr
(
r
.
data
,
'\n'
,
r
.
size
));
if
(
newline
==
nullptr
)
if
(
newline
==
nullptr
)
return
nullptr
;
return
nullptr
;
...
...
src/util/UriExtract.cxx
View file @
e4dad42c
...
@@ -124,7 +124,7 @@ uri_get_path(std::string_view uri) noexcept
...
@@ -124,7 +124,7 @@ uri_get_path(std::string_view uri) noexcept
const
char
*
const
char
*
uri_get_suffix
(
const
char
*
uri
)
noexcept
uri_get_suffix
(
const
char
*
uri
)
noexcept
{
{
const
char
*
suffix
=
strrchr
(
uri
,
'.'
);
const
char
*
suffix
=
st
d
::
st
rrchr
(
uri
,
'.'
);
if
(
suffix
==
nullptr
||
suffix
==
uri
||
if
(
suffix
==
nullptr
||
suffix
==
uri
||
suffix
[
-
1
]
==
'/'
||
suffix
[
-
1
]
==
'\\'
)
suffix
[
-
1
]
==
'/'
||
suffix
[
-
1
]
==
'\\'
)
return
nullptr
;
return
nullptr
;
...
@@ -144,7 +144,7 @@ uri_get_suffix(const char *uri, UriSuffixBuffer &buffer) noexcept
...
@@ -144,7 +144,7 @@ uri_get_suffix(const char *uri, UriSuffixBuffer &buffer) noexcept
if
(
suffix
==
nullptr
)
if
(
suffix
==
nullptr
)
return
nullptr
;
return
nullptr
;
const
char
*
q
=
strchr
(
suffix
,
'?'
);
const
char
*
q
=
st
d
::
st
rchr
(
suffix
,
'?'
);
if
(
q
!=
nullptr
&&
size_t
(
q
-
suffix
)
<
sizeof
(
buffer
.
data
))
{
if
(
q
!=
nullptr
&&
size_t
(
q
-
suffix
)
<
sizeof
(
buffer
.
data
))
{
memcpy
(
buffer
.
data
,
suffix
,
q
-
suffix
);
memcpy
(
buffer
.
data
,
suffix
,
q
-
suffix
);
buffer
.
data
[
q
-
suffix
]
=
0
;
buffer
.
data
[
q
-
suffix
]
=
0
;
...
@@ -157,7 +157,7 @@ uri_get_suffix(const char *uri, UriSuffixBuffer &buffer) noexcept
...
@@ -157,7 +157,7 @@ uri_get_suffix(const char *uri, UriSuffixBuffer &buffer) noexcept
const
char
*
const
char
*
uri_get_fragment
(
const
char
*
uri
)
noexcept
uri_get_fragment
(
const
char
*
uri
)
noexcept
{
{
const
char
*
fragment
=
strchr
(
uri
,
'#'
);
const
char
*
fragment
=
st
d
::
st
rchr
(
uri
,
'#'
);
if
(
fragment
==
nullptr
)
if
(
fragment
==
nullptr
)
return
nullptr
;
return
nullptr
;
...
...
src/util/UriUtil.cxx
View file @
e4dad42c
...
@@ -31,8 +31,7 @@
...
@@ -31,8 +31,7 @@
#include "ASCII.hxx"
#include "ASCII.hxx"
#include <cassert>
#include <cassert>
#include <cstring>
#include <string.h>
static
const
char
*
static
const
char
*
verify_uri_segment
(
const
char
*
p
)
noexcept
verify_uri_segment
(
const
char
*
p
)
noexcept
...
@@ -46,7 +45,7 @@ verify_uri_segment(const char *p) noexcept
...
@@ -46,7 +45,7 @@ verify_uri_segment(const char *p) noexcept
if
(
dots
<=
2
&&
(
*
p
==
0
||
*
p
==
'/'
))
if
(
dots
<=
2
&&
(
*
p
==
0
||
*
p
==
'/'
))
return
nullptr
;
return
nullptr
;
const
char
*
q
=
strchr
(
p
+
1
,
'/'
);
const
char
*
q
=
st
d
::
st
rchr
(
p
+
1
,
'/'
);
return
q
!=
nullptr
?
q
:
""
;
return
q
!=
nullptr
?
q
:
""
;
}
}
...
@@ -89,11 +88,11 @@ uri_remove_auth(const char *uri) noexcept
...
@@ -89,11 +88,11 @@ uri_remove_auth(const char *uri) noexcept
/* unrecognized URI */
/* unrecognized URI */
return
std
::
string
();
return
std
::
string
();
const
char
*
slash
=
strchr
(
auth
,
'/'
);
const
char
*
slash
=
st
d
::
st
rchr
(
auth
,
'/'
);
if
(
slash
==
nullptr
)
if
(
slash
==
nullptr
)
slash
=
auth
+
strlen
(
auth
);
slash
=
auth
+
strlen
(
auth
);
const
char
*
at
=
(
const
char
*
)
memchr
(
auth
,
'@'
,
slash
-
auth
);
const
char
*
at
=
(
const
char
*
)
std
::
memchr
(
auth
,
'@'
,
slash
-
auth
);
if
(
at
==
nullptr
)
if
(
at
==
nullptr
)
/* no auth info present, do nothing */
/* no auth info present, do nothing */
return
std
::
string
();
return
std
::
string
();
...
...
src/util/WStringAPI.hxx
View file @
e4dad42c
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
#include "Compiler.h"
#include "Compiler.h"
#include <
wchar.h
>
#include <
cwchar
>
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
inline
size_t
static
inline
size_t
...
@@ -52,14 +52,14 @@ gcc_pure gcc_nonnull_all
...
@@ -52,14 +52,14 @@ gcc_pure gcc_nonnull_all
static
inline
const
wchar_t
*
static
inline
const
wchar_t
*
StringFind
(
const
wchar_t
*
haystack
,
wchar_t
needle
,
size_t
size
)
noexcept
StringFind
(
const
wchar_t
*
haystack
,
wchar_t
needle
,
size_t
size
)
noexcept
{
{
return
wmemchr
(
haystack
,
needle
,
size
);
return
std
::
wmemchr
(
haystack
,
needle
,
size
);
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
inline
wchar_t
*
static
inline
wchar_t
*
StringFind
(
wchar_t
*
haystack
,
wchar_t
needle
,
size_t
size
)
noexcept
StringFind
(
wchar_t
*
haystack
,
wchar_t
needle
,
size_t
size
)
noexcept
{
{
return
wmemchr
(
haystack
,
needle
,
size
);
return
std
::
wmemchr
(
haystack
,
needle
,
size
);
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
...
...
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