Details

[Home]

Issue of the Implementation # S0595

Brief

The FcStrCopyFilename function contradicts its documentation

Detailed Description

The description of the function FcStrCopyFilename states: "Just like FcStrCopy except that it converts any leading '~' characters in s to the value of the HOME environment variable". Meanwhile the description of the function FcStrCopy states: "Allocates memory, copies s and returns the resulting buffer". But, if the name of the input file is not a full path and its first character is not '~', the function FcStrCopyFilename adds the current directory to the returning value.

For example, if the current work directory of the program is '/home/ssdk/Testing/FcStringUtils/', the call of the function FcStrCopyFilename with the parameter '123' returns the string '/home/ssdk/Testing/FcStringUtils/123', what contradicts the documentation.

Problem location(s) in the standard

Fontconfig Developers Reference, Version 2.4.2

Example

    FcChar8         *res;
    
    
    res = FcStrCopyFilename ((FcChar8 *)"asd");
     
    printf ("FcStrCopyFilename(\"asd\") returns '%s'\n", res);
    /*
     * Documentation states:
     * Just like FcStrCopy except that it converts any leading '~' characters
     * in s to the value of the HOME environment variable
     * 
     * So FcStrCopyFilename("asd") should return "asd"
     */

Possible solutions

Make implementation consistent to the doctumentation or vice versa.

Component

fontconfig 2.4.1 or later

Accepted

freedesktop.org Bugzilla 12964

Status

Fixed in fontconfig 2.5.0

[Home]