On 2013/01/19 13:09, Denis Krjuchkov <de...@crazydev.net> wrote:
> I've played a bit with the code.
> 
> It seems convenient to change Path::ToUTF8() to return std::string.
> I'd like to not introduce something like PathUTF8 class and use
> standard types where applicable.

Agree.

> * We could predict max size for UTF-8 path name basing on
> MPD_PATH_MAX. I know there are lots of weird encodings out there,
> but likely the result string would not exceed MPD_PATH_MAX * 4. One
> character in UTF-8 occupies at most 4 bytes, so even extreme case
> this should be enough.
> Since the path is nul-terminated size could be even less:
> ((MPD_MAX_PATH - 1) * 4 + 1).

Yes, that seems reasonable for temporary allocations.  We should watch
out for pointers that are stored permanently, these should not have
permanent worst-case overhead.

------------------------------------------------------------------------------
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/learnmore_123012
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to