[Scummvm-git-logs] scummvm master -> 296dac6bc278400e3d17b4596de8e10f515c07f1

sev- sev at scummvm.org
Wed Feb 8 17:30:49 CET 2017


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

Summary:
31d6fa0980 DIRECTOR: Lingo: Fix constants parsing
1b53a2ce75 DIRECTOR: Lingo: Fix 'when..then' statement
296dac6bc2 DIRECTOR: Lingo: Switched Symbol::name to Common::String


Commit: 31d6fa0980e615075d85b4480fd09724716c267d
    https://github.com/scummvm/scummvm/commit/31d6fa0980e615075d85b4480fd09724716c267d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-08T17:30:17+01:00

Commit Message:
DIRECTOR: Lingo: Fix constants parsing

Changed paths:
    engines/director/lingo/lingo-builtins.cpp


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 905c6e7..40a6e91 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -208,8 +208,12 @@ static const char *twoWordBuiltins[] = {
 };
 
 static const char *builtinFunctions[] = {
+	"backspace",
 	"cast",
 	"count",
+	"empty",
+	"enter",
+	"false",
 	"field",
 	"findEmpty",
 	"findPos",
@@ -233,9 +237,14 @@ static const char *builtinFunctions[] = {
 	"objectp",
 	"pictureP",
 	"rollOver",
+	"quote",
+	"return",
 	"soundBusy",
 	"stringp",
 	"symbolp",
+	"tab",
+	"true",
+	"version",
 	"window",
 	"xFactoryList",
 	0


Commit: 1b53a2ce75c0bd693d0a3f6c26805b0ea8f2fc15
    https://github.com/scummvm/scummvm/commit/1b53a2ce75c0bd693d0a3f6c26805b0ea8f2fc15
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-08T17:30:17+01:00

Commit Message:
DIRECTOR: Lingo: Fix 'when..then' statement

Changed paths:
    engines/director/lingo/lingo-gr.cpp
    engines/director/lingo/lingo-gr.y


diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index e25e206..2bafc1e 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -621,7 +621,7 @@ static const yytype_int16 yyrhs[] =
      124,    -1,   105,    -1,   107,    -1,   114,    93,   113,    94,
      120,   119,    28,    -1,   115,    85,   123,   119,    49,   123,
      119,   120,   119,    28,    -1,   115,    85,   123,   119,    30,
-      49,   123,   119,   120,   119,    28,    -1,   121,   123,   119,
+      49,   123,   119,   120,   119,    28,    -1,   121,   105,   119,
       -1,   122,   123,   102,   120,   119,    28,    -1,   122,   123,
       49,   123,    -1,   116,   113,    48,   102,   120,   119,    28,
       -1,   116,   113,    48,   102,   120,   119,    53,   120,   119,
@@ -841,39 +841,39 @@ static const yytype_int16 yydefgoto[] =
 #define YYPACT_NINF -278
 static const yytype_int16 yypact[] =
 {
-     294,   -76,  -278,  -278,   902,  -278,  -278,   902,   902,   902,
-      32,  -278,   902,   960,  -278,  -278,  -278,   -21,    40,   807,
-    -278,    48,   902,    45,    46,    50,    56,    66,   902,   865,
-      74,   902,   902,   902,   902,   902,   902,  -278,    75,   -62,
-     902,   902,   902,   902,     2,  -278,  -278,  -278,  -278,  -278,
-       8,    15,   997,   902,   902,  1506,  -278,  -278,  -278,  -278,
-    -278,  -278,  -278,    21,   902,  1506,  1506,  1506,  1506,    26,
-     902,  1506,   902,    26,   902,  -278,  -278,    47,   902,  -278,
-     902,  -278,   104,  -278,  1506,    25,  -278,  -278,  1026,   125,
-    -278,   -38,   902,   -37,   102,  -278,  -278,  1346,  -278,    25,
-    -278,  -278,    52,   -45,  1058,  1090,  1122,  1154,  1378,  -278,
-     130,   -45,   -45,  1442,  1506,    24,  -278,   381,   997,   902,
-     997,   107,  1474,  1506,   706,   902,   902,   902,   902,   902,
+     294,   -36,  -278,  -278,   902,  -278,  -278,   902,   902,   902,
+       7,  -278,   902,   960,  -278,  -278,  -278,    18,    46,   807,
+    -278,    54,   902,    52,    48,    63,    66,    68,   902,   865,
+      70,   902,   902,   902,   902,   902,   902,  -278,    73,   -17,
+     902,   902,   902,   902,     6,  -278,  -278,  -278,  -278,  -278,
+       8,    14,   997,   729,   902,  1506,  -278,  -278,  -278,  -278,
+    -278,  -278,  -278,    29,   902,  1506,  1506,  1506,  1506,    17,
+     902,  1506,   902,    17,   902,  -278,  -278,    24,   902,  -278,
+     902,  -278,    77,  -278,  1506,    25,  -278,  -278,  1026,   101,
+    -278,   -45,   902,   -38,    95,  -278,  -278,  1346,  -278,    25,
+    -278,  -278,    49,   -13,  1058,  1090,  1122,  1154,  1378,  -278,
+     121,   -13,   -13,  1442,  1506,    12,  -278,   381,   997,   902,
+     997,   102,  1474,  -278,   706,   902,   902,   902,   902,   902,
      902,   902,   902,   902,   902,   902,   902,   902,   902,   902,
-     902,   902,  1026,   902,    59,  1442,   -77,    59,   137,  1506,
-    1506,   902,  -278,  -278,   140,   902,   902,  -278,   902,   902,
-    1314,   902,   902,  -278,  -278,   902,  -278,   141,   902,   902,
-     902,   902,   902,   902,   902,   902,   902,   902,  -278,    19,
-    -278,  -278,   902,  -278,    73,  1506,    85,  1410,   -76,   902,
-    -278,   902,  -278,    16,    16,    16,   -45,   -45,   -45,  1506,
-      16,    16,    20,   197,   197,   -45,   -45,  1506,  1506,  1506,
-    -278,  -278,  1506,   157,  -278,  1506,  1506,  1506,  1506,   902,
-     902,  1506,  1506,   157,  1506,  -278,  1506,  1186,  1506,  1218,
+     902,   902,  1026,   902,    50,  1442,   -78,    50,   127,  1506,
+    1506,   902,  -278,  -278,   130,   902,   902,  -278,   902,   902,
+    1314,   902,   902,  -278,  -278,   902,  -278,   131,   902,   902,
+     902,   902,   902,   902,   902,   902,   902,   902,  -278,   -77,
+    -278,  -278,   902,  -278,    64,  1506,    67,  1410,   -36,   902,
+    -278,   902,  -278,    19,    19,    19,   -13,   -13,   -13,  1506,
+      19,    19,   197,   140,   140,   -13,   -13,  1506,  1506,  1506,
+    -278,  -278,  1506,   141,  -278,  1506,  1506,  1506,  1506,   902,
+     902,  1506,  1506,   141,  1506,  -278,  1506,  1186,  1506,  1218,
     1506,  1250,  1506,  1282,  1506,  1506,  -278,  -278,   902,  1506,
-    -278,    27,  -278,  -278,   729,  1506,  1506,   555,  -278,   -73,
-    1506,  1506,   -73,   902,   902,   902,   902,   157,    49,   555,
-     133,   902,   555,  -278,  -278,  -278,   160,   161,    90,    90,
-    1506,  1506,  1506,  1506,   -73,  -278,   165,   902,  1506,    -7,
-       7,  -278,  -278,   170,  -278,  -278,    90,  -278,  1506,  -278,
-    -278,  -278,   164,  -278,  -278,   164,  -278,   997,  -278,   555,
-     555,  -278,  -278,   555,   555,   164,   164,  -278,   997,   729,
-    -278,   146,   152,   468,   555,   176,   177,  -278,   178,   159,
-    -278,  -278,  -278,  -278,  -278,   180,  -278,  -278,  -278,  -278,
+    -278,     9,  -278,  -278,   729,  1506,  1506,   555,  -278,   -73,
+    1506,  1506,   -73,   902,   902,   902,   902,   141,   -10,   555,
+     115,   902,   555,  -278,  -278,  -278,   139,   155,    82,    82,
+    1506,  1506,  1506,  1506,   -73,  -278,   154,   902,  1506,    -3,
+      -5,  -278,  -278,   160,  -278,  -278,    82,  -278,  1506,  -278,
+    -278,  -278,   153,  -278,  -278,   153,  -278,   997,  -278,   555,
+     555,  -278,  -278,   555,   555,   153,   153,  -278,   997,   729,
+    -278,   134,   146,   468,   555,   161,   168,  -278,   171,   152,
+    -278,  -278,  -278,  -278,  -278,   176,  -278,  -278,  -278,  -278,
     -278,   729,  -278,   642,  -278,   642,  -278,  -278,   555,  -278,
     -278
 };
@@ -881,11 +881,11 @@ static const yytype_int16 yypact[] =
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -278,  -278,    23,    92,  -278,  -240,     0,  -278,  -278,  -278,
-     -70,  -211,   -93,  -117,  -278,  -278,  -278,  -277,  -126,   -61,
-     -56,  -278,  -278,     1,  -278,  -278,  -278,  -278,   185,   -22,
-    -278,  -278,  -278,  -278,  -278,  -278,  -278,  -217,  -208,  -278,
-     -25,   202
+    -278,  -278,    23,    71,  -278,   -51,     0,  -278,  -278,  -278,
+     -75,  -226,   -97,  -117,  -278,  -278,  -278,  -277,  -126,   -61,
+    -189,  -278,  -278,     1,  -278,  -278,  -278,  -278,   181,   -22,
+    -278,  -278,  -278,  -278,  -278,  -278,  -278,  -211,  -212,  -278,
+     -25,   201
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
@@ -895,35 +895,35 @@ static const yytype_int16 yypgoto[] =
 #define YYTABLE_NINF -7
 static const yytype_int16 yytable[] =
 {
-      48,   184,   116,   186,   263,    65,   252,   100,    66,    67,
-      68,   158,   161,    71,    68,   308,    61,   210,   115,    61,
-      84,   290,   182,    88,    62,    75,   267,   131,   308,    97,
-      84,   110,   103,   104,   105,   106,   107,   108,   223,   293,
-     274,   111,   112,   113,   114,   144,   291,   159,   162,   147,
-     139,   140,   236,   122,   123,   124,    70,   260,    91,    92,
-     294,   285,   244,   152,    76,   142,    80,   117,    82,   320,
-      93,   114,    87,   145,    94,   114,   261,   166,   301,   149,
-      95,   150,   128,   129,   310,   130,   128,   129,   131,   130,
-      96,   336,   131,   160,    61,   310,    89,    90,   101,   109,
-     119,   118,   134,   135,   136,   137,   138,   135,   136,   137,
-     138,   139,   140,   237,   141,   139,   140,    48,   238,   122,
-     185,   187,   181,   182,   241,   143,   193,   194,   195,   196,
+      48,   184,   123,   186,   158,    65,   116,   100,    66,    67,
+      68,   161,   252,    71,    68,   308,   210,   237,   115,    61,
+      84,   182,   238,    88,    62,   290,   267,   293,   308,    97,
+      84,    70,   103,   104,   105,   106,   107,   108,   223,   260,
+     159,   111,   112,   113,   114,   144,   274,   162,   294,   147,
+     291,   259,   236,   122,   262,   124,    61,   285,   261,   131,
+      91,    92,   244,   152,    75,   142,    80,   117,    82,   310,
+      76,   114,    93,   145,   301,   114,   110,   166,    87,   149,
+     310,   150,   139,   140,   275,   128,   129,    94,   130,   182,
+      95,   131,    96,   160,   101,   299,   300,   109,    61,   119,
+     303,   118,   304,    89,    90,   134,   135,   136,   137,   138,
+     181,   182,   313,   314,   139,   140,   143,    48,   151,   122,
+     185,   187,   141,   148,   241,   157,   193,   194,   195,   196,
      197,   198,   199,   200,   201,   202,   203,   204,   205,   206,
-     207,   208,   114,   275,   209,   151,   148,   192,   182,   157,
-     163,   167,   212,   292,   179,   188,   215,   216,   182,   217,
-     218,   211,   221,   222,   214,   225,   224,   240,   309,   226,
-     227,   228,   229,   230,   231,   232,   233,   234,   235,   242,
-     312,   248,   277,   239,   259,   282,   266,   262,   281,   283,
-     245,   319,   246,   287,   298,   331,   293,   333,   276,   321,
-     323,   279,   280,   335,   326,   327,   328,   329,   334,   183,
-     295,   243,   317,   258,    99,    73,     0,   289,     0,     0,
-     250,   251,     0,     0,     0,     0,     0,   302,   299,   300,
-       0,     0,     0,   303,   311,   304,     0,     0,     0,   114,
-       0,     0,   315,   316,   318,   313,   314,     0,     0,     0,
-       0,     0,     0,   325,   270,   271,   272,   273,     0,   330,
+     207,   208,   114,   163,   209,   179,   338,   192,   167,   182,
+     188,   211,   212,   292,   214,   225,   215,   216,   240,   217,
+     218,   242,   221,   222,   277,   248,   224,   281,   309,   226,
+     227,   228,   229,   230,   231,   232,   233,   234,   235,   282,
+     312,   283,   287,   239,   298,   293,   266,   321,   183,   326,
+     245,   319,   246,   263,   323,   331,   327,   333,   276,   328,
+     329,   279,   280,   335,   334,   295,   128,   129,   317,   130,
+      99,   243,   131,   258,    73,     0,     0,   289,     0,     0,
+     250,   251,     0,     0,     0,     0,     0,   302,     0,   137,
+     138,     0,     0,     0,   311,   139,   140,     0,     0,   114,
+       0,     0,   315,   316,   318,     0,     0,     0,     0,     0,
+       0,     0,     0,   325,   270,   271,   272,   273,   320,   330,
        0,   332,   278,   128,   129,     0,   130,     0,     0,   131,
-       0,     0,   268,     0,     0,   269,   339,   340,   288,   338,
-       0,     0,     0,     0,     0,     0,   137,   138,     0,     0,
+       0,     0,   268,     0,     0,   269,   339,   340,   288,     0,
+     336,     0,     0,     0,   135,   136,   137,   138,     0,     0,
        0,     0,   139,   140,    -6,     1,     0,   286,   122,     0,
        0,     0,     0,     0,     0,     2,     3,     4,     5,   122,
        6,     7,     8,     9,    10,     0,    11,    12,    13,    14,
@@ -1060,35 +1060,35 @@ static const yytype_int16 yytable[] =
 
 static const yytype_int16 yycheck[] =
 {
-       0,   118,     0,   120,   244,     4,   223,    29,     7,     8,
-       9,    49,    49,    12,    13,   292,    92,    94,    43,    92,
-      19,    28,    99,    22,     1,    46,    99,    72,   305,    28,
-      29,    93,    31,    32,    33,    34,    35,    36,   164,    32,
-     257,    40,    41,    42,    43,    70,    53,    85,    85,    74,
-      95,    96,   178,    52,    53,    54,    24,    30,    12,    13,
-      53,   269,   188,    85,    24,    64,    41,    44,    43,   309,
-      24,    70,    24,    72,    24,    74,    49,    99,   286,    78,
-      24,    80,    66,    67,   295,    69,    66,    67,    72,    69,
-      24,   331,    72,    92,    92,   306,    51,    52,    24,    24,
-      85,    93,    86,    87,    88,    89,    90,    87,    88,    89,
-      90,    95,    96,    94,    93,    95,    96,   117,    99,   118,
-     119,   120,    98,    99,   185,    99,   125,   126,   127,   128,
+       0,   118,    53,   120,    49,     4,     0,    29,     7,     8,
+       9,    49,   223,    12,    13,   292,    94,    94,    43,    92,
+      19,    99,    99,    22,     1,    28,    99,    32,   305,    28,
+      29,    24,    31,    32,    33,    34,    35,    36,   164,    30,
+      85,    40,    41,    42,    43,    70,   257,    85,    53,    74,
+      53,   240,   178,    52,   243,    54,    92,   269,    49,    72,
+      12,    13,   188,    85,    46,    64,    41,    44,    43,   295,
+      24,    70,    24,    72,   286,    74,    93,    99,    24,    78,
+     306,    80,    95,    96,    94,    66,    67,    24,    69,    99,
+      24,    72,    24,    92,    24,   284,   285,    24,    92,    85,
+     289,    93,   291,    51,    52,    86,    87,    88,    89,    90,
+      98,    99,   301,   302,    95,    96,    99,   117,    41,   118,
+     119,   120,    93,    99,   185,    24,   125,   126,   127,   128,
      129,   130,   131,   132,   133,   134,   135,   136,   137,   138,
-     139,   140,   141,    94,   143,    41,    99,   124,    99,    24,
-      48,    99,   151,   279,    24,    48,   155,   156,    99,   158,
-     159,    24,   161,   162,    24,    24,   165,    94,   294,   168,
-     169,   170,   171,   172,   173,   174,   175,   176,   177,    94,
-     297,    24,    49,   182,   240,    24,   247,   243,    28,    99,
-     189,   308,   191,    28,    24,   321,    32,   323,   259,    53,
-      48,   262,   263,   329,    28,    28,    28,    48,    28,   117,
-     280,   188,   305,   238,    29,    13,    -1,   278,    -1,    -1,
-     219,   220,    -1,    -1,    -1,    -1,    -1,   288,   284,   285,
-      -1,    -1,    -1,   289,   295,   291,    -1,    -1,    -1,   238,
-      -1,    -1,   303,   304,   305,   301,   302,    -1,    -1,    -1,
-      -1,    -1,    -1,   314,   253,   254,   255,   256,    -1,   320,
+     139,   140,   141,    48,   143,    24,   335,   124,    99,    99,
+      48,    24,   151,   279,    24,    24,   155,   156,    94,   158,
+     159,    94,   161,   162,    49,    24,   165,    28,   294,   168,
+     169,   170,   171,   172,   173,   174,   175,   176,   177,    24,
+     297,    99,    28,   182,    24,    32,   247,    53,   117,    28,
+     189,   308,   191,   244,    48,   321,    28,   323,   259,    28,
+      48,   262,   263,   329,    28,   280,    66,    67,   305,    69,
+      29,   188,    72,   238,    13,    -1,    -1,   278,    -1,    -1,
+     219,   220,    -1,    -1,    -1,    -1,    -1,   288,    -1,    89,
+      90,    -1,    -1,    -1,   295,    95,    96,    -1,    -1,   238,
+      -1,    -1,   303,   304,   305,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   314,   253,   254,   255,   256,   309,   320,
       -1,   322,   261,    66,    67,    -1,    69,    -1,    -1,    72,
-      -1,    -1,   249,    -1,    -1,   252,   337,   338,   277,   335,
-      -1,    -1,    -1,    -1,    -1,    -1,    89,    90,    -1,    -1,
+      -1,    -1,   249,    -1,    -1,   252,   337,   338,   277,    -1,
+     331,    -1,    -1,    -1,    87,    88,    89,    90,    -1,    -1,
       -1,    -1,    95,    96,     0,     1,    -1,   274,   297,    -1,
       -1,    -1,    -1,    -1,    -1,    11,    12,    13,    14,   308,
       16,    17,    18,    19,    20,    -1,    22,    23,    24,    25,
@@ -1239,7 +1239,7 @@ static const yytype_uint8 yystos[] =
       52,    12,    13,    24,    24,    24,    24,   123,    58,   128,
      129,    24,   126,   123,   123,   123,   123,   123,   123,    24,
       93,   123,   123,   123,   123,   140,     0,   102,    93,    85,
-      93,   113,   123,   123,   123,    60,    61,    65,    66,    67,
+      93,   113,   123,   105,   123,    60,    61,    65,    66,    67,
       69,    72,    73,    74,    86,    87,    88,    89,    90,    95,
       96,    93,   123,    99,   140,   123,   140,   140,    99,   123,
      123,    41,   129,   133,    38,    70,    71,    24,    49,    85,
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 39cb8a2..f20c4e8 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -240,7 +240,7 @@ stmt: stmtoneliner
 		(*g_lingo->_currentScript)[$1 + 5] = end;	/* end, if cond fails */
 
 		checkEnd($11, "repeat", true); }
-	| when expr end {
+	| when stmtoneliner end {
 			inst end = 0;
 			WRITE_UINT32(&end, $3);
 			g_lingo->code1(STOP);


Commit: 296dac6bc278400e3d17b4596de8e10f515c07f1
    https://github.com/scummvm/scummvm/commit/296dac6bc278400e3d17b4596de8e10f515c07f1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-08T17:30:17+01:00

Commit Message:
DIRECTOR: Lingo: Switched Symbol::name to Common::String

Changed paths:
    engines/director/lingo/lingo-builtins.cpp
    engines/director/lingo/lingo-code.cpp
    engines/director/lingo/lingo-codegen.cpp
    engines/director/lingo/lingo.cpp
    engines/director/lingo/lingo.h


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 40a6e91..2005aa1 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -254,8 +254,7 @@ void Lingo::initBuiltIns() {
 	for (BuiltinProto *blt = builtins; blt->name; blt++) {
 		Symbol *sym = new Symbol;
 
-		sym->name = (char *)calloc(strlen(blt->name) + 1, 1);
-		Common::strlcpy(sym->name, blt->name, strlen(blt->name));
+		sym->name = blt->name;
 		sym->type = BLTIN;
 		sym->nargs = blt->minArgs;
 		sym->maxArgs = blt->maxArgs;
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 7046fed..9e73717 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -170,8 +170,8 @@ void Lingo::c_printtop(void) {
 		if (!d.u.sym) {
 			warning("Inconsistent stack: var, val: %d", d.u.i);
 		} else {
-			if (d.u.sym->name)
-				warning("var: %s", d.u.sym->name);
+			if (!d.u.sym->name.empty())
+				warning("var: %s", d.u.sym->name.c_str());
 			else
 				warning("Nameless var. val: %d", d.u.sym->u.i);
 		}
@@ -305,7 +305,7 @@ void Lingo::c_assign() {
 
 	if (d1.u.sym->type != INT && d1.u.sym->type != VOID &&
 			d1.u.sym->type != FLOAT && d1.u.sym->type != STRING) {
-		warning("assignment to non-variable '%s'", d1.u.sym->name);
+		warning("assignment to non-variable '%s'", d1.u.sym->name.c_str());
 		return;
 	}
 
@@ -341,13 +341,13 @@ void Lingo::c_assign() {
 
 bool Lingo::verify(Symbol *s) {
 	if (s->type != INT && s->type != VOID && s->type != FLOAT && s->type != STRING && s->type != POINT) {
-		warning("attempt to evaluate non-variable '%s'", s->name);
+		warning("attempt to evaluate non-variable '%s'", s->name.c_str());
 
 		return false;
 	}
 
 	if (s->type == VOID)
-		warning("Variable used before assigning a value '%s'", s->name);
+		warning("Variable used before assigning a value '%s'", s->name.c_str());
 
 	return true;
 }
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 32d0bbb..dccb95e 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -170,8 +170,7 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) {
 			return NULL;
 
 		sym = new Symbol;
-		sym->name = (char *)calloc(strlen(name) + 1, 1);
-		Common::strlcpy(sym->name, name, strlen(name) + 1);
+		sym->name = name;
 		sym->type = VOID;
 		sym->u.i = 0;
 
@@ -198,7 +197,6 @@ void Lingo::cleanLocalVars() {
 	for (SymbolHash::const_iterator h = _localvars->begin(); h != _localvars->end(); ++h) {
 		if (!h->_value->global) {
 			Symbol *sym = h->_value;
-			free(sym->name);
 			delete sym;
 		}
 	}
@@ -218,8 +216,7 @@ void Lingo::define(Common::String &name, int start, int nargs, Common::String *p
 	if (sym == NULL) { // Create variable if it was not defined
 		sym = new Symbol;
 
-		sym->name = (char *)calloc(name.size() + 1, 1);
-		Common::strlcpy(sym->name, name.c_str(), name.size() + 1);
+		sym->name = name;
 		sym->type = HANDLER;
 
 		_handlers[ENTITY_INDEX(_eventHandlerTypeIds[name.c_str()], _currentEntityId)] = sym;
@@ -388,8 +385,7 @@ void Lingo::codeFactory(Common::String &name) {
 
 	Symbol *sym = new Symbol;
 
-	sym->name = (char *)calloc(name.size() + 1, 1);
-	Common::strlcpy(sym->name, name.c_str(), name.size());
+	sym->name = name;
 	sym->type = BLTIN;
 	sym->nargs = -1;
 	sym->maxArgs = 0;
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index f7eafda..9a92d2f 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -75,7 +75,6 @@ struct EventHandlerType {
 };
 
 Symbol::Symbol() {
-	name = NULL;
 	type = VOID;
 	u.s = NULL;
 	nargs = 0;
@@ -395,7 +394,7 @@ Common::String *Datum::toString() {
 		*s = "#void";
 		break;
 	case VAR:
-		*s = Common::String::format("var: #%s", u.sym->name);
+		*s = Common::String::format("var: #%s", u.sym->name.c_str());
 		break;
 	default:
 		warning("Incorrect operation toString() for type: %s", type2str());
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index afadef7..66f3d3a 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -104,7 +104,7 @@ struct Pointer_Hash {
 typedef Common::HashMap<void *, FuncDesc *, Pointer_Hash, Pointer_EqualTo> FuncHash;
 
 struct Symbol {	/* symbol table entry */
-	char *name;
+	Common::String name;
 	int type;
 	union {
 		int		i;			/* VAR */





More information about the Scummvm-git-logs mailing list