Page 1 of 1

Chipmunk compliling issues

Posted: Wed May 27, 2015 4:17 am
by marco.lizza
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.