Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed a whole slew of compiler warnings that -Wall exposed.
  • Loading branch information
icculus committed Oct 13, 2011
1 parent 32ebb0d commit 4e72541
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 68 deletions.
3 changes: 3 additions & 0 deletions src/cpuinfo/SDL_cpuinfo.c
Expand Up @@ -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)
{
Expand Down Expand Up @@ -455,6 +457,7 @@ SDL_GetCPUName(void)
}
return SDL_CPUName;
}
#endif

int
SDL_GetCPUCacheLineSize(void)
Expand Down
3 changes: 2 additions & 1 deletion src/events/SDL_gesture.c
Expand Up @@ -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++) {
Expand Down
1 change: 0 additions & 1 deletion src/events/SDL_mouse.c
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions src/power/linux/SDL_syspower.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/render/opengl/SDL_render_gl.c
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions src/render/software/SDL_blendline.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/render/software/SDL_draw.h
Expand Up @@ -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; \
Expand All @@ -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; \
Expand All @@ -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); \
Expand Down
1 change: 1 addition & 0 deletions src/thread/pthread/SDL_syssem.c
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions src/thread/pthread/SDL_systhread.c
Expand Up @@ -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>
Expand All @@ -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"
Expand Down
9 changes: 6 additions & 3 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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)
{
Expand All @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions src/video/x11/SDL_x11framebuffer.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11mouse.c
Expand Up @@ -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) {
Expand Down
8 changes: 5 additions & 3 deletions src/video/x11/SDL_x11opengl.c
Expand Up @@ -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 */

Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/video/x11/SDL_x11shape.c
Expand Up @@ -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) {
Expand Down
22 changes: 11 additions & 11 deletions src/video/x11/SDL_x11sym.h
Expand Up @@ -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. */
Expand Down Expand Up @@ -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* */
Expand Down
3 changes: 1 addition & 2 deletions src/video/x11/SDL_x11touch.c
Expand Up @@ -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];
Expand Down Expand Up @@ -111,7 +110,7 @@ X11_InitTouch(_THIS)
}
}

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

Expand Down
29 changes: 1 addition & 28 deletions src/video/x11/SDL_x11window.c
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 4e72541

Please sign in to comment.