Export to GitHub

chipmunk-physics - issue #5

Patch to fix some strict warnings


Posted on Apr 24, 2009 by Helpful Monkey

This patch fixes some warnings if you have a lot of warnings turned on when developing on the iphone in objective-c.


Description of fixes:

Rename of local variable 'index' to 'idx' to prevent a warning about the variable masking one in global scope.

Change use of 'fabsf' to 'cpfabs' (presumably as intended), to fix warning about implicit conversion to 32-bit type from 64-bit type when cpFloat is double.

Change return value of segValueOnAxis from 'float' to 'cpFloat' (presumably as intended), to fix warning about implicit conversion to 32-bits.

Added prototypes for some internal/private functions to fix warnings about no prototype for these functions.

Made conversion from cpFloat to int for l, r, b, t in space hash functions explicit, to prevent warning about implicit conversion to 32-bit type.

Renamed local variable 'id' to 'hashid' in some hash functions, to prevent warning about the local variable masking objective-c's 'id' type.

Attachments

Comment #1

Posted on Apr 25, 2009 by Helpful Monkey

I updated this patch, see this new version attached which contains the same changes as the previous version, plus the following:


Added easy #if to change between cpFloat being double or single precision.

Cast some constants to cpFloat, to prevent implicit conversion warnings when cpFloat is set to single precision.

Attachments

Comment #2

Posted on Nov 25, 2009 by Happy Giraffe

I completely forgot about this patch. Holy crap. Merged the changes. Thank you and sorry.

Status: Fixed

Labels:
Type-Defect Priority-Medium