From 79a42a6d5e951826cefb84a7d03850a4ac3886a5 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 25 Apr 2012 16:52:51 +0200 Subject: [PATCH] fix some more use of uninitialized locals; fix matchacl --- qcsrc/common/command/generic.qc | 2 ++ qcsrc/common/util.qc | 6 +++++- qcsrc/menu/item/nexposee.c | 2 ++ qcsrc/menu/xonotic/languagelist.c | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index 73fe45c40..eaa44b381 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -263,6 +263,7 @@ void GenericCommand_maplist(float request, float argc) MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0); argc = tokenizebyseparator(cvar_string("g_maplist"), " "); + tmp_string = ""; for(i = 0; i < argc; ++i) if(MapInfo_CheckMap(argv(i))) tmp_string = strcat(tmp_string, " ", argv(i)); @@ -279,6 +280,7 @@ void GenericCommand_maplist(float request, float argc) { argc = tokenizebyseparator(cvar_string("g_maplist"), " "); + tmp_string = ""; for(i = 0; i < argc; ++i) if(argv(i) != argv(2)) tmp_string = strcat(tmp_string, " ", argv(i)); diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 582777647..a1e059589 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -859,6 +859,8 @@ float cvar_settemp(string tmp_cvar, string tmp_value) { float created_saved_value; entity e; + + created_saved_value = FALSE; if not(tmp_cvar || tmp_value) { @@ -1825,6 +1827,7 @@ float matchacl(string acl, string str) while(acl) { t = car(acl); acl = cdr(acl); + d = 1; if(substring(t, 0, 1) == "-") { @@ -1833,10 +1836,11 @@ float matchacl(string acl, string str) } else if(substring(t, 0, 1) == "+") t = substring(t, 1, strlen(t) - 1); + if(substring(t, -1, 1) == "*") { t = substring(t, 0, strlen(t) - 1); - s = substring(s, 0, strlen(t)); + s = substring(str, 0, strlen(t)); } else s = str; diff --git a/qcsrc/menu/item/nexposee.c b/qcsrc/menu/item/nexposee.c index 02f122425..8f8f45119 100644 --- a/qcsrc/menu/item/nexposee.c +++ b/qcsrc/menu/item/nexposee.c @@ -305,6 +305,7 @@ float Nexposee_keyDown(entity me, float scan, float ascii, float shift) } switch(me.animationState) { + default: case 0: case 3: nexposeeKey = ((scan == K_SPACE) || (scan == K_ENTER) || (scan == K_KP_ENTER)); @@ -318,6 +319,7 @@ float Nexposee_keyDown(entity me, float scan, float ascii, float shift) { switch(me.animationState) { + default: case 0: case 3: me.animationState = 1; diff --git a/qcsrc/menu/xonotic/languagelist.c b/qcsrc/menu/xonotic/languagelist.c index 5f6226f49..5be639a07 100644 --- a/qcsrc/menu/xonotic/languagelist.c +++ b/qcsrc/menu/xonotic/languagelist.c @@ -153,6 +153,7 @@ void XonoticLanguageList_getLanguages(entity me) buf = buf_create(); fh = fopen("languages.txt", FILE_READ); + i = 0; while((s = fgets(fh))) { n = tokenize_console(s); -- 2.39.2