[Scummvm-git-logs] scummvm master -> 56f3132d10454338468fdc1d3c7a4556b5594ee8

digitall 547637+digitall at users.noreply.github.com
Thu Jun 18 19:14:52 UTC 2020


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7c131e0277 COMMON: Allow use of C++11 final keyword
34901536a7 LUA: Remove use of final as a variable name
4032427474 DRACI: Remove use of final as a variable name
56f3132d10 GLK: Remove use of final as a variable name


Commit: 7c131e0277471e21253023e9f61602e0c9f0a2fd
    https://github.com/scummvm/scummvm/commit/7c131e0277471e21253023e9f61602e0c9f0a2fd
Author: Colin Snover (github.com at zetafleet.com)
Date: 2020-06-18T20:14:46+01:00

Commit Message:
COMMON: Allow use of C++11 final keyword

Changed paths:
    common/c++11-compat.h


diff --git a/common/c++11-compat.h b/common/c++11-compat.h
index a56b79514c..5a981493ff 100644
--- a/common/c++11-compat.h
+++ b/common/c++11-compat.h
@@ -39,12 +39,13 @@
 #endif
 
 //
-// Replacement for the override keyword. This allows compilation of code
-// which uses it, but does not feature any semantic.
+// Replacement for the override & final keywords. This allows compilation of
+// code which uses it, but does not feature any semantic.
 //
-// MSVC 2012 and newer fully support override: http://msdn.microsoft.com/en-us/library/hh567368.aspx
+// MSVC 2012 and newer fully support these: http://msdn.microsoft.com/en-us/library/hh567368.aspx
 #if !defined(_MSC_VER) || _MSC_VER < 1700
 #define override
+#define final
 #endif
 
 #endif


Commit: 34901536a7e109d9e2c584cbd8cc76d328f7b039
    https://github.com/scummvm/scummvm/commit/34901536a7e109d9e2c584cbd8cc76d328f7b039
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-06-18T20:14:46+01:00

Commit Message:
LUA: Remove use of final as a variable name

Changed paths:
    common/lua/lcode.cpp


