Bug 14 - incorrect modifications of const in FcConfigCompareValue
Summary: incorrect modifications of const in FcConfigCompareValue
Status: RESOLVED WORKSFORME
Alias: None
Product: fontconfig
Classification: Unclassified
Component: conf (show other bugs)
Version: unspecified
Hardware: All All
: highest enhancement
Assignee: Keith Packard
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-27 15:58 UTC by Tim Mooney
Modified: 2015-05-01 19:53 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
remove const from FcConfigCompareValue declaration (476 bytes, patch)
2003-01-27 15:59 UTC, Tim Mooney
Details | Splinter Review

Description Tim Mooney 2003-01-27 15:58:41 UTC
In fccfg.c, in the function FcConfigCompareValue, the following two calls are
made:

    m = FcConfigPromote (m, v);
    v = FcConfigPromote (v, m);

the problem is, `m' and `v' are passed into FcConfigCompareValue, and the
prototype for FcConfigCompareValue in `fcint.h' declares them both as const.
This means that the definition for your function (which doesn't have them as
const) conflicts with the declaration.

The Tru64 UNIX vendor C compiler caught this, and most other vendor compilers do
too -- apparently the compiler you've been using (gcc, I would guess) doesn't.

The easy fix I chose was to remove the `const' from the declaration in fcint.h.
Patch is attached.
Comment 1 Tim Mooney 2003-01-27 15:59:44 UTC
Created attachment 11 [details] [review]
remove const from FcConfigCompareValue declaration
Comment 2 Keith Packard 2003-01-28 07:48:47 UTC
The prototype is necessary for many C++ programs.  We can easily work around
this by creating local variables to hold the coerced values.
Comment 3 Keith Packard 2003-02-06 11:23:28 UTC
I added a couple of non-const locals to fix this.
Comment 4 Behdad Esfahbod 2015-05-01 19:53:05 UTC
Double-lucky bug number!  Lets close this after 12 years. :)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.