Skip to content

Commit

Permalink
Correct fix for Bugzilla #602.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Sep 15, 2008
1 parent 310125a commit 76f0c86
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
8 changes: 1 addition & 7 deletions src/video/Xext/Xxf86vm/XF86VMode.c
Expand Up @@ -214,12 +214,6 @@ SDL_NAME(XF86VidModeGetGamma)(Display *dpy, int screen, SDL_NAME(XF86VidModeGamm
return True;
}

/* this is to prevent an unaligned memory write on CPUs that need that. */
static void zap_ptr(char *ptr, size_t size)
{
memset(ptr, '\0', size);
}

Bool
SDL_NAME(XF86VidModeGetModeLine)(dpy, screen, dotclock, modeline)
Display* dpy;
Expand Down Expand Up @@ -290,7 +284,7 @@ SDL_NAME(XF86VidModeGetModeLine)(dpy, screen, dotclock, modeline)
}
_XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32));
} else {
zap_ptr((char *)&modeline->private, sizeof(modeline->private));
modeline->private = NULL;
}
UnlockDisplay(dpy);
SyncHandle();
Expand Down
21 changes: 19 additions & 2 deletions src/video/x11/SDL_x11modes.c
Expand Up @@ -52,8 +52,25 @@ static int cmpmodelist(const void *va, const void *vb)
#if SDL_VIDEO_DRIVER_X11_VIDMODE
Bool SDL_NAME(XF86VidModeGetModeInfo)(Display *dpy, int scr, SDL_NAME(XF86VidModeModeInfo) *info)
{
SDL_NAME(XF86VidModeModeLine) *l = (SDL_NAME(XF86VidModeModeLine)*)((char*)info + sizeof info->dotclock);
return SDL_NAME(XF86VidModeGetModeLine)(dpy, scr, (int*)&info->dotclock, l);
Bool retval;
int dotclock;
SDL_NAME(XF86VidModeModeLine) l;
SDL_memset(&l, 0, sizeof(l));
retval = SDL_NAME(XF86VidModeGetModeLine)(dpy, scr, &dotclock, &l);
info->dotclock = dotclock;
info->hdisplay = l.hdisplay;
info->hsyncstart = l.hsyncstart;
info->hsyncend = l.hsyncend;
info->htotal = l.htotal;
info->hskew = l.hskew;
info->vdisplay = l.vdisplay;
info->vsyncstart = l.vsyncstart;
info->vsyncend = l.vsyncend;
info->vtotal = l.vtotal;
info->flags = l.flags;
info->privsize = l.privsize;
info->private = l.private;
return retval;
}
#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */

Expand Down

0 comments on commit 76f0c86

Please sign in to comment.