Chipmunk2D icon indicating copy to clipboard operation
Chipmunk2D copied to clipboard

Fix cast between incompatible function type

Open aganm opened this issue 4 years ago • 0 comments

These 4 functions should return cpBool. (see commit)

Fixes these warnings:

[23/32] Building C object CMakeFiles/lib/Chipmunk2D/src/cpSweep1D.c.o                                          
../../lib/Chipmunk2D/src/cpSweep1D.c:251:2: warning: cast between incompatible function types from ‘int (*)(cpSweep1D *, void *, cpHashValue)’ {aka ‘int (*)(cpSweep1D *, void *, long unsigned int)’} to ‘cpBool (*)(cpSpatialIndex *, void *
, cpHashValue)’ {aka ‘unsigned char (*)(cpSpatialIndex *, void *, long unsigned int)’} [-Wcast-function-type]                                                                                                                                   251 |  (cpSpatialIndexContainsImpl)cpSweep1DContains,                                                                
      |  ^                                                                                                             
[26/32] Building C object CMakeFiles/lib/Chipmunk2D/src/cpBBTree.c.o                                           
../../lib/Chipmunk2D/src/cpBBTree.c: In function ‘cpBBTreeInit’:                                                                                                                                                                              
../../lib/Chipmunk2D/src/cpBBTree.c:573:33: warning: cast between incompatible function types from ‘int (*)(void *, Node *)’ to ‘cpBool (*)(const void *, const void *)’ {aka ‘unsigned char (*)(const void *, const void *)’} [-Wcast-functio
n-type]                                                                                                                
  573 |  tree->leaves = cpHashSetNew(0, (cpHashSetEqlFunc)leafSetEql);                                                 
      |                                 ^                                                                                                                                                                                                     
[29/32] Building C object CMakeFiles/lib/Chipmunk2D/src/cpSpaceHash.c.o                                        
../../lib/Chipmunk2D/src/cpSpaceHash.c: In function ‘cpSpaceHashInit’:                                                 
../../lib/Chipmunk2D/src/cpSpaceHash.c:181:36: warning: cast between incompatible function types from ‘int (*)(void *, cpHandle *)’ to ‘cpBool (*)(const void *, const void *)’ {aka ‘unsigned char (*)(const void *, const void *)’} [-Wcast-
function-type]                                                                                                                                                                                                                                
  181 |  hash->handleSet = cpHashSetNew(0, (cpHashSetEqlFunc)handleSetEql);                                                                                                                                                                   
      |                                    ^                                                                           
../../lib/Chipmunk2D/src/cpSpaceHash.c: At top level:                                                                  
../../lib/Chipmunk2D/src/cpSpaceHash.c:578:2: warning: cast between incompatible function types from ‘int (*)(cpSpaceHash *, void *, cpHashValue)’ {aka ‘int (*)(cpSpaceHash *, void *, long unsigned int)’} to ‘cpBool (*)(cpSpatialIndex *, 
void *, cpHashValue)’ {aka ‘unsigned char (*)(cpSpatialIndex *, void *, long unsigned int)’} [-Wcast-function-type]                                                                                                                           
  578 |  (cpSpatialIndexContainsImpl)cpSpaceHashContains,                                                              
      |  

aganm avatar Dec 16 '21 02:12 aganm