Closed Bug 413981 Opened 17 years ago Closed 13 years ago

Fix remaining compile warnings in gfx/cairo/

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: MatsPalmgren_bugz, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [build_warning])

Attachments

(1 file)

Attached patch Patch rev. 1Splinter Review
The GCC flag -std=c99 is to avoid:
warning: string length ‘764’ is greater than the length ‘509’ ISO C89 compilers are required to support

The CAIRO_PTR_CAST() macro casts to (void*) before casting to the
desired pointer type, this is to avoid (GCC):
warning: dereferencing type-punned pointer will break strict-aliasing rules
Alternatively, we could add -fno-strict-aliasing but I think it's better
to have to cast away the warning explicitly in each instance.

The various int casts is to avoid (VC8):
pixman-compose.c(2086) : warning C4244: 'function' : conversion from 'uint16_t' to 'uint8_t', possible loss of data
pixman-compose.c(3102) : warning C4244: '+=' : conversion from 'pixman_fixed_32_32_t' to 'int32_t', possible loss of data
pixman-compose.c(3848) : warning C4244: '=' : conversion from 'pixman_fixed_48_16_t' to 'int', possible loss of data
cairo-scaled-font.c(1473) : warning C4244: 'function' : conversion from 'double' to 'int', possible loss of data
etc
Attachment #299193 - Flags: superreview?(vladimir)
Attachment #299193 - Flags: review?(vladimir)
Blocks: 413984
Mats, I'm probably not going to get a chance to review this until early next week -- but I would suggest sending these patches directly to the cairo list (cairo@cairographics.org), as I think they would be welcomed there and might make it easier for me to upstream them... even though they're just warning fixes, they touch areas that that I normally don't in the code :)
I mailed cairo@cairographics.org but didn't get any replies, maybe the
list isn't accepting posts from non-subscribers?
I didn't see your post on the list. If you don't want to subscribe, you could use the GMANE interface to access (nntp://news.gmane.org/gmane.comp.lib.cairo or http://news.gmane.org/gmane.comp.lib.cairo).
Comment on attachment 299193 [details] [diff] [review]
Patch rev. 1

If this is still relevant, it should just be fixed in upstream cairo, not in our local repo.
Attachment #299193 - Flags: superreview?(vladimir)
Attachment #299193 - Flags: review?(vladimir)
Attachment #299193 - Flags: review?(jmuizelaar)
Comment on attachment 299193 [details] [diff] [review]
Patch rev. 1

Yes, please submit directly to upstream. Also, it looks like a lot of warnings were fixed by casting. Casting should be more of a last resort to solving the warnings, it's usually better to have an explicit conversion function that accepts the input type and produces the output type. For example, the cases where you do (int)floor(a) would be better of with a helper something like floor_to_int(a) that returns an int. That way the intentions are clearer for the reader and the types continue to be checked by the compiler.
Attachment #299193 - Flags: review?(jmuizelaar) → review-
Whiteboard: [build_warning]
Blocks: buildwarning
Parts of this are obsolete, parts are fixed upstream already.  Given that this should go upstream anyhow, closing.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: