[cairo] "charset=" in trace file cause FcNameParse return NULL

Xi Yang hiyangxi at gmail.com
Fri Jul 11 18:02:26 PDT 2014


Hi Behdad,

On Sat, Jul 12, 2014 at 1:09 AM, Behdad Esfahbod <behdad at behdad.org> wrote:
> I just pushed a commit to master to remove charset before writing trace.  If
> you regenerate your traces you shouldn't have this problem anymore.  Sorry
> about the inconvenience.

Cools, thanks. I am using the trace from
http://cgit.freedesktop.org/cairo-traces.

>
> If that's too much trouble, I don't mind adding something like your patch, to
> remove charset when parsing.

No worry, my patch is just for showing the problem.

Regards.


>
> On 14-07-11 10:37 AM, Behdad Esfahbod wrote:
>> On 14-07-11 08:22 AM, Xi Yang wrote:
>>> Hi,
>>>
>>> cairo-perf-trace is not working on my machine (ubuntu 14.04, x86-64).
>>>
>>> It looks like the problem is that FcNameParse is not happy with long
>>> "charset= " substring. After cut it off, cairo-perf-trace works fine.
>>
>> Interesting.  I wasn't aware that cairo perf traces contain fontconfig pattern
>> names with charset in them.  Is this your own trace or from a cairo repository?
>>
>>> Does it mean that my fontconfig has problems? I attached the patch.
>>
>> I assume you are using fontconfig master?  I changed the charset format to
>> make it human-readable.  Maybe I should add support for the previous format
>> back, though I prefer not to do that since that format should have had gone
>> years ago.
>>
>> Can you just regenerate your traces or is that too much trouble?
>>
>> behdad
>>
>>
>>
>>>
>>>
>>> Regards.
>>>
>>>
>>> diff --git a/util/cairo-script/cairo-script-operators.c
>>> b/util/cairo-script/cairo-script-operators.c
>>> index d4af312..4bc23be 100644
>>> --- a/util/cairo-script/cairo-script-operators.c
>>> +++ b/util/cairo-script/cairo-script-operators.c
>>> @@ -1925,6 +1925,7 @@ _ft_create_for_pattern (csi_t *ctx,
>>>      csi_status_t status;
>>>      struct mmap_vec vec;
>>>      void *bytes;
>>> +    char *s;
>>>
>>>      _csi_blob_init (&tmpl, (uint8_t *) string->string, string->len);
>>>      _csi_blob_hash (&tmpl, (uint32_t *) string->string, string->len /
>>> sizeof (uint32_t));
>>> @@ -1944,7 +1945,9 @@ _ft_create_for_pattern (csi_t *ctx,
>>>      } else {
>>>      bytes = tmpl.bytes;
>>>      }
>>> -
>>> +    s = strstr((char *)bytes, ":charset");
>>> +    if (s != NULL)
>>> +    *s = '\0';
>>>      pattern = FcNameParse (bytes);
>>>      if (bytes != tmpl.bytes)
>>>      _csi_free (ctx, bytes);
>>>
>>
>
> --
> behdad
> http://behdad.org/


More information about the cairo mailing list