diff --git a/common/lua/lcode.cpp b/common/lua/lcode.cpp
index 93188b37e2..394530f3f4 100644
--- a/common/lua/lcode.cpp
+++ b/common/lua/lcode.cpp
@@ -390,7 +390,7 @@ static void exp2reg (FuncState *fs, expdesc *e, int reg) {
   if (e->k == VJMP)
     luaK_concat(fs, &e->t, e->u.s.info);  /* put this jump in `t' list */
   if (hasjumps(e)) {
-    int final;  /* position after whole expression */
+    int final_pos;  /* position after whole expression */
     int p_f = NO_JUMP;  /* position of an eventual LOAD false */
     int p_t = NO_JUMP;  /* position of an eventual LOAD true */
     if (need_value(fs, e->t) || need_value(fs, e->f)) {
@@ -399,9 +399,9 @@ static void exp2reg (FuncState *fs, expdesc *e, int reg) {
       p_t = code_label(fs, reg, 1, 0);
       luaK_patchtohere(fs, fj);
     }
-    final = luaK_getlabel(fs);
-    patchlistaux(fs, e->f, final, reg, p_f);
-    patchlistaux(fs, e->t, final, reg, p_t);
+    final_pos = luaK_getlabel(fs);
+    patchlistaux(fs, e->f, final_pos, reg, p_f);
+    patchlistaux(fs, e->t, final_pos, reg, p_t);
   }
   e->f = e->t = NO_JUMP;
   e->u.s.info = reg;


Commit: 4032427474ac5deda848694018f4ed1f5a39c927
    https://github.com/scummvm/scummvm/commit/4032427474ac5deda848694018f4ed1f5a39c927
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-06-18T20:14:46+01:00

Commit Message:
DRACI: Remove use of final as a variable name

Changed paths:
    engines/draci/walking.cpp


diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp
index 36cf33c82a..507bb9cc17 100644
--- a/engines/draci/walking.cpp
+++ b/engines/draci/walking.cpp
@@ -105,33 +105,33 @@ Common::Point WalkingMap::findNearestWalkable(int startX, int startY) const {
 		while (x <= y) {
 
 			// The place where, eventually, the result coordinates will be stored
-			Common::Point final;
+			Common::Point finalPos;
 
 			// Auxilliary array of multiplicative coefficients for reflecting points.
 			static const int kSigns[] = { 1, -1 };
 
 			// Check all 8 reflections of the basic point.
 			for (uint i = 0; i < 2; ++i) {
-				final.y = startY + y * kSigns[i];
+				finalPos.y = startY + y * kSigns[i];
 
 				for (uint j = 0; j < 2; ++j) {
-					final.x = startX + x * kSigns[j];
+					finalPos.x = startX + x * kSigns[j];
 
 					// If the current point is walkable, return it
-					if (searchRect.contains(final.x, final.y) && isWalkable(final)) {
-						return final;
+					if (searchRect.contains(finalPos.x, finalPos.y) && isWalkable(finalPos)) {
+						return finalPos;
 					}
 				}
 			}
 			for (uint i = 0; i < 2; ++i) {
-				final.y = startY + x * kSigns[i];
+				finalPos.y = startY + x * kSigns[i];
 
 				for (uint j = 0; j < 2; ++j) {
-					final.x = startX + y * kSigns[j];
+					finalPos.x = startX + y * kSigns[j];
 
 					// If the current point is walkable, return it
-					if (searchRect.contains(final.x, final.y) && isWalkable(final)) {
-						return final;
+					if (searchRect.contains(finalPos.x, finalPos.y) && isWalkable(finalPos)) {
+						return finalPos;
 					}
 				}
 			}


Commit: 56f3132d10454338468fdc1d3c7a4556b5594ee8
    https://github.com/scummvm/scummvm/commit/56f3132d10454338468fdc1d3c7a4556b5594ee8
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-06-18T20:14:46+01:00

Commit Message:
GLK: Remove use of final as a variable name

Changed paths:
    engines/glk/adrift/scparser.cpp
    engines/glk/adrift/scprintf.cpp
    engines/glk/tads/tads2/regex.cpp


diff --git a/engines/glk/adrift/scparser.cpp b/engines/glk/adrift/scparser.cpp
index cabda664ae..c705306974 100644
--- a/engines/glk/adrift/scparser.cpp
+++ b/engines/glk/adrift/scparser.cpp
@@ -1749,7 +1749,7 @@ sc_char *uip_replace_pronouns(sc_gameref_t game, const sc_char *string) {
 		 */
 		if (prefix && name && extent > 0) {
 			sc_char *position;
-			sc_int prefix_length, name_length, length, final;
+			sc_int prefix_length, name_length, length, final_length;
 
 			/*
 			 * If not yet allocated, allocate a buffer now, and copy the input
@@ -1778,15 +1778,15 @@ sc_char *uip_replace_pronouns(sc_gameref_t game, const sc_char *string) {
 				buffer_allocation += length - extent;
 				buffer = (sc_char *)sc_realloc(buffer, buffer_allocation);
 				current = buffer + offset;
-				final = length;
+				final_length = length;
 			} else
-				final = extent;
+				final_length = extent;
 
 			/* Insert the replacement strings into the buffer. */
 			position = buffer + (current - buffer);
 			memmove(position + length,
 			        position + extent,
-			        buffer_allocation - (current - buffer) - final);
+			        buffer_allocation - (current - buffer) - final_length);
 			memcpy(position, prefix, prefix_length);
 			position[prefix_length] = ' ';
 			memcpy(position + prefix_length + 1, name, name_length);
diff --git a/engines/glk/adrift/scprintf.cpp b/engines/glk/adrift/scprintf.cpp
index 90c41305ce..73c14d2e4a 100644
--- a/engines/glk/adrift/scprintf.cpp
+++ b/engines/glk/adrift/scprintf.cpp
@@ -1345,7 +1345,7 @@ sc_char *pf_filter_input(const sc_char *string, sc_prop_setref_t bundle) {
 		if (index_ < synonym_count && extent > 0) {
 			const sc_char *replacement;
 			sc_char *position;
-			sc_int length, final;
+			sc_int length, final_length;
 
 			/*
 			 * If not yet allocated, allocate a buffer now, and copy the input
@@ -1378,15 +1378,15 @@ sc_char *pf_filter_input(const sc_char *string, sc_prop_setref_t bundle) {
 				buffer_allocation += length - extent;
 				buffer = (sc_char *)sc_realloc(buffer, buffer_allocation);
 				current = buffer + offset;
-				final = length;
+				final_length = length;
 			} else
-				final = extent;
+				final_length = extent;
 
 			/* Insert the replacement string into the buffer. */
 			position = buffer + (current - buffer);
 			memmove(position + length,
 			        position + extent,
-			        buffer_allocation - (current - buffer) - final);
+			        buffer_allocation - (current - buffer) - final_length);
 			memcpy(position, replacement, length);
 
 			/* Adjust current to skip over the replacement. */
diff --git a/engines/glk/tads/tads2/regex.cpp b/engines/glk/tads/tads2/regex.cpp
index 5d608dfa4a..f83de7cefb 100644
--- a/engines/glk/tads/tads2/regex.cpp
+++ b/engines/glk/tads/tads2/regex.cpp
@@ -136,7 +136,7 @@ struct re_machine {
     re_state_id init;
 
     /* the machine's final state */
-    re_state_id final;
+    re_state_id final_state;
 };
 
 /* ------------------------------------------------------------------------ */
@@ -325,7 +325,7 @@ static void re_set_trans(re_context *ctx,
 static void re_init_machine(re_context *ctx, re_machine *machine)
 {
     machine->init = re_alloc_state(ctx);
-    machine->final = re_alloc_state(ctx);
+    machine->final_state = re_alloc_state(ctx);
 }
 
 /*
@@ -337,7 +337,7 @@ static void re_build_char(re_context *ctx, re_machine *machine, char ch)
     re_init_machine(ctx, machine);
 
     /* allocate a transition tuple for the new state */
-    re_set_trans(ctx, machine->init, machine->final, ch);
+    re_set_trans(ctx, machine->init, machine->final_state, ch);
 }
 
 /*
@@ -353,7 +353,7 @@ static void re_build_char_range(re_context *ctx, re_machine *machine,
     re_init_machine(ctx, machine);
 
     /* allocate a transition table for the new state */
-    re_set_trans(ctx, machine->init, machine->final,
+    re_set_trans(ctx, machine->init, machine->final_state,
                  (char)(exclusion ? RE_RANGE_EXCL : RE_RANGE));
 
     /* allocate a copy of the range bit vector */
@@ -383,7 +383,7 @@ static void re_build_group_matcher(re_context *ctx,
      *   as the character code.  Store the special code for a group
      *   recognizer rather than the normal literal character code.  
      */
-    re_set_trans(ctx, machine->init, machine->final,
+    re_set_trans(ctx, machine->init, machine->final_state,
                  (char)(group_num + RE_GROUP_MATCH_0));
 }
 
@@ -407,13 +407,13 @@ static void re_build_concat(re_context *ctx, re_machine *new_machine,
      *   Set up an epsilon transition from the first submachine's final
      *   state to the second submachine's initial state 
      */
-    re_set_trans(ctx, lhs->final, rhs->init, RE_EPSILON);
+    re_set_trans(ctx, lhs->final_state, rhs->init, RE_EPSILON);
 
     /*
      *   Set up an epsilon transition from the second submachine's final
      *   state to our new machine's final state 
      */
-    re_set_trans(ctx, rhs->final, new_machine->final, RE_EPSILON);
+    re_set_trans(ctx, rhs->final_state, new_machine->final_state, RE_EPSILON);
 }
 
 /*
@@ -433,18 +433,18 @@ static void re_build_group(re_context *ctx, re_machine *new_machine,
      *   the group's final state into the container's final state 
      */
     re_set_trans(ctx, new_machine->init, sub_machine->init, RE_EPSILON);
-    re_set_trans(ctx, sub_machine->final, new_machine->final, RE_EPSILON);
+    re_set_trans(ctx, sub_machine->final_state, new_machine->final_state, RE_EPSILON);
 
     /*
      *   Mark the initial and final states of the group machine as being
      *   group markers.  
      */
     ctx->tuple_arr[new_machine->init].flags |= RE_STATE_GROUP_BEGIN;
-    ctx->tuple_arr[new_machine->final].flags |= RE_STATE_GROUP_END;
+    ctx->tuple_arr[new_machine->final_state].flags |= RE_STATE_GROUP_END;
 
     /* store the group ID in the 'ch' member of the start and end states */
     ctx->tuple_arr[new_machine->init].ch = group_id;
-    ctx->tuple_arr[new_machine->final].ch = group_id;
+    ctx->tuple_arr[new_machine->final_state].ch = group_id;
 }
 
 /*
@@ -467,8 +467,8 @@ static void re_build_alter(re_context *ctx, re_machine *new_machine,
      *   Set up an epsilon transition from the final state of each
      *   submachine to our final state 
      */
-    re_set_trans(ctx, lhs->final, new_machine->final, RE_EPSILON);
-    re_set_trans(ctx, rhs->final, new_machine->final, RE_EPSILON);
+    re_set_trans(ctx, lhs->final_state, new_machine->final_state, RE_EPSILON);
+    re_set_trans(ctx, rhs->final_state, new_machine->final_state, RE_EPSILON);
 }
 
 /*
@@ -487,7 +487,7 @@ static void re_build_closure(re_context *ctx,
      *   to our final state 
      */
     re_set_trans(ctx, new_machine->init, sub->init, RE_EPSILON);
-    re_set_trans(ctx, sub->final, new_machine->final, RE_EPSILON);
+    re_set_trans(ctx, sub->final_state, new_machine->final_state, RE_EPSILON);
 
     /*
      *   If this is an unbounded closure ('*' or '+', but not '?'), set up
@@ -497,7 +497,7 @@ static void re_build_closure(re_context *ctx,
      *   once.  
      */
     if (specifier != '?')
-        re_set_trans(ctx, sub->final, sub->init, RE_EPSILON);
+        re_set_trans(ctx, sub->final_state, sub->init, RE_EPSILON);
 
     /*
      *   If this is a zero-or-one closure or a zero-or-more closure, set
@@ -507,7 +507,7 @@ static void re_build_closure(re_context *ctx,
      *   subexpression in this case.  
      */
     if (specifier != '+')
-        re_set_trans(ctx, new_machine->init, new_machine->final, RE_EPSILON);
+        re_set_trans(ctx, new_machine->init, new_machine->final_state, RE_EPSILON);
 }
 
 /*
@@ -515,7 +515,7 @@ static void re_build_closure(re_context *ctx,
  */
 static void re_build_null_machine(re_context *ctx, re_machine *machine)
 {
-    machine->init = machine->final = RE_STATE_INVALID;
+    machine->init = machine->final_state = RE_STATE_INVALID;
 }
 
 /* ------------------------------------------------------------------------ */
@@ -1130,7 +1130,7 @@ static int re_match(re_context *ctx, const char *entire_str,
      *   if we're starting in the final state, immediately return success
      *   with a zero-length match 
      */
-    if (cur_state == machine->final)
+    if (cur_state == machine->final_state)
     {
         /* return success with a zero-length match */
         return 0;
@@ -1390,7 +1390,7 @@ static int re_match(re_context *ctx, const char *entire_str,
              */
             memcpy(regs1, regs, sizeof(regs1));
             sub_machine.init = tuple->next_state_1;
-            sub_machine.final = machine->final;
+            sub_machine.final_state = machine->final_state;
             ret1 = re_match(ctx, entire_str, p, curlen, &sub_machine, regs1);
 
             /*
@@ -1398,7 +1398,7 @@ static int re_match(re_context *ctx, const char *entire_str,
              */
             memcpy(regs2, regs, sizeof(regs2));
             sub_machine.init = tuple->next_state_2;
-            sub_machine.final = machine->final;
+            sub_machine.final_state = machine->final_state;
             ret2 = re_match(ctx, entire_str, p, curlen, &sub_machine, regs2);
 
             /*
@@ -1429,7 +1429,7 @@ static int re_match(re_context *ctx, const char *entire_str,
         /*
          *   If we're in the final state, return success 
          */
-        if (cur_state == machine->final)
+        if (cur_state == machine->final_state)
         {
             /* finish off any group involved in the final state */
             re_note_group(ctx, regs, cur_state, p);




More information about the Scummvm-git-logs mailing list