Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed a whole slew of compiler warnings that -Wall exposed.

  • Loading branch information
icculus committed Oct 13, 2011
1 parent 32ebb0d commit 4e72541e3a5c403def461ad0b6140d0c8d4f534c
@@ -384,6 +384,8 @@ SDL_GetCPUType(void)
return SDL_CPUType;
}


#ifdef TEST_MAIN /* !!! FIXME: only used for test at the moment. */
static const char *
SDL_GetCPUName(void)
{
@@ -455,6 +457,7 @@ SDL_GetCPUName(void)
}
return SDL_CPUName;
}
#endif

int
SDL_GetCPUCacheLineSize(void)
@@ -390,10 +390,11 @@ int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) {
float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch) {

SDL_FloatPoint points[DOLLARNPOINTS];
int numPoints = dollarNormalize(path,points);
int i;
float bestDiff = 10000;

dollarNormalize(path,points);

//PrintPath(points);
*bestTempl = -1;
for(i = 0;i < touch->numDollarTemplates;i++) {
@@ -349,7 +349,6 @@ SDL_Cursor *
SDL_CreateCursor(const Uint8 * data, const Uint8 * mask,
int w, int h, int hot_x, int hot_y)
{
SDL_Mouse *mouse = SDL_GetMouse();
SDL_Surface *surface;
SDL_Cursor *cursor;
int x, y;
@@ -128,7 +128,6 @@ check_proc_acpi_battery(const char * node, SDL_bool * have_battery,
char *val = NULL;
SDL_bool charge = SDL_FALSE;
SDL_bool choose = SDL_FALSE;
SDL_bool is_ac = SDL_FALSE;
int maximum = -1;
int remaining = -1;
int secs = -1;
@@ -214,13 +213,6 @@ check_proc_acpi_ac_adapter(const char * node, SDL_bool * have_ac)
char *ptr = NULL;
char *key = NULL;
char *val = NULL;
SDL_bool charge = SDL_FALSE;
SDL_bool choose = SDL_FALSE;
SDL_bool is_ac = SDL_FALSE;
int maximum = -1;
int remaining = -1;
int secs = -1;
int pct = -1;

if (!load_acpi_file(base, node, "state", state, sizeof (state))) {
return;
@@ -348,8 +348,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
static void
GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
{
GL_RenderData *data = (GL_RenderData *) renderer->driverdata;

if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
/* Rebind the context to the window area and update matrices */
SDL_CurrentContext = NULL;
@@ -124,7 +124,6 @@ SDL_BlendLine_RGB555(SDL_Surface * dst, int x1, int y1, int x2, int y2,
SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
SDL_bool draw_end)
{
const SDL_PixelFormat *fmt = dst->format;
unsigned r, g, b, a, inva;

if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -216,7 +215,6 @@ SDL_BlendLine_RGB565(SDL_Surface * dst, int x1, int y1, int x2, int y2,
SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
SDL_bool draw_end)
{
const SDL_PixelFormat *fmt = dst->format;
unsigned r, g, b, a, inva;

if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -492,7 +490,6 @@ SDL_BlendLine_RGB888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
SDL_bool draw_end)
{
const SDL_PixelFormat *fmt = dst->format;
unsigned r, g, b, a, inva;

if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -584,7 +581,6 @@ SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
SDL_bool draw_end)
{
const SDL_PixelFormat *fmt = dst->format;
unsigned r, g, b, a, inva;

if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -45,13 +45,13 @@

#define DRAW_SETPIXEL(setpixel) \
do { \
unsigned sr = r, sg = g, sb = b, sa = a; \
unsigned sr = r, sg = g, sb = b, sa = a; (void) sa; \
setpixel; \
} while (0)

#define DRAW_SETPIXEL_BLEND(getpixel, setpixel) \
do { \
unsigned sr, sg, sb, sa; sa; \
unsigned sr, sg, sb, sa; (void) sa; \
getpixel; \
sr = DRAW_MUL(inva, sr) + r; \
sg = DRAW_MUL(inva, sg) + g; \
@@ -61,7 +61,7 @@ do { \

#define DRAW_SETPIXEL_ADD(getpixel, setpixel) \
do { \
unsigned sr, sg, sb, sa; sa; \
unsigned sr, sg, sb, sa; (void) sa; \
getpixel; \
sr += r; if (sr > 0xff) sr = 0xff; \
sg += g; if (sg > 0xff) sg = 0xff; \
@@ -71,7 +71,7 @@ do { \

#define DRAW_SETPIXEL_MOD(getpixel, setpixel) \
do { \
unsigned sr, sg, sb, sa; sa; \
unsigned sr, sg, sb, sa; (void) sa; \
getpixel; \
sr = DRAW_MUL(sr, r); \
sg = DRAW_MUL(sg, g); \
@@ -23,6 +23,7 @@
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
#include <sys/time.h>

#include "SDL_thread.h"
#include "SDL_timer.h"
@@ -18,6 +18,7 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

#include "SDL_config.h"

#include <pthread.h>
@@ -31,6 +32,8 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/syscall.h>
#include <unistd.h>
extern int pthread_setname_np (pthread_t __target_thread, __const char *__name) __THROW __nonnull ((2));
#endif

#include "SDL_platform.h"
@@ -234,7 +234,6 @@ X11_DispatchEvent(_THIS)
case KeyPress:{
KeyCode keycode = xevent.xkey.keycode;
KeySym keysym = NoSymbol;
SDL_Scancode scancode;
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE];
Status status = 0;

@@ -243,7 +242,7 @@ X11_DispatchEvent(_THIS)
#endif
SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]);
#if 1
if (videodata->key_layout[keycode] == SDLK_UNKNOWN) {
if (videodata->key_layout[keycode] == SDL_SCANCODE_UNKNOWN) {
int min_keycode, max_keycode;
XDisplayKeycodes(display, &min_keycode, &max_keycode);
keysym = XKeycodeToKeysym(display, keycode, 0);
@@ -522,6 +521,11 @@ X11_Pending(Display * display)
return (0);
}


/* !!! FIXME: this should be exposed in a header, or something. */
int SDL_GetNumTouch(void);


void
X11_PumpEvents(_THIS)
{
@@ -545,7 +549,6 @@ X11_PumpEvents(_THIS)
#ifdef SDL_INPUT_LINUXEV
/* Process Touch events - TODO When X gets touch support, use that instead*/
int i = 0,rd;
char name[256];
struct input_event ev[64];
int size = sizeof (struct input_event);

@@ -183,7 +183,10 @@ X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, SDL_Rect * rects,
rect->x, rect->y, rect->w, rect->h);
}
}

XSync(display, False);

return 0;
}

void
@@ -136,7 +136,7 @@ X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
/* Code below assumes ARGB pixel format */
SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);

rfg = gfg = bfg = rbg = gbg = bbg = fgBits = 0;
rfg = gfg = bfg = rbg = gbg = bbg = fgBits = bgBits = 0;
for (y = 0; y < surface->h; ++y) {
ptr = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch);
for (x = 0; x < surface->w; ++x) {
@@ -19,8 +19,8 @@
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"

#include "SDL_x11video.h"
#include "SDL_assert.h"

/* GLX implementation of SDL OpenGL support */

@@ -388,8 +388,10 @@ X11_GL_GetVisual(_THIS, Display * display, int screen)
XVisualInfo *vinfo;

/* 64 seems nice. */
int attribs[64];
int i = X11_GL_GetAttributes(_this,display,screen,attribs,64);
const int max_attrs = 64;
int attribs[max_attrs];
const int i = X11_GL_GetAttributes(_this,display,screen,attribs,max_attrs);
SDL_assert(i <= max_attrs);

vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
if (!vinfo) {
@@ -26,6 +26,7 @@
#include "SDL_x11video.h"
#include "SDL_x11shape.h"
#include "SDL_x11window.h"
#include "../SDL_shape_internals.h"

SDL_Window*
X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
@@ -178,17 +178,17 @@ SDL_X11_SYM(int,ipUnallocateAndSendData,(ChannelPtr a,IPCard b),(a,b),return)
/* XCursor support */
#if SDL_VIDEO_DRIVER_X11_XCURSOR
SDL_X11_MODULE(XCURSOR)
SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),)
SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),return)
SDL_X11_SYM(void,XcursorImageDestroy,(XcursorImage *a),(a),)
SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),)
SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),return)
#endif

/* Xinerama support */
#if SDL_VIDEO_DRIVER_X11_XINERAMA
SDL_X11_MODULE(XINERAMA)
SDL_X11_SYM(Bool,XineramaIsActive,(Display *a),(a),)
SDL_X11_SYM(Bool,XineramaQueryExtension,(Display *a,int *b,int *c),(a,b,c),)
SDL_X11_SYM(XineramaScreenInfo*,XineramaQueryScreens,(Display *a, int *b),(a,b),)
SDL_X11_SYM(Bool,XineramaIsActive,(Display *a),(a),return)
SDL_X11_SYM(Bool,XineramaQueryExtension,(Display *a,int *b,int *c),(a,b,c),return)
SDL_X11_SYM(XineramaScreenInfo*,XineramaQueryScreens,(Display *a, int *b),(a,b),return)
#endif

/* XInput support for multiple mice, tablets, etc. */
@@ -229,12 +229,12 @@ SDL_X11_SYM(void,XShapeCombineMask,(Display *dpy,Window dest,int dest_kind,int x

#if SDL_VIDEO_DRIVER_X11_XVIDMODE
SDL_X11_MODULE(XVIDMODE)
SDL_X11_SYM(Bool,XF86VidModeGetAllModeLines,(Display *a,int b,int *c,XF86VidModeModeInfo ***d),(a,b,c,d),)
SDL_X11_SYM(Bool,XF86VidModeGetModeLine,(Display *a,int b,int *c,XF86VidModeModeLine *d),(a,b,c,d),)
SDL_X11_SYM(Bool,XF86VidModeGetViewPort,(Display *a,int b,int *c,int *d),(a,b,c,d),)
SDL_X11_SYM(Bool,XF86VidModeQueryExtension,(Display *a,int *b,int *c),(a,b,c),)
SDL_X11_SYM(Bool,XF86VidModeQueryVersion,(Display *a,int *b,int *c),(a,b,c),)
SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),)
SDL_X11_SYM(Bool,XF86VidModeGetAllModeLines,(Display *a,int b,int *c,XF86VidModeModeInfo ***d),(a,b,c,d),return)
SDL_X11_SYM(Bool,XF86VidModeGetModeLine,(Display *a,int b,int *c,XF86VidModeModeLine *d),(a,b,c,d),return)
SDL_X11_SYM(Bool,XF86VidModeGetViewPort,(Display *a,int b,int *c,int *d),(a,b,c,d),return)
SDL_X11_SYM(Bool,XF86VidModeQueryExtension,(Display *a,int *b,int *c),(a,b,c),return)
SDL_X11_SYM(Bool,XF86VidModeQueryVersion,(Display *a,int *b,int *c),(a,b,c),return)
SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),return)
#endif

