Fixed some bugs/warnings that GCC caught
This commit is contained in:
		@@ -65,7 +65,10 @@ int HashFunction<String>(const String &k)
 | 
				
			|||||||
	unsigned long hash = 5381;
 | 
						unsigned long hash = 5381;
 | 
				
			||||||
	register const char *str = k.c_str();
 | 
						register const char *str = k.c_str();
 | 
				
			||||||
	register char c;
 | 
						register char c;
 | 
				
			||||||
	while (c = *str++) hash = ((hash << 5) + hash) + c; // hash*33 + c
 | 
						while ((c = *str++)) 
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							hash = ((hash << 5) + hash) + c; // hash*33 + c
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return hash;
 | 
						return hash;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -75,7 +78,10 @@ int HashAlt<const char *>(char const * const &k)
 | 
				
			|||||||
	unsigned long hash = 5381;
 | 
						unsigned long hash = 5381;
 | 
				
			||||||
	register const char *str = k;
 | 
						register const char *str = k;
 | 
				
			||||||
	register char c;
 | 
						register char c;
 | 
				
			||||||
	while (c = *str++) hash = ((hash << 5) + hash) + c; // hash*33 + c
 | 
						while ((c = *str++)) 
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							hash = ((hash << 5) + hash) + c; // hash*33 + c
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return hash;
 | 
						return hash;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -353,7 +359,7 @@ int CLangMngr::MergeDefinitionFile(const char *file)
 | 
				
			|||||||
	CQueue<sKeyDef> Defq;
 | 
						CQueue<sKeyDef> Defq;
 | 
				
			||||||
	String buf;
 | 
						String buf;
 | 
				
			||||||
	char language[3];
 | 
						char language[3];
 | 
				
			||||||
	sKeyDef tmpEntry;
 | 
						sKeyDef tmpEntry = {NULL, 0};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while (!feof(fp))
 | 
						while (!feof(fp))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -570,7 +576,7 @@ bool CLangMngr::LangExists(const char *langName)
 | 
				
			|||||||
	char buf[3] = {0};
 | 
						char buf[3] = {0};
 | 
				
			||||||
	int i = 0;
 | 
						int i = 0;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	while (buf[i] = tolower(*langName++))
 | 
						while ((buf[i] = tolower(*langName++)))
 | 
				
			||||||
	{	
 | 
						{	
 | 
				
			||||||
		if (++i == 2)
 | 
							if (++i == 2)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3258,8 +3258,6 @@ static cell AMX_NATIVE_CALL callfunc_end(AMX *amx, cell *params)
 | 
				
			|||||||
// native callfunc_push_float(Float: value);
 | 
					// native callfunc_push_float(Float: value);
 | 
				
			||||||
static cell AMX_NATIVE_CALL callfunc_push_byval(AMX *amx, cell *params)
 | 
					static cell AMX_NATIVE_CALL callfunc_push_byval(AMX *amx, cell *params)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if (!g_CallFunc_Plugin)
 | 
						if (!g_CallFunc_Plugin)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// scripter's fault
 | 
							// scripter's fault
 | 
				
			||||||
@@ -3339,8 +3337,6 @@ static cell AMX_NATIVE_CALL callfunc_push_byref(AMX *amx, cell *params)
 | 
				
			|||||||
// native callfunc_push_str(value[]);
 | 
					// native callfunc_push_str(value[]);
 | 
				
			||||||
static cell AMX_NATIVE_CALL callfunc_push_str(AMX *amx, cell *params)
 | 
					static cell AMX_NATIVE_CALL callfunc_push_str(AMX *amx, cell *params)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if (!g_CallFunc_Plugin)
 | 
						if (!g_CallFunc_Plugin)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// scripter's fault
 | 
							// scripter's fault
 | 
				
			||||||
@@ -3500,7 +3496,9 @@ static cell AMX_NATIVE_CALL int3(AMX *amx, cell *params)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/*********************************************************************/
 | 
					/*********************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined AMD64
 | 
				
			||||||
static bool g_warned_ccqv = false;
 | 
					static bool g_warned_ccqv = false;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
// native query_client_cvar(id, const cvar[], const resultfunc[])
 | 
					// native query_client_cvar(id, const cvar[], const resultfunc[])
 | 
				
			||||||
static cell AMX_NATIVE_CALL query_client_cvar(AMX *amx, cell *params)
 | 
					static cell AMX_NATIVE_CALL query_client_cvar(AMX *amx, cell *params)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -3735,7 +3733,6 @@ static cell AMX_NATIVE_CALL PrepareArray(AMX *amx, cell *params)
 | 
				
			|||||||
static cell AMX_NATIVE_CALL ExecuteForward(AMX *amx, cell *params)
 | 
					static cell AMX_NATIVE_CALL ExecuteForward(AMX *amx, cell *params)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int id = static_cast<int>(params[1]);
 | 
						int id = static_cast<int>(params[1]);
 | 
				
			||||||
	int str_id = 0;
 | 
					 | 
				
			||||||
	int len, err;
 | 
						int len, err;
 | 
				
			||||||
	cell *addr = get_amxaddr(amx, params[2]);
 | 
						cell *addr = get_amxaddr(amx, params[2]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -3829,7 +3826,7 @@ void CheckAndClearPlayerHUD(CPlayer *player, int &channel, unsigned int sync_obj
 | 
				
			|||||||
	//get the last channel this message class was displayed on.
 | 
						//get the last channel this message class was displayed on.
 | 
				
			||||||
	cell last_channel = plist[player->index];
 | 
						cell last_channel = plist[player->index];
 | 
				
			||||||
	//check if the last sync on this channel was this sync obj
 | 
						//check if the last sync on this channel was this sync obj
 | 
				
			||||||
	if (player->hudmap[last_channel] == sync_obj + 1)
 | 
						if ((unsigned int)player->hudmap[last_channel] == sync_obj + 1)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		//if so, we can safely REUSE it
 | 
							//if so, we can safely REUSE it
 | 
				
			||||||
		channel = (int)last_channel;
 | 
							channel = (int)last_channel;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,7 +50,7 @@ public:
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		struct trace_info
 | 
							struct trace_info
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			trace_info() : cip(0), frm(0), used(false), next(NULL), prev(NULL) {};
 | 
								trace_info() : cip(0), frm(0), next(NULL), prev(NULL), used(false) {};
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			cell cip;
 | 
								cell cip;
 | 
				
			||||||
			cell frm;
 | 
								cell frm;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -358,7 +358,7 @@ static cell AMX_NATIVE_CALL file_size(AMX *amx, cell *params) /* 1 param */
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static cell AMX_NATIVE_CALL amx_fopen(AMX *amx, cell *params)
 | 
					static cell AMX_NATIVE_CALL amx_fopen(AMX *amx, cell *params)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int len, j = -1;
 | 
						int len;
 | 
				
			||||||
	char *file = build_pathname("%s", get_amxstring(amx, params[1], 1, len));
 | 
						char *file = build_pathname("%s", get_amxstring(amx, params[1], 1, len));
 | 
				
			||||||
	char *flags = get_amxstring(amx, params[2], 0, len);
 | 
						char *flags = get_amxstring(amx, params[2], 0, len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -383,7 +383,6 @@ static cell AMX_NATIVE_CALL amx_fwrite_blocks(AMX *amx, cell *params)
 | 
				
			|||||||
	case 1:
 | 
						case 1:
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			char *a = new char[blocks];
 | 
								char *a = new char[blocks];
 | 
				
			||||||
			char *ptr = a;
 | 
					 | 
				
			||||||
			while (btmp--)
 | 
								while (btmp--)
 | 
				
			||||||
				*a++ = static_cast<char>(*addr++);
 | 
									*a++ = static_cast<char>(*addr++);
 | 
				
			||||||
			size_t res = fwrite(a, sizeof(char), blocks, fp);
 | 
								size_t res = fwrite(a, sizeof(char), blocks, fp);
 | 
				
			||||||
@@ -393,7 +392,6 @@ static cell AMX_NATIVE_CALL amx_fwrite_blocks(AMX *amx, cell *params)
 | 
				
			|||||||
	case 2:
 | 
						case 2:
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			short *a = new short[blocks];
 | 
								short *a = new short[blocks];
 | 
				
			||||||
			short *ptr = a;
 | 
					 | 
				
			||||||
			while (btmp--)
 | 
								while (btmp--)
 | 
				
			||||||
				*a++ = static_cast<short>(*addr++);
 | 
									*a++ = static_cast<short>(*addr++);
 | 
				
			||||||
			size_t res = fwrite(a, sizeof(short), blocks, fp);
 | 
								size_t res = fwrite(a, sizeof(short), blocks, fp);
 | 
				
			||||||
@@ -403,7 +401,6 @@ static cell AMX_NATIVE_CALL amx_fwrite_blocks(AMX *amx, cell *params)
 | 
				
			|||||||
	case 4:
 | 
						case 4:
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			int *a = new int[blocks];
 | 
								int *a = new int[blocks];
 | 
				
			||||||
			int *ptr = a;
 | 
					 | 
				
			||||||
			while (btmp--)
 | 
								while (btmp--)
 | 
				
			||||||
				*a++ = static_cast<int>(*addr++);
 | 
									*a++ = static_cast<int>(*addr++);
 | 
				
			||||||
			size_t res = fwrite(a, sizeof(int), blocks, fp);
 | 
								size_t res = fwrite(a, sizeof(int), blocks, fp);
 | 
				
			||||||
@@ -682,13 +679,13 @@ static cell AMX_NATIVE_CALL amx_open_dir(AMX *amx, cell *params)
 | 
				
			|||||||
	DIR *dp = opendir(dirname);
 | 
						DIR *dp = opendir(dirname);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (!dp)
 | 
						if (!dp)
 | 
				
			||||||
		return NULL;
 | 
							return 0;
 | 
				
			||||||
	struct dirent *ep = readdir(dp);
 | 
						struct dirent *ep = readdir(dp);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (!ep)
 | 
						if (!ep)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		closedir(dp);
 | 
							closedir(dp);
 | 
				
			||||||
		return NULL;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	set_amxstring(amx, params[2], ep->d_name, params[3]);
 | 
						set_amxstring(amx, params[2], ep->d_name, params[3]);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -184,7 +184,7 @@ LibError RunLibCommand(const LibDecoder *enc)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if ( (enc->cmd == LibCmd_ReqLib) || (enc->cmd == LibCmd_ReqClass) )
 | 
						if ( (enc->cmd == LibCmd_ReqLib) || (enc->cmd == LibCmd_ReqClass) )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		LibType expect;
 | 
							LibType expect = LibType_Library;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (enc->cmd == LibCmd_ReqLib)
 | 
							if (enc->cmd == LibCmd_ReqLib)
 | 
				
			||||||
			expect = LibType_Library;
 | 
								expect = LibType_Library;
 | 
				
			||||||
@@ -202,7 +202,7 @@ LibError RunLibCommand(const LibDecoder *enc)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		if (expect == LibType_Library)
 | 
							if (expect == LibType_Library)
 | 
				
			||||||
			return LibErr_NoLibrary;
 | 
								return LibErr_NoLibrary;
 | 
				
			||||||
		else if (expect = LibType_Class)
 | 
							else if (expect == LibType_Class)
 | 
				
			||||||
			return LibErr_NoClass;
 | 
								return LibErr_NoClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return LibErr_NoLibrary;
 | 
							return LibErr_NoLibrary;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -313,7 +313,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
 | 
				
			|||||||
		//set this again because amx_Init() erases it!
 | 
							//set this again because amx_Init() erases it!
 | 
				
			||||||
		amx->flags |= AMX_FLAG_JITC;
 | 
							amx->flags |= AMX_FLAG_JITC;
 | 
				
			||||||
		amx->flags &= (~AMX_FLAG_DEBUG);
 | 
							amx->flags &= (~AMX_FLAG_DEBUG);
 | 
				
			||||||
		amx->sysreq_d = NULL;
 | 
							amx->sysreq_d = 0;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -253,7 +253,6 @@ void amx_command()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void plugin_srvcmd()
 | 
					void plugin_srvcmd()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	cell ret = 0;
 | 
					 | 
				
			||||||
	const char* cmd = CMD_ARGV(0);
 | 
						const char* cmd = CMD_ARGV(0);
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
	CmdMngr::iterator a = g_commands.srvcmdbegin();
 | 
						CmdMngr::iterator a = g_commands.srvcmdbegin();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -863,7 +863,6 @@ static cell AMX_NATIVE_CALL is_alpha(AMX *amx, cell *params)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static cell AMX_NATIVE_CALL amx_ucfirst(AMX *amx, cell *params)
 | 
					static cell AMX_NATIVE_CALL amx_ucfirst(AMX *amx, cell *params)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int len = 0;
 | 
					 | 
				
			||||||
	cell *str = get_amxaddr(amx, params[1]);
 | 
						cell *str = get_amxaddr(amx, params[1]);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (!isalpha((char)str[0]) || !(str[0] & (1<<5)))
 | 
						if (!isalpha((char)str[0]) || !(str[0] & (1<<5)))
 | 
				
			||||||
@@ -944,7 +943,6 @@ static cell AMX_NATIVE_CALL n_strfind(AMX *amx, cell *params)
 | 
				
			|||||||
	int sublen;
 | 
						int sublen;
 | 
				
			||||||
	char *sub = get_amxstring(amx, params[2], 1, sublen);
 | 
						char *sub = get_amxstring(amx, params[2], 1, sublen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool found = false;
 | 
					 | 
				
			||||||
	bool igcase = params[3] ? true : false;
 | 
						bool igcase = params[3] ? true : false;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (igcase)
 | 
						if (igcase)
 | 
				
			||||||
@@ -964,7 +962,6 @@ static cell AMX_NATIVE_CALL n_strfind(AMX *amx, cell *params)
 | 
				
			|||||||
	if (params[4] > len)
 | 
						if (params[4] > len)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	char *pos = &(str[params[4]]);
 | 
					 | 
				
			||||||
	char *find = strstr(str, sub);
 | 
						char *find = strstr(str, sub);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!find)
 | 
						if (!find)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user