27.01.2013 22:47, Max Kellermann пишет:
> You have described that a character may be represented by 4 bytes, but
> that does not really answer my question.  That upper limit would apply
> if a string holding MPD_PATH_MAX 4-byte characters must be
> represented.

OK. Let me explain with more details.

MPD does not know actual encoding of the path names at build time.
This is a runtime option expressed in mpd.conf.

MPD needs to convert string between UTF-8 and real path name encoding.
OS imposes some limit on path names in bytes. This is expressed by 
MPD_PATH_MAX.

Suppose there is encoding "foo" and path names are encoded with it. 
Encoding "foo" uses 1-byte to represent some code points that occupy 4 
bytes in UTF-8.

>
> When will that happen?

Suppose there is a path name that has MPD_PATH_MAX - 1 code points.
Each code point in that path name is encoded in "foo" with 1 byte, but 
those code points occupy 4 bytes in UTF-8. This means it would occupy 
MPD_PATH_MAX - 1 bytes as path name (without nul-terminator). Also this 
means after converting to UTF-8 it would occupy (MPD_PATH_MAX - 1) * 4 
(without nul-terminator).

>
> What is the real meaning of this MPD_PATH_MAX_UTF8 value, in general?
> Is it an upper limit imposed by MPD?  By the operating system?  What
> will it be used for?

This is approximate (upper bound) limit of number of bytes that are 
required to represent path name in UTF-8 regardless of what file system 
encoding is configured at runtime plus one byte for nul-terminator.

-- 
Denis

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to