[aquaria] [PATCH] Variable type changes and extra include file for compiling in Linux (and probably Mac)

Jordi Gutiérrez Hermoso jordigh at gmail.com
Sat Jun 5 02:44:36 EDT 2010


Hello. I attach a patch to fix a few issues.

Pontos <daemonpontos at gmail.com> wrote:
> All of them except for one were the incorrect use of the variable type
> "int" in a few lines, generating errors in this style:

> /home/user/aquaria/Aquaria/Path.cpp: In member function ‘void
> Path::song(SongType)’:
> /home/user/aquaria/Aquaria/Path.cpp:246: error: cast from ‘Path*’ to
> ‘int’ loses precision

> In total, six files had that kind of problem, and for all of them the
> solution was simply changing "int" for "long".

I'm not sure this is the right fix. In some platforms, int is the
right choice, and it's not necessarily the best idea to always use
long or int. Thankfully, C provides the uintptr_t typedef for just
this purpose which I used in my patch.

> The other error i found was the lack of inclusion of the header limits.h
> in the file "BBGE/Core.cpp", which generated an error when compiling
> saying that PATH_MAX not being defined.

PATH_MAX is a system-dependent variable, while <limits.h> is a standard C
header. I think the right one to include in linux is <linux/limits.h>.
I added a macro in the CMake files to check for Linux and used that
macro to conditionally #include limits.h instead.

There's also a warning that actually should be fixed, because it could
produce nonsense (an int should have been a size_t).

HTH,
- Jordi G. H.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 64bitLinux.patch
Type: text/x-patch
Size: 23527 bytes
Desc: not available
URL: <http://icculus.org/pipermail/aquaria/attachments/20100605/58d955ea/attachment-0001.bin>


More information about the aquaria mailing list