mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-10 14:52:08 +00:00
Changed alloca -> calloc to fix crash bug.
Also added modestate (will be removed). btw, something to remember about ALLOCA: "If the calling function does not contain any references to local variables in the stack, the stack will not be restored correctly when the function exits, resulting in a program crash. "
This commit is contained in:
parent
260687d229
commit
1dd5b7ee10
1 changed files with 6 additions and 3 deletions
|
@ -68,6 +68,8 @@ int old_windowed_mouse;
|
|||
extern viddef_t vid; // global video state
|
||||
unsigned short d_8to16table[256];
|
||||
|
||||
int modestate; // fixme: just to avoid cross-comp. errors - remove later
|
||||
|
||||
// The original defaults
|
||||
//#define BASEWIDTH 320
|
||||
//#define BASEHEIGHT 200
|
||||
|
@ -141,7 +143,8 @@ void VID_Init (unsigned char *palette)
|
|||
if (!(screen = SDL_SetVideoMode(vid.width, vid.height, 8, flags)))
|
||||
Sys_Error("VID: Couldn't set video mode: %s\n", SDL_GetError());
|
||||
VID_SetPalette(palette);
|
||||
SDL_WM_SetCaption("sdlquake","sdlquake");
|
||||
VID_SetCaption("sdlquakeworld");
|
||||
|
||||
// now know everything we need to know about the buffer
|
||||
VGA_width = vid.conwidth = vid.width;
|
||||
VGA_height = vid.conheight = vid.height;
|
||||
|
@ -191,8 +194,8 @@ void VID_Update (vrect_t *rects)
|
|||
++n;
|
||||
|
||||
// Second, copy them to SDL rectangles and update
|
||||
if (!(sdlrects = (SDL_Rect *)alloca(n*sizeof(*sdlrects))))
|
||||
Sys_Error("Out of memory");
|
||||
if(!(sdlrects=(SDL_Rect *)calloc(1,n*sizeof(SDL_Rect))))
|
||||
Sys_Error("Out of memory!");
|
||||
i = 0;
|
||||
for (rect = rects; rect; rect = rect->pnext)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue