Eliminate the use of C++ keyword 'template'; bug #1131; from Scott A. Colcord

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3693 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2011-09-08 15:25:32 +00:00
parent 9f1fc6f6d1
commit 128bfaa8d4
5 changed files with 38 additions and 38 deletions
+6 -6
View File
@@ -70,12 +70,12 @@ static TFB_GRAPHICS_BACKEND opengl_unscaled_backend = {
static SDL_Surface * 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, SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
template->format->BitsPerPixel, templat->format->BitsPerPixel,
template->format->Rmask, template->format->Gmask, templat->format->Rmask, templat->format->Gmask,
template->format->Bmask, 0); templat->format->Bmask, 0);
if (newsurf == 0) { if (newsurf == 0) {
log_add (log_Error, "Couldn't create screen buffers: %s", log_add (log_Error, "Couldn't create screen buffers: %s",
SDL_GetError()); SDL_GetError());
@@ -84,11 +84,11 @@ Create_Screen (SDL_Surface *template, int w, int h)
} }
static int 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) if (*screen)
SDL_FreeSurface (*screen); SDL_FreeSurface (*screen);
*screen = Create_Screen (template, w, h); *screen = Create_Screen (templat, w, h);
return *screen == 0 ? -1 : 0; return *screen == 0 ? -1 : 0;
} }
+6 -6
View File
@@ -48,12 +48,12 @@ static TFB_GRAPHICS_BACKEND pure_unscaled_backend = {
TFB_Pure_ColorLayer }; TFB_Pure_ColorLayer };
static SDL_Surface * 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, SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
template->format->BitsPerPixel, templat->format->BitsPerPixel,
template->format->Rmask, template->format->Gmask, templat->format->Rmask, templat->format->Gmask,
template->format->Bmask, 0); templat->format->Bmask, 0);
if (newsurf == 0) { if (newsurf == 0) {
log_add (log_Error, "Couldn't create screen buffers: %s", log_add (log_Error, "Couldn't create screen buffers: %s",
SDL_GetError()); SDL_GetError());
@@ -62,11 +62,11 @@ Create_Screen (SDL_Surface *template, int w, int h)
} }
static int 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) if (*screen)
SDL_FreeSurface (*screen); SDL_FreeSurface (*screen);
*screen = Create_Screen (template, w, h); *screen = Create_Screen (templat, w, h);
return *screen == 0 ? -1 : 0; return *screen == 0 ? -1 : 0;
} }
+3 -3
View File
@@ -53,9 +53,9 @@ UniChar GetLastCharacter (void);
/* Interrogating the current key configuration */ /* Interrogating the current key configuration */
void InterrogateInputState (int template, int control, int index, char *buffer, int maxlen); void InterrogateInputState (int templat, int control, int index, char *buffer, int maxlen);
void RemoveInputState (int template, int control, int index); void RemoveInputState (int templat, int control, int index);
void RebindInputState (int template, int control, int index); void RebindInputState (int templat, int control, int index);
void SaveKeyConfiguration (uio_DirHandle *path, const char *fname); void SaveKeyConfiguration (uio_DirHandle *path, const char *fname);
+14 -14
View File
@@ -420,11 +420,11 @@ TFB_ResetControls (void)
} }
void 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) || index >= MAX_FLIGHT_ALTERNATES)
{ {
log_add (log_Warning, "InterrogateInputState(): invalid control index"); log_add (log_Warning, "InterrogateInputState(): invalid control index");
@@ -457,13 +457,13 @@ InterrogateInputState (int template, int control, int index, char *buffer, int m
} }
void 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]; char keybuf[40];
keybuf[39] = '\0'; keybuf[39] = '\0';
if (template >= num_templ || control >= num_flight if (templat >= num_templ || control >= num_flight
|| index >= MAX_FLIGHT_ALTERNATES) || index >= MAX_FLIGHT_ALTERNATES)
{ {
log_add (log_Warning, "RemoveInputState(): invalid control index"); log_add (log_Warning, "RemoveInputState(): invalid control index");
@@ -471,23 +471,23 @@ RemoveInputState (int template, int control, int index)
} }
VControl_RemoveGestureBinding (g, VControl_RemoveGestureBinding (g,
(int *)(flight_vec + template * num_flight + control)); (int *)(flight_vec + templat * num_flight + control));
g->type = VCONTROL_NONE; 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); res_Remove (keybuf);
return; return;
} }
void void
RebindInputState (int template, int control, int index) RebindInputState (int templat, int control, int index)
{ {
VCONTROL_GESTURE g; VCONTROL_GESTURE g;
char keybuf[40], valbuf[40]; char keybuf[40], valbuf[40];
keybuf[39] = valbuf[39] = '\0'; keybuf[39] = valbuf[39] = '\0';
if (template >= num_templ || control >= num_flight if (templat >= num_templ || control >= num_flight
|| index >= MAX_FLIGHT_ALTERNATES) || index >= MAX_FLIGHT_ALTERNATES)
{ {
log_add (log_Warning, "RebindInputState(): invalid control index"); log_add (log_Warning, "RebindInputState(): invalid control index");
@@ -495,7 +495,7 @@ RebindInputState (int template, int control, int index)
} }
/* Remove the old binding on this spot */ /* Remove the old binding on this spot */
RemoveInputState (template, control, index); RemoveInputState (templat, control, index);
/* Wait for the next interesting bit of user input */ /* Wait for the next interesting bit of user input */
VControl_ClearGesture (); VControl_ClearGesture ();
@@ -506,9 +506,9 @@ RebindInputState (int template, int control, int index)
/* And now, add the new binding. */ /* And now, add the new binding. */
VControl_AddGestureBinding (&g, VControl_AddGestureBinding (&g,
(int *)(flight_vec + template * num_flight + control)); (int *)(flight_vec + templat * num_flight + control));
*CONTROL_PTR(template, control, index) = g; *CONTROL_PTR(templat, control, index) = g;
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);
VControl_DumpGesture (valbuf, 39, &g); VControl_DumpGesture (valbuf, 39, &g);
res_PutString (keybuf, valbuf); res_PutString (keybuf, valbuf);
} }
+9 -9
View File
@@ -321,18 +321,18 @@ do_advanced (WIDGET *self, int event)
} }
static void static void
populate_editkeys (int template) populate_editkeys (int templat)
{ {
int i, j; 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; textentries[0].value[textentries[0].maxlen-1] = 0;
for (i = 0; i < NUM_KEYS; i++) for (i = 0; i < NUM_KEYS; i++)
{ {
for (j = 0; j < 2; j++) 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 @@ gamma_DrawValue (WIDGET_SLIDER *self, int x, int y)
static void static void
rebind_control (WIDGET_CONTROLENTRY *widget) rebind_control (WIDGET_CONTROLENTRY *widget)
{ {
int template = choices[20].selected; int templat = choices[20].selected;
int control = widget->controlindex; int control = widget->controlindex;
int index = widget->highlighted; int index = widget->highlighted;
FlushInput (); FlushInput ();
DrawLabelAsWindow (&labels[3], NULL); DrawLabelAsWindow (&labels[3], NULL);
RebindInputState (template, control, index); RebindInputState (templat, control, index);
populate_editkeys (template); populate_editkeys (templat);
FlushInput (); FlushInput ();
} }
static void static void
clear_control (WIDGET_CONTROLENTRY *widget) clear_control (WIDGET_CONTROLENTRY *widget)
{ {
int template = choices[20].selected; int templat = choices[20].selected;
int control = widget->controlindex; int control = widget->controlindex;
int index = widget->highlighted; int index = widget->highlighted;
RemoveInputState (template, control, index); RemoveInputState (templat, control, index);
populate_editkeys (template); populate_editkeys (templat);
} }
static int static int