diff options
Diffstat (limited to 'src')
30 files changed, 232 insertions, 153 deletions
diff --git a/src/LocateUri.cxx b/src/LocateUri.cxx index 71c8d9093..b639fb655 100644 --- a/src/LocateUri.cxx +++ b/src/LocateUri.cxx @@ -23,7 +23,7 @@ #include "fs/AllocatedPath.hxx" #include "ls.hxx" #include "util/UriUtil.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx index 9d2b56eae..911a4fc17 100644 --- a/src/PlaylistFile.cxx +++ b/src/PlaylistFile.cxx @@ -41,7 +41,7 @@ #include "fs/FileInfo.hxx" #include "fs/DirectoryReader.hxx" #include "util/Macros.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/UriUtil.hxx" #include "util/Error.hxx" diff --git a/src/db/plugins/simple/DatabaseSave.cxx b/src/db/plugins/simple/DatabaseSave.cxx index d2953b048..3955cc037 100644 --- a/src/db/plugins/simple/DatabaseSave.cxx +++ b/src/db/plugins/simple/DatabaseSave.cxx @@ -28,7 +28,7 @@ #include "tag/Tag.hxx" #include "tag/Settings.hxx" #include "fs/Charset.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Error.hxx" #include "Log.hxx" diff --git a/src/db/plugins/simple/DirectorySave.cxx b/src/db/plugins/simple/DirectorySave.cxx index 5a7eb6da6..923ee2b82 100644 --- a/src/db/plugins/simple/DirectorySave.cxx +++ b/src/db/plugins/simple/DirectorySave.cxx @@ -26,7 +26,7 @@ #include "PlaylistDatabase.hxx" #include "fs/io/TextFile.hxx" #include "fs/io/BufferedOutputStream.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/NumberParser.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx index 9baa6fb9c..e24338355 100644 --- a/src/decoder/plugins/MadDecoderPlugin.cxx +++ b/src/decoder/plugins/MadDecoderPlugin.cxx @@ -28,7 +28,7 @@ #include "tag/ReplayGain.hxx" #include "tag/MixRamp.hxx" #include "CheckAudioFormat.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/ASCII.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" diff --git a/src/fs/StandardDirectory.cxx b/src/fs/StandardDirectory.cxx index 38ea804a0..009f02c37 100644 --- a/src/fs/StandardDirectory.cxx +++ b/src/fs/StandardDirectory.cxx @@ -42,6 +42,7 @@ #ifdef USE_XDG #include "util/Error.hxx" #include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "io/TextFile.hxx" #include <string.h> #include <utility> diff --git a/src/fs/Traits.cxx b/src/fs/Traits.cxx index 7eba0916a..6799dfd58 100644 --- a/src/fs/Traits.cxx +++ b/src/fs/Traits.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "Traits.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include <string.h> diff --git a/src/input/InputStream.cxx b/src/input/InputStream.cxx index bf6fd198e..bd593bc29 100644 --- a/src/input/InputStream.cxx +++ b/src/input/InputStream.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "InputStream.hxx" #include "thread/Cond.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include <assert.h> diff --git a/src/input/plugins/AlsaInputPlugin.cxx b/src/input/plugins/AlsaInputPlugin.cxx index d2be734b5..ea428c0ca 100644 --- a/src/input/plugins/AlsaInputPlugin.cxx +++ b/src/input/plugins/AlsaInputPlugin.cxx @@ -30,7 +30,7 @@ #include "../InputStream.hxx" #include "util/Domain.hxx" #include "util/Error.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/ReusableArray.hxx" #include "Log.hxx" diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx index dda5cb83f..c82fea246 100644 --- a/src/input/plugins/CdioParanoiaInputPlugin.cxx +++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx @@ -26,6 +26,7 @@ #include "../InputStream.hxx" #include "../InputPlugin.hxx" #include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" #include "system/ByteOrder.hxx" diff --git a/src/input/plugins/FfmpegInputPlugin.cxx b/src/input/plugins/FfmpegInputPlugin.cxx index 444273d90..1840e0c6d 100644 --- a/src/input/plugins/FfmpegInputPlugin.cxx +++ b/src/input/plugins/FfmpegInputPlugin.cxx @@ -27,7 +27,7 @@ #include "lib/ffmpeg/Error.hxx" #include "../InputStream.hxx" #include "../InputPlugin.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Error.hxx" extern "C" { diff --git a/src/input/plugins/MmsInputPlugin.cxx b/src/input/plugins/MmsInputPlugin.cxx index 244dfd945..a04f105aa 100644 --- a/src/input/plugins/MmsInputPlugin.cxx +++ b/src/input/plugins/MmsInputPlugin.cxx @@ -21,7 +21,7 @@ #include "MmsInputPlugin.hxx" #include "input/ThreadInputStream.hxx" #include "input/InputPlugin.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" diff --git a/src/input/plugins/NfsInputPlugin.cxx b/src/input/plugins/NfsInputPlugin.cxx index 077362c18..82a8d0e38 100644 --- a/src/input/plugins/NfsInputPlugin.cxx +++ b/src/input/plugins/NfsInputPlugin.cxx @@ -25,7 +25,7 @@ #include "lib/nfs/Glue.hxx" #include "lib/nfs/FileReader.hxx" #include "util/HugeAllocator.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Error.hxx" #include <string.h> diff --git a/src/input/plugins/SmbclientInputPlugin.cxx b/src/input/plugins/SmbclientInputPlugin.cxx index ec6857c19..ece13ca73 100644 --- a/src/input/plugins/SmbclientInputPlugin.cxx +++ b/src/input/plugins/SmbclientInputPlugin.cxx @@ -23,7 +23,7 @@ #include "lib/smbclient/Mutex.hxx" #include "../InputStream.hxx" #include "../InputPlugin.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Error.hxx" #include <libsmbclient.h> diff --git a/src/lib/nfs/FileReader.cxx b/src/lib/nfs/FileReader.cxx index 97522321b..33cf703fe 100644 --- a/src/lib/nfs/FileReader.cxx +++ b/src/lib/nfs/FileReader.cxx @@ -25,7 +25,7 @@ #include "Domain.hxx" #include "event/Call.hxx" #include "IOThread.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Error.hxx" #include <utility> diff --git a/src/ls.cxx b/src/ls.cxx index 41bd4ba97..0d6d506d2 100644 --- a/src/ls.cxx +++ b/src/ls.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "ls.hxx" #include "client/Response.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/UriUtil.hxx" #include <assert.h> diff --git a/src/mixer/Volume.cxx b/src/mixer/Volume.cxx index 8bc8d879d..8b4928953 100644 --- a/src/mixer/Volume.cxx +++ b/src/mixer/Volume.cxx @@ -21,7 +21,7 @@ #include "Volume.hxx" #include "output/MultipleOutputs.hxx" #include "Idle.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Domain.hxx" #include "system/PeriodClock.hxx" #include "fs/io/BufferedOutputStream.hxx" diff --git a/src/output/OutputState.cxx b/src/output/OutputState.cxx index a1ca11b49..e866eb507 100644 --- a/src/output/OutputState.cxx +++ b/src/output/OutputState.cxx @@ -29,7 +29,7 @@ #include "Domain.hxx" #include "Log.hxx" #include "fs/io/BufferedOutputStream.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include <assert.h> #include <stdlib.h> diff --git a/src/output/plugins/WinmmOutputPlugin.cxx b/src/output/plugins/WinmmOutputPlugin.cxx index 35efb0f93..f5c70ef98 100644 --- a/src/output/plugins/WinmmOutputPlugin.cxx +++ b/src/output/plugins/WinmmOutputPlugin.cxx @@ -26,7 +26,7 @@ #include "util/Error.hxx" #include "util/Domain.hxx" #include "util/Macros.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include <stdlib.h> #include <string.h> diff --git a/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx b/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx index e60ef4aa6..37f975dda 100644 --- a/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx +++ b/src/playlist/plugins/ExtM3uPlaylistPlugin.cxx @@ -25,6 +25,7 @@ #include "tag/Tag.hxx" #include "tag/TagBuilder.hxx" #include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "input/TextInputStream.hxx" #include <string.h> diff --git a/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx b/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx index d6f25f48c..1c6e58ac6 100644 --- a/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx +++ b/src/playlist/plugins/SoundCloudPlaylistPlugin.cxx @@ -24,7 +24,7 @@ #include "config/Block.hxx" #include "input/InputStream.hxx" #include "tag/TagBuilder.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Alloc.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" diff --git a/src/queue/PlaylistState.cxx b/src/queue/PlaylistState.cxx index fa51b1519..99d1b26cd 100644 --- a/src/queue/PlaylistState.cxx +++ b/src/queue/PlaylistState.cxx @@ -33,7 +33,7 @@ #include "config/ConfigGlobal.hxx" #include "config/ConfigOption.hxx" #include "util/CharUtil.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "Log.hxx" #include <string.h> diff --git a/src/queue/QueueSave.cxx b/src/queue/QueueSave.cxx index f5c49549e..cb8611cf8 100644 --- a/src/queue/QueueSave.cxx +++ b/src/queue/QueueSave.cxx @@ -27,7 +27,7 @@ #include "playlist/PlaylistSong.hxx" #include "fs/io/TextFile.hxx" #include "fs/io/BufferedOutputStream.hxx" -#include "util/StringUtil.hxx" +#include "util/StringCompare.hxx" #include "util/Error.hxx" #include "fs/Traits.hxx" #include "Log.hxx" diff --git a/src/util/StringCompare.cxx b/src/util/StringCompare.cxx new file mode 100644 index 000000000..a7e505d12 --- /dev/null +++ b/src/util/StringCompare.cxx @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2013-2015 Max Kellermann <max@duempel.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "StringCompare.hxx" +#include "StringAPI.hxx" + +#include <assert.h> +#include <string.h> + +bool +StringStartsWith(const char *haystack, const char *needle) +{ + const size_t length = strlen(needle); + return memcmp(haystack, needle, length) == 0; +} + +bool +StringEndsWith(const char *haystack, const char *needle) +{ + const size_t haystack_length = strlen(haystack); + const size_t needle_length = strlen(needle); + + return haystack_length >= needle_length && + memcmp(haystack + haystack_length - needle_length, + needle, needle_length) == 0; +} + +const char * +StringAfterPrefix(const char *string, const char *prefix) +{ +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ + assert(string != nullptr); + assert(prefix != nullptr); +#endif + + size_t prefix_length = strlen(prefix); + return StringIsEqual(string, prefix, prefix_length) + ? string + prefix_length + : nullptr; +} + +const char * +FindStringSuffix(const char *p, const char *suffix) +{ + const size_t p_length = strlen(p); + const size_t suffix_length = strlen(suffix); + + if (p_length < suffix_length) + return nullptr; + + const char *q = p + p_length - suffix_length; + return memcmp(q, suffix, suffix_length) == 0 + ? q + : nullptr; +} diff --git a/src/util/StringCompare.hxx b/src/util/StringCompare.hxx new file mode 100644 index 000000000..2c23b312f --- /dev/null +++ b/src/util/StringCompare.hxx @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2013-2015 Max Kellermann <max@duempel.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef STRING_COMPARE_HXX +#define STRING_COMPARE_HXX + +#include "Compiler.h" + +#ifdef _UNICODE +#include "WStringCompare.hxx" +#endif + +gcc_pure +bool +StringStartsWith(const char *haystack, const char *needle); + +gcc_pure +bool +StringEndsWith(const char *haystack, const char *needle); + +/** + * Returns the portion of the string after a prefix. If the string + * does not begin with the specified prefix, this function returns + * nullptr. + */ +gcc_pure gcc_nonnull_all +const char * +StringAfterPrefix(const char *string, const char *prefix); + +/** + * Check if the given string ends with the specified suffix. If yes, + * returns the position of the suffix, and nullptr otherwise. + */ +gcc_pure +const char * +FindStringSuffix(const char *p, const char *suffix); + +#endif diff --git a/src/util/StringUtil.cxx b/src/util/StringUtil.cxx index b9c99eb4a..337476f18 100644 --- a/src/util/StringUtil.cxx +++ b/src/util/StringUtil.cxx @@ -27,54 +27,6 @@ #include <assert.h> #include <string.h> -bool -StringStartsWith(const char *haystack, const char *needle) -{ - const size_t length = strlen(needle); - return memcmp(haystack, needle, length) == 0; -} - -bool -StringEndsWith(const char *haystack, const char *needle) -{ - const size_t haystack_length = strlen(haystack); - const size_t needle_length = strlen(needle); - - return haystack_length >= needle_length && - memcmp(haystack + haystack_length - needle_length, - needle, needle_length) == 0; -} - -const char * -StringAfterPrefix(const char *string, const char *prefix) -{ -#if !CLANG_CHECK_VERSION(3,6) - /* disabled on clang due to -Wtautological-pointer-compare */ - assert(string != nullptr); - assert(prefix != nullptr); -#endif - - size_t prefix_length = strlen(prefix); - return StringIsEqual(string, prefix, prefix_length) - ? string + prefix_length - : nullptr; -} - -const char * -FindStringSuffix(const char *p, const char *suffix) -{ - const size_t p_length = strlen(p); - const size_t suffix_length = strlen(suffix); - - if (p_length < suffix_length) - return nullptr; - - const char *q = p + p_length - suffix_length; - return memcmp(q, suffix, suffix_length) == 0 - ? q - : nullptr; -} - char * CopyString(char *gcc_restrict dest, const char *gcc_restrict src, size_t size) { diff --git a/src/util/StringUtil.hxx b/src/util/StringUtil.hxx index 7e6dc4d61..9f30d363d 100644 --- a/src/util/StringUtil.hxx +++ b/src/util/StringUtil.hxx @@ -24,35 +24,6 @@ #include <stddef.h> -#ifdef _UNICODE -#include "WStringUtil.hxx" -#endif - -gcc_pure -bool -StringStartsWith(const char *haystack, const char *needle); - -gcc_pure -bool -StringEndsWith(const char *haystack, const char *needle); - -/** - * Returns the portion of the string after a prefix. If the string - * does not begin with the specified prefix, this function returns - * nullptr. - */ -gcc_pure gcc_nonnull_all -const char * -StringAfterPrefix(const char *string, const char *prefix); - -/** - * Check if the given string ends with the specified suffix. If yes, - * returns the position of the suffix, and nullptr otherwise. - */ -gcc_pure -const char * -FindStringSuffix(const char *p, const char *suffix); - /** * Copy a string. If the buffer is too small, then the string is * truncated. This is a safer version of strncpy(). diff --git a/src/util/WStringUtil.cxx b/src/util/WStringCompare.cxx index 19e4fc68d..77c3a8629 100644 --- a/src/util/WStringUtil.cxx +++ b/src/util/WStringCompare.cxx @@ -17,11 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "WStringUtil.hxx" +#include "WStringCompare.hxx" #include "WStringAPI.hxx" -#include "ASCII.hxx" - -#include <algorithm> #include <assert.h> #include <string.h> diff --git a/src/util/WStringCompare.hxx b/src/util/WStringCompare.hxx new file mode 100644 index 000000000..3547076ca --- /dev/null +++ b/src/util/WStringCompare.hxx @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2013-2015 Max Kellermann <max@duempel.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WSTRING_COMPARE_HXX +#define WSTRING_COMPARE_HXX + +#include "Compiler.h" + +#include <wchar.h> + +gcc_pure +bool +StringStartsWith(const wchar_t *haystack, const wchar_t *needle); + +gcc_pure +bool +StringEndsWith(const wchar_t *haystack, const wchar_t *needle); + +/** + * Returns the portion of the string after a prefix. If the string + * does not begin with the specified prefix, this function returns + * nullptr. + */ +gcc_nonnull_all +const wchar_t * +StringAfterPrefix(const wchar_t *string, const wchar_t *prefix); + +/** + * Check if the given string ends with the specified suffix. If yes, + * returns the position of the suffix, and nullptr otherwise. + */ +gcc_pure +const wchar_t * +FindStringSuffix(const wchar_t *p, const wchar_t *suffix); + +#endif diff --git a/src/util/WStringUtil.hxx b/src/util/WStringUtil.hxx deleted file mode 100644 index 3dde0162e..000000000 --- a/src/util/WStringUtil.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2003-2015 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef WSTRING_UTIL_HXX -#define WSTRING_UTIL_HXX - -#include "Compiler.h" - -#include <wchar.h> - -gcc_pure -bool -StringStartsWith(const wchar_t *haystack, const wchar_t *needle); - -gcc_pure -bool -StringEndsWith(const wchar_t *haystack, const wchar_t *needle); - -/** - * Returns the portion of the string after a prefix. If the string - * does not begin with the specified prefix, this function returns - * nullptr. - */ -gcc_nonnull_all -const wchar_t * -StringAfterPrefix(const wchar_t *string, const wchar_t *prefix); - -/** - * Check if the given string ends with the specified suffix. If yes, - * returns the position of the suffix, and nullptr otherwise. - */ -gcc_pure -const wchar_t * -FindStringSuffix(const wchar_t *p, const wchar_t *suffix); - -#endif |