util/TruncateString: rename CopyString() to CopyTruncateString()
This commit is contained in:
parent
4b94ae8040
commit
dad7d7e798
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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, "");
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -34,8 +34,8 @@
|
||||
#include <string.h>
|
||||
|
||||
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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user