From: <av...@us...> - 2011-09-08 15:25:43
|
Revision: 3693 http://sc2.svn.sourceforge.net/sc2/?rev=3693&view=rev Author: avolkov Date: 2011-09-08 15:25:32 +0000 (Thu, 08 Sep 2011) Log Message: ----------- Eliminate the use of C++ keyword 'template'; bug #1131; from Scott A. Colcord Modified Paths: -------------- trunk/sc2/src/libs/graphics/sdl/opengl.c trunk/sc2/src/libs/graphics/sdl/pure.c trunk/sc2/src/libs/inplib.h trunk/sc2/src/libs/input/sdl/input.c trunk/sc2/src/uqm/setupmenu.c Modified: trunk/sc2/src/libs/graphics/sdl/opengl.c =================================================================== --- trunk/sc2/src/libs/graphics/sdl/opengl.c 2011-09-07 18:07:26 UTC (rev 3692) +++ trunk/sc2/src/libs/graphics/sdl/opengl.c 2011-09-08 15:25:32 UTC (rev 3693) @@ -70,12 +70,12 @@ static SDL_Surface * -Create_Screen (SDL_Surface *template, int w, int h) +Create_Screen (SDL_Surface *templat, int w, int h) { SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, - template->format->BitsPerPixel, - template->format->Rmask, template->format->Gmask, - template->format->Bmask, 0); + templat->format->BitsPerPixel, + templat->format->Rmask, templat->format->Gmask, + templat->format->Bmask, 0); if (newsurf == 0) { log_add (log_Error, "Couldn't create screen buffers: %s", SDL_GetError()); @@ -84,11 +84,11 @@ } static int -ReInit_Screen (SDL_Surface **screen, SDL_Surface *template, int w, int h) +ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h) { if (*screen) SDL_FreeSurface (*screen); - *screen = Create_Screen (template, w, h); + *screen = Create_Screen (templat, w, h); return *screen == 0 ? -1 : 0; } Modified: trunk/sc2/src/libs/graphics/sdl/pure.c =================================================================== --- trunk/sc2/src/libs/graphics/sdl/pure.c 2011-09-07 18:07:26 UTC (rev 3692) +++ trunk/sc2/src/libs/graphics/sdl/pure.c 2011-09-08 15:25:32 UTC (rev 3693) @@ -48,12 +48,12 @@ TFB_Pure_ColorLayer }; static SDL_Surface * -Create_Screen (SDL_Surface *template, int w, int h) +Create_Screen (SDL_Surface *templat, int w, int h) { SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, - template->format->BitsPerPixel, - template->format->Rmask, template->format->Gmask, - template->format->Bmask, 0); + templat->format->BitsPerPixel, + templat->format->Rmask, templat->format->Gmask, + templat->format->Bmask, 0); if (newsurf == 0) { log_add (log_Error, "Couldn't create screen buffers: %s", SDL_GetError()); @@ -62,11 +62,11 @@ } static int -ReInit_Screen (SDL_Surface **screen, SDL_Surface *template, int w, int h) +ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h) { if (*screen) SDL_FreeSurface (*screen); - *screen = Create_Screen (template, w, h); + *screen = Create_Screen (templat, w, h); return *screen == 0 ? -1 : 0; } Modified: trunk/sc2/src/libs/inplib.h =================================================================== --- trunk/sc2/src/libs/inplib.h 2011-09-07 18:07:26 UTC (rev 3692) +++ trunk/sc2/src/libs/inplib.h 2011-09-08 15:25:32 UTC (rev 3693) @@ -53,9 +53,9 @@ /* Interrogating the current key configuration */ -void InterrogateInputState (int template, int control, int index, char *buffer, int maxlen); -void RemoveInputState (int template, int control, int index); -void RebindInputState (int template, int control, int index); +void InterrogateInputState (int templat, int control, int index, char *buffer, int maxlen); +void RemoveInputState (int templat, int control, int index); +void RebindInputState (int templat, int control, int index); void SaveKeyConfiguration (uio_DirHandle *path, const char *fname); Modified: trunk/sc2/src/libs/input/sdl/input.c =================================================================== --- trunk/sc2/src/libs/input/sdl/input.c 2011-09-07 18:07:26 UTC (rev 3692) +++ trunk/sc2/src/libs/input/sdl/input.c 2011-09-08 15:25:32 UTC (rev 3693) @@ -420,11 +420,11 @@ } void -InterrogateInputState (int template, int control, int index, char *buffer, int maxlen) +InterrogateInputState (int templat, int control, int index, char *buffer, int maxlen) { - VCONTROL_GESTURE *g = CONTROL_PTR(template, control, index); + VCONTROL_GESTURE *g = CONTROL_PTR(templat, control, index); - if (template >= num_templ || control >= num_flight + if (templat >= num_templ || control >= num_flight || index >= MAX_FLIGHT_ALTERNATES) { log_add (log_Warning, "InterrogateInputState(): invalid control index"); @@ -457,13 +457,13 @@ } void -RemoveInputState (int template, int control, int index) +RemoveInputState (int templat, int control, int index) { - VCONTROL_GESTURE *g = CONTROL_PTR(template, control, index); + VCONTROL_GESTURE *g = CONTROL_PTR(templat, control, index); char keybuf[40]; keybuf[39] = '\0'; - if (template >= num_templ || control >= num_flight + if (templat >= num_templ || control >= num_flight || index >= MAX_FLIGHT_ALTERNATES) { log_add (log_Warning, "RemoveInputState(): invalid control index"); @@ -471,23 +471,23 @@ } VControl_RemoveGestureBinding (g, - (int *)(flight_vec + template * num_flight + control)); + (int *)(flight_vec + templat * num_flight + control)); g->type = VCONTROL_NONE; - snprintf (keybuf, 39, "keys.%d.%s.%d", template+1, flight_res_names[control], index+1); + snprintf (keybuf, 39, "keys.%d.%s.%d", templat+1, flight_res_names[control], index+1); res_Remove (keybuf); return; } void -RebindInputState (int template, int control, int index) +RebindInputState (int templat, int control, int index) { VCONTROL_GESTURE g; char keybuf[40], valbuf[40]; keybuf[39] = valbuf[39] = '\0'; - if (template >= num_templ || control >= num_flight + if (templat >= num_templ || control >= num_flight || index >= MAX_FLIGHT_ALTERNATES) { log_add (log_Warning, "RebindInputState(): invalid control index"); @@ -495,7 +495,7 @@ } /* Remove the old binding on this spot */ - RemoveInputState (template, control, index); + RemoveInputState (templat, control, index); /* Wait for the next interesting bit of user input */ VControl_ClearGesture (); @@ -506,9 +506,9 @@ /* And now, add the new binding. */ VControl_AddGestureBinding (&g, - (int *)(flight_vec + template * num_flight + control)); - *CONTROL_PTR(template, control, index) = g; - snprintf (keybuf, 39, "keys.%d.%s.%d", template+1, flight_res_names[control], index+1); + (int *)(flight_vec + templat * num_flight + control)); + *CONTROL_PTR(templat, control, index) = g; + snprintf (keybuf, 39, "keys.%d.%s.%d", templat+1, flight_res_names[control], index+1); VControl_DumpGesture (valbuf, 39, &g); res_PutString (keybuf, valbuf); } Modified: trunk/sc2/src/uqm/setupmenu.c =================================================================== --- trunk/sc2/src/uqm/setupmenu.c 2011-09-07 18:07:26 UTC (rev 3692) +++ trunk/sc2/src/uqm/setupmenu.c 2011-09-08 15:25:32 UTC (rev 3693) @@ -321,18 +321,18 @@ } static void -populate_editkeys (int template) +populate_editkeys (int templat) { int i, j; - strncpy (textentries[0].value, input_templates[template].name, textentries[0].maxlen); + strncpy (textentries[0].value, input_templates[templat].name, textentries[0].maxlen); textentries[0].value[textentries[0].maxlen-1] = 0; for (i = 0; i < NUM_KEYS; i++) { for (j = 0; j < 2; j++) { - InterrogateInputState (template, i, j, controlentries[i].controlname[j], WIDGET_CONTROLENTRY_WIDTH); + InterrogateInputState (templat, i, j, controlentries[i].controlname[j], WIDGET_CONTROLENTRY_WIDTH); } } } @@ -743,26 +743,26 @@ static void rebind_control (WIDGET_CONTROLENTRY *widget) { - int template = choices[20].selected; + int templat = choices[20].selected; int control = widget->controlindex; int index = widget->highlighted; FlushInput (); DrawLabelAsWindow (&labels[3], NULL); - RebindInputState (template, control, index); - populate_editkeys (template); + RebindInputState (templat, control, index); + populate_editkeys (templat); FlushInput (); } static void clear_control (WIDGET_CONTROLENTRY *widget) { - int template = choices[20].selected; + int templat = choices[20].selected; int control = widget->controlindex; int index = widget->highlighted; - RemoveInputState (template, control, index); - populate_editkeys (template); + RemoveInputState (templat, control, index); + populate_editkeys (templat); } static int This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |