diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx index 38de6e125..e48d8f389 100644 --- a/src/input/plugins/CdioParanoiaInputPlugin.cxx +++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx @@ -143,7 +143,7 @@ parse_cdio_uri(struct cdio_uri *dest, const char *src) const char *slash = strrchr(src, '/'); if (slash == nullptr) { /* play the whole CD in the specified drive */ - CopyString(dest->device, src, sizeof(dest->device)); + CopyTruncateString(dest->device, src, sizeof(dest->device)); dest->track = -1; return true; } diff --git a/src/java/String.cxx b/src/java/String.cxx index aff63fcd3..ec6d7c95c 100644 --- a/src/java/String.cxx +++ b/src/java/String.cxx @@ -38,7 +38,7 @@ Java::String::CopyTo(JNIEnv *env, jstring value, if (p == nullptr) return nullptr; - char *result = CopyString(buffer, p, max_size); + char *result = CopyTruncateString(buffer, p, max_size); env->ReleaseStringUTFChars(value, p); return result; } diff --git a/src/output/plugins/httpd/IcyMetaDataServer.cxx b/src/output/plugins/httpd/IcyMetaDataServer.cxx index 2a21dcccd..209aa166e 100644 --- a/src/output/plugins/httpd/IcyMetaDataServer.cxx +++ b/src/output/plugins/httpd/IcyMetaDataServer.cxx @@ -101,10 +101,10 @@ icy_server_metadata_page(const Tag &tag, const TagType *types) stream_title[0] = '\0'; while (p < end && item <= last_item) { - p = CopyString(p, tag_items[item++], end - p); + p = CopyTruncateString(p, tag_items[item++], end - p); if (item <= last_item) - p = CopyString(p, " - ", end - p); + p = CopyTruncateString(p, " - ", end - p); } const auto icy_string = icy_server_metadata_string(stream_title, ""); diff --git a/src/tag/Format.cxx b/src/tag/Format.cxx index 7a076d50b..09b6065a4 100644 --- a/src/tag/Format.cxx +++ b/src/tag/Format.cxx @@ -73,7 +73,7 @@ SanitizeString(const char *s, char *buffer, size_t buffer_size) noexcept if (!HasUnsafeChar(s)) return s; - char *end = CopyString(buffer, s, buffer_size); + char *end = CopyTruncateString(buffer, s, buffer_size); std::replace_if(buffer, end, IsUnsafeChar, ' '); return buffer; } diff --git a/src/util/TruncateString.cxx b/src/util/TruncateString.cxx index 16f9cf9fe..af6f5becf 100644 --- a/src/util/TruncateString.cxx +++ b/src/util/TruncateString.cxx @@ -34,8 +34,8 @@ #include char * -CopyString(char *gcc_restrict dest, const char *gcc_restrict src, - size_t size) noexcept +CopyTruncateString(char *gcc_restrict dest, const char *gcc_restrict src, + size_t size) noexcept { size_t length = strlen(src); if (length >= size) diff --git a/src/util/TruncateString.hxx b/src/util/TruncateString.hxx index 293590f43..997e5cfe9 100644 --- a/src/util/TruncateString.hxx +++ b/src/util/TruncateString.hxx @@ -44,6 +44,6 @@ */ gcc_nonnull_all char * -CopyString(char *dest, const char *src, size_t size) noexcept; +CopyTruncateString(char *dest, const char *src, size_t size) noexcept; #endif