Fix all remaining warnings in gp2x build. The compiler is a bit more picky about the includes and feature macros.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1352 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2010-02-16 13:31:29 +00:00
parent 13865a0ade
commit 7fe8d44805
14 changed files with 39 additions and 7 deletions

View File

@ -25,6 +25,7 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#include <math.h> #include <math.h>
#include <stdlib.h>
#include "brush.h" #include "brush.h"
#include "buttons.h" #include "buttons.h"

View File

@ -19,9 +19,12 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Grafx2; if not, see <http://www.gnu.org/licenses/> along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/ */
#define _XOPEN_SOURCE 500
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>

View File

@ -26,6 +26,8 @@
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
#include <SDL.h> #include <SDL.h>
#include <stdlib.h>
#include <string.h>
#include "buttons.h" #include "buttons.h"
#include "engine.h" #include "engine.h"

View File

@ -29,6 +29,8 @@
#include <png.h> #include <png.h>
#endif #endif
#include <stdlib.h>
#include "errors.h" #include "errors.h"
#include "global.h" #include "global.h"
#include "loadsave.h" #include "loadsave.h"

View File

@ -24,6 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <ctype.h> #include <ctype.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>

2
init.c
View File

@ -22,6 +22,8 @@
along with Grafx2; if not, see <http://www.gnu.org/licenses/> along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/ */
#define _XOPEN_SOURCE 500
// Signal handler: I activate it for the two platforms who certainly // Signal handler: I activate it for the two platforms who certainly
// support them. Feel free to check with others. // support them. Feel free to check with others.
#if defined(__WIN32__) || defined(__linux__) #if defined(__WIN32__) || defined(__linux__)

4
io.c
View File

@ -23,6 +23,8 @@
// Fonctions de lecture/ecriture file, gèrent les systèmes big-endian et // Fonctions de lecture/ecriture file, gèrent les systèmes big-endian et
// little-endian. // little-endian.
#define _XOPEN_SOURCE 500
#include <SDL_endian.h> #include <SDL_endian.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -316,7 +318,7 @@ byte Create_lock_file(const char *file_directory)
{ {
return -1; return -1;
} }
#elseif !defined(__GP2X__) // gp2x does not defines F_TLOCK and is not really multitasking anyway #else
// Unixy method for lock file // Unixy method for lock file
Lock_file_handle = open(lock_filename,O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR); Lock_file_handle = open(lock_filename,O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR);
if (Lock_file_handle == -1) if (Lock_file_handle == -1)

View File

@ -21,7 +21,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Grafx2; if not, see <http://www.gnu.org/licenses/> along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/ */
#define _XOPEN_SOURCE #define _XOPEN_SOURCE 500
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>

View File

@ -25,6 +25,9 @@
///@file miscfileformats.c ///@file miscfileformats.c
/// Formats that aren't fully saving, either because of palette restrictions or other things /// Formats that aren't fully saving, either because of palette restrictions or other things
#include <stdlib.h>
#include <string.h>
#include "engine.h" #include "engine.h"
#include "errors.h" #include "errors.h"
#include "global.h" #include "global.h"

View File

@ -36,6 +36,8 @@
#else #else
#define MOUNTED_GETMNTENT1 #define MOUNTED_GETMNTENT1
#endif #endif
#define _XOPEN_SOURCE 500
// --- END GRAFX2 CUSTOM CONFIG --- // --- END GRAFX2 CUSTOM CONFIG ---
#include "mountlist.h" #include "mountlist.h"
@ -332,8 +334,14 @@ fstype_to_string (int t)
/* Return the device number from MOUNT_OPTIONS, if possible. /* Return the device number from MOUNT_OPTIONS, if possible.
Otherwise return (dev_t) -1. */ Otherwise return (dev_t) -1. */
#ifdef __linux__
#define BROKEN __attribute__((unused))
#else
#define BROKEN
#endif
static dev_t static dev_t
dev_from_mount_options (char const *mount_options) dev_from_mount_options (BROKEN char const *mount_options)
{ {
/* GNU/Linux allows file system implementations to define their own /* GNU/Linux allows file system implementations to define their own
meaning for "dev=" mount options, so don't trust the meaning meaning for "dev=" mount options, so don't trust the meaning
@ -370,7 +378,7 @@ dev_from_mount_options (char const *mount_options)
the returned list are valid. Otherwise, they might not be. */ the returned list are valid. Otherwise, they might not be. */
struct mount_entry * struct mount_entry *
read_file_system_list (bool need_fs_type) read_file_system_list (BROKEN bool need_fs_type)
{ {
struct mount_entry *mount_list; struct mount_entry *mount_list;
struct mount_entry *me; struct mount_entry *me;

View File

@ -20,6 +20,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Grafx2; if not, see <http://www.gnu.org/licenses/> along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/ */
#define _XOPEN_SOURCE 500
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,6 +1,6 @@
/* vim:expandtab:ts=2 sw=2: /* vim:expandtab:ts=2 sw=2:
*/ */
#include <limits.h> #define _XOPEN_SOURCE 500
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>

View File

@ -350,7 +350,8 @@ typedef struct T_Page
byte Background_transparent; ///< Boolean, true if Layer 0 should have transparent pixels byte Background_transparent; ///< Boolean, true if Layer 0 should have transparent pixels
byte Transparent_color; ///< Index of transparent color. 0 to 255. byte Transparent_color; ///< Index of transparent color. 0 to 255.
byte Nb_layers; ///< Number of layers byte Nb_layers; ///< Number of layers
byte * Image[0]; ///< Pixel data for the (first layer of) image. byte * Image[]; ///< Pixel data for the (first layer of) image.
// Define as Image[0] if you have an old gcc which is not C99.
// No field after Image[] ! Dynamic layer allocation for Image[1], [2] etc. // No field after Image[] ! Dynamic layer allocation for Image[1], [2] etc.
} T_Page; } T_Page;

7
text.c
View File

@ -515,11 +515,16 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
return new_brush; return new_brush;
} }
#ifdef NOTTF
#define TTFONLY __attribute__((unused))
#else
#define TTFONLY
#endif
// Crée une brosse à partir des paramètres de texte demandés. // Crée une brosse à partir des paramètres de texte demandés.
// Si cela réussit, la fonction place les dimensions dans width et height, // Si cela réussit, la fonction place les dimensions dans width et height,
// et retourne l'adresse du bloc d'octets. // et retourne l'adresse du bloc d'octets.
byte *Render_text(const char *str, int font_number, int size, int antialias, int bold, int italic, int *width, int *height) byte *Render_text(const char *str, int font_number, TTFONLY int size, int TTFONLY antialias, TTFONLY int bold, TTFONLY int italic, int *width, int *height)
{ {
T_Font *font = font_list_start; T_Font *font = font_list_start;
int index=font_number; int index=font_number;