[MPlayer-dev-eng] [PATCH] MacOS X Application Bundle Support

Chris Roccati roccati at pobox.com
Sun Dec 19 13:37:40 CET 2004


On 19 Dec 2004, at 12:52, Reimar Döffinger wrote:

> Hi,
> does CFURLGetFileSystemRepresentation when it succeeds always 
> guarantee to return a
> null-terminated string (because e.g. snprintf (IMHO very stupidly) 
> doesn't)?
> If not you should make sure it the string always is null-terminated...

Yes. The documentation says:
"Boolean CFURLGetFileSystemRepresentation (
    CFURLRef url,
    Boolean resolveAgainstBase,
    UInt8 *buffer,
    CFIndex maxBufLen
);

No more than maxBufLen bytes are written to buffer. If url requires 
more than maxBufLen bytes to represent itself, including the 
terminating null byte, this function returns false. To avoid this 
possible failure, you should pass a buffer with size of at least the 
maximum path length for the file system in question."

So the loop will only exit when the full path (including the null byte) 
will fit.




More information about the MPlayer-dev-eng mailing list