SA-MP Forums Archive
Constant Warning... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Constant Warning... (/showthread.php?tid=571603)



Constant Warning... - Prokill911 - 20.04.2015

Hey, so I decided to try an update the SQL plugin..

But keeps spamming me with this warning

Код:
warning 224: indeterminate array size in "sizeof" expres sion (symbol "max_len")
Код:
ValidateLogin(playerid, inputtext[]) {
	query[0] = 0;//[256];
	mysql_escape_string(inputtext, inputtext);
	if(GetPVarInt(playerid, "SecurePass")) {
		format(query, sizeof(query),"");
	} else {
		format(query, sizeof(query),"");
	}
	mysql_function_query(g_mysql_handle, query, true, "OnLoginAttempt", "d", playerid);
}
case EAccountDialog_EnterPassword: {
			if(!response) {
				SendClientMessage(playerid, X11_RED2, "Incorrect answer, try again.");
				SetTimerEx("TimedKick",1000, false, "d",playerid);
			} else {
				ValidateLogin(playerid, inputtext);
			}
		}
Anyone have ANY clue how to fix this..


Re: Constant Warning... - Sithis - 20.04.2015

Well guess what, query[0] is giving you this warning. Set a proper size.


Re: Constant Warning... - Misiur - 20.04.2015

Nope. You're using sizeof on inputtext, and that's a bad thing.
pawn Код:
mysql_escape_string(inputtext, inputtext);
https://sampwiki.blast.hk/wiki/MySQL/R33..._escape_string 4th argument

Either create a new string, or pass strlen as 4th argument of that function.