/* *INDENT-ON* */
@@ -39,7 +39,6 @@ X11_InitTouch(_THIS)
FILE *fd;
fd = fopen("/proc/bus/input/devices","r");

char c;
int i = 0;
int tsfd;
char line[256];
@@ -111,7 +110,7 @@ X11_InitTouch(_THIS)
}
}

close(fd);
fclose(fd);
#endif
}

@@ -86,31 +86,6 @@ X11_GetWMStateProperty(_THIS, SDL_Window * window, Atom atoms[3])
return count;
}

static void
X11_GetDisplaySize(_THIS, SDL_Window * window, int *w, int *h)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
SDL_DisplayData *displaydata =
(SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
XWindowAttributes attr;

XGetWindowAttributes(data->display, RootWindow(data->display, displaydata->screen), &attr);
if (window->flags & SDL_WINDOW_FULLSCREEN) {
/* The bounds when this window is visible is the fullscreen mode */
SDL_DisplayMode fullscreen_mode;
if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
attr.width = fullscreen_mode.w;
attr.height = fullscreen_mode.h;
}
}
if (w) {
*w = attr.width;
}
if (h) {
*h = attr.height;
}
}

static int
SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
{
@@ -320,7 +295,6 @@ X11_CreateWindow(_THIS, SDL_Window * window)
xattr.border_pixel = 0;

if (visual->class == DirectColor) {
Status status;
XColor *colorcells;
int i;
int ncolors;
@@ -757,7 +731,6 @@ X11_SetWindowPosition(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display = data->videodata->display;
int x, y;

XMoveWindow(display, data->xwindow, window->x, window->y);
XFlush(display);
@@ -952,7 +925,7 @@ X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
int ncolors;
int rmask, gmask, bmask;
int rshift, gshift, bshift;
int i, j;
int i;

if (visual->class != DirectColor) {
SDL_SetError("Window doesn't have DirectColor visual");

0 comments on commit 4e72541

Please sign in to comment.