diff options
author | Max Kellermann <max@duempel.org> | 2014-03-01 09:19:32 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-03-01 18:48:20 +0100 |
commit | 1e06c66c776e2dca217059d7d94309b0c5431a3f (patch) | |
tree | 64b3bf4c5051fabf9dff5b9d0c3ed73b3d2bb45b /src/util/StringUtil.hxx | |
parent | c73771e3ce7a5866f5ddc70d1cc03acf6a104127 (diff) | |
download | mpd-1e06c66c776e2dca217059d7d94309b0c5431a3f.tar.gz mpd-1e06c66c776e2dca217059d7d94309b0c5431a3f.tar.xz mpd-1e06c66c776e2dca217059d7d94309b0c5431a3f.zip |
java: new helper library for the Android port
Diffstat (limited to 'src/util/StringUtil.hxx')
-rw-r--r-- | src/util/StringUtil.hxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util/StringUtil.hxx b/src/util/StringUtil.hxx index 779d5d776..e8e3b2b5d 100644 --- a/src/util/StringUtil.hxx +++ b/src/util/StringUtil.hxx @@ -22,6 +22,8 @@ #include "Compiler.h" +#include <stddef.h> + /** * Returns a pointer to the first non-whitespace character in the * string, or to the end of the string. @@ -56,6 +58,18 @@ bool StringEndsWith(const char *haystack, const char *needle); /** + * Copy a string. If the buffer is too small, then the string is + * truncated. This is a safer version of strncpy(). + * + * @param size the size of the destination buffer (including the null + * terminator) + * @return a pointer to the null terminator + */ +gcc_nonnull_all +char * +CopyString(char *dest, const char *src, size_t size); + +/** * Checks whether a string array contains the specified string. * * @param haystack a NULL terminated list of strings |