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
c880099d
Commit
c880099d
authored
9 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringCompare: add StringIsEmpty()
parent
42f5ecd4
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
37 additions
and
16 deletions
+37
-16
Mapper.cxx
src/Mapper.cxx
+2
-1
PlaylistFile.cxx
src/PlaylistFile.cxx
+1
-1
Archive.cxx
src/db/update/Archive.cxx
+2
-1
InotifyQueue.cxx
src/db/update/InotifyQueue.cxx
+2
-1
Walk.cxx
src/db/update/Walk.cxx
+2
-1
AlsaInputPlugin.cxx
src/input/plugins/AlsaInputPlugin.cxx
+1
-1
StickerDatabase.cxx
src/sticker/StickerDatabase.cxx
+3
-2
CompositeStorage.cxx
src/storage/CompositeStorage.cxx
+2
-1
LocalStorage.cxx
src/storage/plugins/LocalStorage.cxx
+4
-3
NfsStorage.cxx
src/storage/plugins/NfsStorage.cxx
+3
-2
SmbclientStorage.cxx
src/storage/plugins/SmbclientStorage.cxx
+3
-2
StringCompare.hxx
src/util/StringCompare.hxx
+6
-0
WStringCompare.hxx
src/util/WStringCompare.hxx
+6
-0
No files found.
src/Mapper.cxx
View file @
c880099d
...
...
@@ -27,6 +27,7 @@
#include "fs/Traits.hxx"
#include "fs/Charset.hxx"
#include "fs/CheckFile.hxx"
#include "util/StringCompare.hxx"
#ifdef ENABLE_DATABASE
#include "storage/StorageInterface.hxx"
...
...
@@ -98,7 +99,7 @@ map_fs_to_utf8(Path path_fs)
return
std
::
string
();
auto
relative
=
music_dir_fs
.
Relative
(
path_fs
);
if
(
relative
==
nullptr
||
*
relative
==
0
)
if
(
relative
==
nullptr
||
StringIsEmpty
(
relative
)
)
return
std
::
string
();
path_fs
=
Path
::
FromFS
(
relative
);
...
...
This diff is collapsed.
Click to expand it.
src/PlaylistFile.cxx
View file @
c880099d
...
...
@@ -70,7 +70,7 @@ spl_global_init(void)
bool
spl_valid_name
(
const
char
*
name_utf8
)
{
if
(
*
name_utf8
==
0
)
if
(
StringIsEmpty
(
name_utf8
)
)
/* empty name not allowed */
return
false
;
...
...
This diff is collapsed.
Click to expand it.
src/db/update/Archive.cxx
View file @
c880099d
...
...
@@ -31,6 +31,7 @@
#include "archive/ArchiveFile.hxx"
#include "archive/ArchiveVisitor.hxx"
#include "util/Error.hxx"
#include "util/StringCompare.hxx"
#include "Log.hxx"
#include <string>
...
...
@@ -54,7 +55,7 @@ UpdateWalk::UpdateArchiveTree(Directory &directory, const char *name)
//create directories first
UpdateArchiveTree
(
*
subdir
,
tmp
+
1
);
}
else
{
if
(
strlen
(
name
)
==
0
)
{
if
(
StringIsEmpty
(
name
)
)
{
LogWarning
(
update_domain
,
"archive returned directory only"
);
return
;
...
...
This diff is collapsed.
Click to expand it.
src/db/update/InotifyQueue.cxx
View file @
c880099d
...
...
@@ -22,6 +22,7 @@
#include "InotifyDomain.hxx"
#include "Service.hxx"
#include "Log.hxx"
#include "util/StringCompare.hxx"
#include <string.h>
...
...
@@ -59,7 +60,7 @@ path_in(const char *path, const char *possible_parent)
{
size_t
length
=
strlen
(
possible_parent
);
return
path
[
0
]
==
0
||
return
StringIsEmpty
(
path
)
||
(
memcmp
(
possible_parent
,
path
,
length
)
==
0
&&
(
path
[
length
]
==
0
||
path
[
length
]
==
'/'
));
}
...
...
This diff is collapsed.
Click to expand it.
src/db/update/Walk.cxx
View file @
c880099d
...
...
@@ -38,6 +38,7 @@
#include "fs/Charset.hxx"
#include "storage/FileInfo.hxx"
#include "util/Alloc.hxx"
#include "util/StringCompare.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "Log.hxx"
...
...
@@ -435,7 +436,7 @@ UpdateWalk::DirectoryMakeUriParentChecked(Directory &root, const char *uri)
while
((
slash
=
strchr
(
name_utf8
,
'/'
))
!=
nullptr
)
{
*
slash
=
0
;
if
(
*
name_utf8
==
0
)
if
(
StringIsEmpty
(
name_utf8
)
)
continue
;
directory
=
DirectoryMakeChildChecked
(
*
directory
,
...
...
This diff is collapsed.
Click to expand it.
src/input/plugins/AlsaInputPlugin.cxx
View file @
c880099d
...
...
@@ -164,7 +164,7 @@ AlsaInputStream::Create(const char *uri, Mutex &mutex, Cond &cond,
return
nullptr
;
const
char
*
device
=
uri
+
strlen
(
scheme
);
if
(
strlen
(
device
)
==
0
)
if
(
*
device
==
0
)
device
=
default_device
;
/* placeholders - eventually user-requested audio format will
...
...
This diff is collapsed.
Click to expand it.
src/sticker/StickerDatabase.cxx
View file @
c880099d
...
...
@@ -25,6 +25,7 @@
#include "Idle.hxx"
#include "util/Error.hxx"
#include "util/Macros.hxx"
#include "util/StringCompare.hxx"
#include <string>
#include <map>
...
...
@@ -178,7 +179,7 @@ sticker_load_value(const char *type, const char *uri, const char *name,
assert
(
uri
!=
nullptr
);
assert
(
name
!=
nullptr
);
if
(
*
name
==
0
)
if
(
StringIsEmpty
(
name
)
)
return
std
::
string
();
if
(
!
BindAll
(
error
,
stmt
,
type
,
uri
,
name
))
...
...
@@ -287,7 +288,7 @@ sticker_store_value(const char *type, const char *uri,
assert
(
name
!=
nullptr
);
assert
(
value
!=
nullptr
);
if
(
*
name
==
0
)
if
(
StringIsEmpty
(
name
)
)
return
false
;
return
sticker_update_value
(
type
,
uri
,
name
,
value
,
error
)
||
...
...
This diff is collapsed.
Click to expand it.
src/storage/CompositeStorage.cxx
View file @
c880099d
...
...
@@ -23,6 +23,7 @@
#include "fs/AllocatedPath.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "util/StringCompare.hxx"
#include <set>
...
...
@@ -164,7 +165,7 @@ CompositeStorage::Directory::Unmount()
bool
CompositeStorage
::
Directory
::
Unmount
(
const
char
*
uri
)
{
if
(
*
uri
==
0
)
if
(
StringIsEmpty
(
uri
)
)
return
Unmount
();
const
std
::
string
name
=
NextSegment
(
uri
);
...
...
This diff is collapsed.
Click to expand it.
src/storage/plugins/LocalStorage.cxx
View file @
c880099d
...
...
@@ -22,10 +22,11 @@
#include "storage/StoragePlugin.hxx"
#include "storage/StorageInterface.hxx"
#include "storage/FileInfo.hxx"
#include "util/Error.hxx"
#include "fs/FileInfo.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/DirectoryReader.hxx"
#include "util/Error.hxx"
#include "util/StringCompare.hxx"
#include <string>
...
...
@@ -108,7 +109,7 @@ LocalStorage::MapUTF8(const char *uri_utf8) const
{
assert
(
uri_utf8
!=
nullptr
);
if
(
*
uri_utf8
==
0
)
if
(
StringIsEmpty
(
uri_utf8
)
)
return
base_utf8
;
return
PathTraitsUTF8
::
Build
(
base_utf8
.
c_str
(),
uri_utf8
);
...
...
@@ -119,7 +120,7 @@ LocalStorage::MapFS(const char *uri_utf8, Error &error) const
{
assert
(
uri_utf8
!=
nullptr
);
if
(
*
uri_utf8
==
0
)
if
(
StringIsEmpty
(
uri_utf8
)
)
return
base_fs
;
AllocatedPath
path_fs
=
AllocatedPath
::
FromUTF8
(
uri_utf8
,
error
);
...
...
This diff is collapsed.
Click to expand it.
src/storage/plugins/NfsStorage.cxx
View file @
c880099d
...
...
@@ -30,13 +30,14 @@
#include "lib/nfs/Connection.hxx"
#include "lib/nfs/Glue.hxx"
#include "fs/AllocatedPath.hxx"
#include "util/Error.hxx"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "event/Loop.hxx"
#include "event/Call.hxx"
#include "event/DeferredMonitor.hxx"
#include "event/TimeoutMonitor.hxx"
#include "util/Error.hxx"
#include "util/StringCompare.hxx"
extern
"C"
{
#include <nfsc/libnfs.h>
...
...
@@ -232,7 +233,7 @@ NfsStorage::MapUTF8(const char *uri_utf8) const
{
assert
(
uri_utf8
!=
nullptr
);
if
(
*
uri_utf8
==
0
)
if
(
StringIsEmpty
(
uri_utf8
)
)
return
base
;
return
PathTraitsUTF8
::
Build
(
base
.
c_str
(),
uri_utf8
);
...
...
This diff is collapsed.
Click to expand it.
src/storage/plugins/SmbclientStorage.cxx
View file @
c880099d
...
...
@@ -25,8 +25,9 @@
#include "lib/smbclient/Init.hxx"
#include "lib/smbclient/Mutex.hxx"
#include "fs/Traits.hxx"
#include "util/Error.hxx"
#include "thread/Mutex.hxx"
#include "util/Error.hxx"
#include "util/StringCompare.hxx"
#include <libsmbclient.h>
...
...
@@ -80,7 +81,7 @@ SmbclientStorage::MapUTF8(const char *uri_utf8) const
{
assert
(
uri_utf8
!=
nullptr
);
if
(
*
uri_utf8
==
0
)
if
(
StringIsEmpty
(
uri_utf8
)
)
return
base
;
return
PathTraitsUTF8
::
Build
(
base
.
c_str
(),
uri_utf8
);
...
...
This diff is collapsed.
Click to expand it.
src/util/StringCompare.hxx
View file @
c880099d
...
...
@@ -36,6 +36,12 @@
#include "WStringCompare.hxx"
#endif
static
inline
bool
StringIsEmpty
(
const
char
*
string
)
{
return
*
string
==
0
;
}
gcc_pure
bool
StringStartsWith
(
const
char
*
haystack
,
const
char
*
needle
);
...
...
This diff is collapsed.
Click to expand it.
src/util/WStringCompare.hxx
View file @
c880099d
...
...
@@ -34,6 +34,12 @@
#include <wchar.h>
static
inline
bool
StringIsEmpty
(
const
wchar_t
*
string
)
{
return
*
string
==
0
;
}
gcc_pure
bool
StringStartsWith
(
const
wchar_t
*
haystack
,
const
wchar_t
*
needle
);
...
...
This diff is collapsed.
Click to expand it.
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