OSDN Git Service

- Do not allow scripts to be named "None".
authorRandy Heit <rheit@zdoom.fake>
Sun, 26 Feb 2012 02:37:44 +0000 (02:37 +0000)
committerRandy Heit <rheit@zdoom.fake>
Sun, 26 Feb 2012 02:37:44 +0000 (02:37 +0000)
SVN r3391 (trunk)

error.c
error.h
misc.h
parse.c
strlist.c

diff --git a/error.c b/error.c
index 7178403..f42510c 100644 (file)
--- a/error.c
+++ b/error.c
@@ -177,6 +177,7 @@ static struct
        { ERR_UNCLOSED_WITH_ARGS, "Most special scripts must not have arguments." },\r
        { ERR_NOT_A_CHAR_ARRAY, "%s has %d dimensions. Use %d subscripts to get a char array." },\r
        { ERR_CANT_FIND_INCLUDE, "Couldn't find include file \"%s\"." },\r
+       { ERR_SCRIPT_NAMED_NONE, "Scripts may not be named \"None\"." },\r
        { ERR_NONE, NULL }\r
 };\r
 \r
diff --git a/error.h b/error.h
index abd800a..6e32127 100644 (file)
--- a/error.h
+++ b/error.h
@@ -144,7 +144,8 @@ typedef enum
        ERR_DISCONNECT_NEEDS_1_ARG,\r
        ERR_UNCLOSED_WITH_ARGS,\r
        ERR_NOT_A_CHAR_ARRAY,\r
-       ERR_CANT_FIND_INCLUDE\r
+       ERR_CANT_FIND_INCLUDE,\r
+       ERR_SCRIPT_NAMED_NONE,\r
 } error_t;\r
 \r
 // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------\r
diff --git a/misc.h b/misc.h
index 29c1e82..2c54035 100644 (file)
--- a/misc.h
+++ b/misc.h
 \r
 // MACROS ------------------------------------------------------------------\r
 \r
+#ifdef _WIN32\r
+#define strcasecmp stricmp\r
+#endif\r
+\r
 // TYPES -------------------------------------------------------------------\r
 \r
 typedef enum\r
diff --git a/parse.c b/parse.c
index ca0bfac..761efc2 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -560,6 +560,10 @@ static void OuterScript(void)
        }\r
        else if(tk_Token == TK_STRING)\r
        { // Named scripts start counting at -1 and go down from there.\r
+               if(strcasecmp("None", tk_String) == 0)\r
+               {\r
+                       ERR_Error(ERR_SCRIPT_NAMED_NONE, YES, NULL);\r
+               }\r
                scriptNumber = -1 - STR_FindInListInsensitive(STRLIST_NAMEDSCRIPTS, tk_String);\r
                TK_NextToken();\r
        }\r
index 48188cb..6a86cb8 100644 (file)
--- a/strlist.c
+++ b/strlist.c
 \r
 // MACROS ------------------------------------------------------------------\r
 \r
-#ifdef _WIN32\r
-#define strcasecmp stricmp\r
-#endif\r
-\r
 // TYPES -------------------------------------------------------------------\r
 \r
 typedef struct\r