From 3bd35d188320f20a98a1004c001b132fc0975437 Mon Sep 17 00:00:00 2001 From: Denis Krjuchkov Date: Thu, 24 Jan 2013 00:56:46 +0600 Subject: [PATCH] Path: introduce MPD_PATH_MAX_UTF8 --- src/fs/Path.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/fs/Path.cxx b/src/fs/Path.cxx index 393cb3038..294f60781 100644 --- a/src/fs/Path.cxx +++ b/src/fs/Path.cxx @@ -36,6 +36,16 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "path" +/** + * Maximal number of bytes required to represent path name in UTF-8 + * (including nul-terminator). + * This value is a rought estimate of upper bound. + * It's based on path name limit in bytes (MPD_PATH_MAX) + * and assumption that some weird encoding could represent some UTF-8 4 byte + * sequences with single byte. + */ +#define MPD_PATH_MAX_UTF8 ((MPD_PATH_MAX - 1) * 4 + 1) + static char *fs_charset; std::string Path::ToUTF8() const