Chipmunk compliling issues

Discuss any Chipmunk bugs here.

Chipmunk compliling issues

Postby marco.lizza » Wed May 27, 2015 4:17 am

Hello there.

I'm trying and compile Chipmunk 7 with MSVC but I found several issues.

The most annoying is that the source files are not C (pedantic ANSI/C89) compliant, in the sense that in the body of the functions the variable-declarations are intersped with code statements. In order to be compiled, a full revision of the code-base is needed.

Or you can switch to GCC, move to C99 (with MSVC2013)... or switch and compile as C++.

I think that ANSI/C89 should be supported and I will happily take a stab and change them by myself.

Moreover, I suspect I found another issue. In the "cpPolyline.cp" some post-allocation casts are missing (they are permitted by C, but not in C++) and the line buffers are wrongly allocated, for example
Code: Select all
cpPolylineSet *
cpPolylineSetInit(cpPolylineSet *set)
{
   set->count = 0;
   set->capacity = 8;
   set->lines = cpcalloc(set->capacity, sizeof(cpPolyline));
   
  return set;
}


should be

Code: Select all
cpPolylineSet *
cpPolylineSetInit(cpPolylineSet *set)
{
   set->count = 0;
   set->capacity = 8;
   set->lines = (cpPolyline **)cpcalloc(set->capacity, sizeof(cpPolyline *));
   
  return set;
}


and similiar problem is in the "cpPolylineSetPush()" function.

Should I make a pull request for these?

Thanks in advance.
marco.lizza
 
Posts: 1
Joined: Tue May 26, 2015 5:54 pm

Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest