Increased map name buffer sizes in mapchooser (bug 5609, r=psychonic).

This commit is contained in:
Peace-Maker 2013-03-16 23:17:22 -04:00
parent 5951cbf7b9
commit ca1e9a2976

View File

@ -117,7 +117,7 @@ public OnPluginStart()
LoadTranslations("mapchooser.phrases"); LoadTranslations("mapchooser.phrases");
LoadTranslations("common.phrases"); LoadTranslations("common.phrases");
new arraySize = ByteCountToCells(33); new arraySize = ByteCountToCells(PLATFORM_MAX_PATH);
g_MapList = CreateArray(arraySize); g_MapList = CreateArray(arraySize);
g_NominateList = CreateArray(arraySize); g_NominateList = CreateArray(arraySize);
g_NominateOwners = CreateArray(1); g_NominateOwners = CreateArray(1);
@ -259,7 +259,7 @@ public OnMapEnd()
g_VoteTimer = INVALID_HANDLE; g_VoteTimer = INVALID_HANDLE;
g_RetryTimer = INVALID_HANDLE; g_RetryTimer = INVALID_HANDLE;
decl String:map[32]; decl String:map[PLATFORM_MAX_PATH];
GetCurrentMap(map, sizeof(map)); GetCurrentMap(map, sizeof(map));
PushArrayString(g_OldMapList, map); PushArrayString(g_OldMapList, map);
@ -278,7 +278,7 @@ public OnClientDisconnect(client)
return; return;
} }
new String:oldmap[33]; new String:oldmap[PLATFORM_MAX_PATH];
GetArrayString(g_NominateList, index, oldmap, sizeof(oldmap)); GetArrayString(g_NominateList, index, oldmap, sizeof(oldmap));
Call_StartForward(g_NominationsResetForward); Call_StartForward(g_NominationsResetForward);
Call_PushString(oldmap); Call_PushString(oldmap);
@ -298,7 +298,7 @@ public Action:Command_SetNextmap(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:map[64]; decl String:map[PLATFORM_MAX_PATH];
GetCmdArg(1, map, sizeof(map)); GetCmdArg(1, map, sizeof(map));
if (!IsMapValid(map)) if (!IsMapValid(map))
@ -585,7 +585,7 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
* like sm_mapvote from the adminmenu in the future. * like sm_mapvote from the adminmenu in the future.
*/ */
decl String:map[32]; decl String:map[PLATFORM_MAX_PATH];
/* No input given - User our internal nominations and maplist */ /* No input given - User our internal nominations and maplist */
if (inputlist == INVALID_HANDLE) if (inputlist == INVALID_HANDLE)
@ -690,7 +690,7 @@ public Handler_VoteFinishedGeneric(Handle:menu,
num_items, num_items,
const item_info[][2]) const item_info[][2])
{ {
decl String:map[32]; decl String:map[PLATFORM_MAX_PATH];
GetMenuItem(menu, item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map)); GetMenuItem(menu, item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map));
if (strcmp(map, VOTE_EXTEND, false) == 0) if (strcmp(map, VOTE_EXTEND, false) == 0)
@ -797,9 +797,9 @@ public Handler_MapVoteFinished(Handle:menu,
SetMenuTitle(g_VoteMenu, "Runoff Vote Nextmap"); SetMenuTitle(g_VoteMenu, "Runoff Vote Nextmap");
SetVoteResultCallback(g_VoteMenu, Handler_VoteFinishedGeneric); SetVoteResultCallback(g_VoteMenu, Handler_VoteFinishedGeneric);
decl String:map[32]; decl String:map[PLATFORM_MAX_PATH];
decl String:info1[32]; decl String:info1[PLATFORM_MAX_PATH];
decl String:info2[32]; decl String:info2[PLATFORM_MAX_PATH];
GetMenuItem(menu, item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, info1, sizeof(info1)); GetMenuItem(menu, item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, info1, sizeof(info1));
AddMenuItem(g_VoteMenu, map, info1); AddMenuItem(g_VoteMenu, map, info1);
@ -848,7 +848,7 @@ public Handler_MapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
{ {
if (GetMenuItemCount(menu) - 1 == param2) if (GetMenuItemCount(menu) - 1 == param2)
{ {
decl String:map[64], String:buffer[255]; decl String:map[PLATFORM_MAX_PATH], String:buffer[255];
GetMenuItem(menu, param2, map, sizeof(map)); GetMenuItem(menu, param2, map, sizeof(map));
if (strcmp(map, VOTE_EXTEND, false) == 0) if (strcmp(map, VOTE_EXTEND, false) == 0)
{ {
@ -870,7 +870,7 @@ public Handler_MapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
{ {
new count = GetMenuItemCount(menu); new count = GetMenuItemCount(menu);
new item = GetRandomInt(0, count - 1); new item = GetRandomInt(0, count - 1);
decl String:map[32]; decl String:map[PLATFORM_MAX_PATH];
GetMenuItem(menu, item, map, sizeof(map)); GetMenuItem(menu, item, map, sizeof(map));
while (strcmp(map, VOTE_EXTEND, false) == 0) while (strcmp(map, VOTE_EXTEND, false) == 0)
@ -898,7 +898,7 @@ public Action:Timer_ChangeMap(Handle:hTimer, Handle:dp)
{ {
g_ChangeMapInProgress = false; g_ChangeMapInProgress = false;
new String:map[65]; new String:map[PLATFORM_MAX_PATH];
if (dp == INVALID_HANDLE) if (dp == INVALID_HANDLE)
{ {
@ -936,7 +936,7 @@ CreateNextVote()
assert(g_NextMapList) assert(g_NextMapList)
ClearArray(g_NextMapList); ClearArray(g_NextMapList);
decl String:map[32]; decl String:map[PLATFORM_MAX_PATH];
new Handle:tempMaps = CloneArray(g_MapList); new Handle:tempMaps = CloneArray(g_MapList);
GetCurrentMap(map, sizeof(map)); GetCurrentMap(map, sizeof(map));
@ -985,7 +985,7 @@ NominateResult:InternalNominateMap(String:map[], bool:force, owner)
/* Look to replace an existing nomination by this client - Nominations made with owner = 0 aren't replaced */ /* Look to replace an existing nomination by this client - Nominations made with owner = 0 aren't replaced */
if (owner && ((index = FindValueInArray(g_NominateOwners, owner)) != -1)) if (owner && ((index = FindValueInArray(g_NominateOwners, owner)) != -1))
{ {
new String:oldmap[33]; new String:oldmap[PLATFORM_MAX_PATH];
GetArrayString(g_NominateList, index, oldmap, sizeof(oldmap)); GetArrayString(g_NominateList, index, oldmap, sizeof(oldmap));
Call_StartForward(g_NominationsResetForward); Call_StartForward(g_NominationsResetForward);
Call_PushString(oldmap); Call_PushString(oldmap);
@ -1015,7 +1015,7 @@ NominateResult:InternalNominateMap(String:map[], bool:force, owner)
while (GetArraySize(g_NominateList) > GetConVarInt(g_Cvar_IncludeMaps)) while (GetArraySize(g_NominateList) > GetConVarInt(g_Cvar_IncludeMaps))
{ {
new String:oldmap[33]; new String:oldmap[PLATFORM_MAX_PATH];
GetArrayString(g_NominateList, 0, oldmap, sizeof(oldmap)); GetArrayString(g_NominateList, 0, oldmap, sizeof(oldmap));
Call_StartForward(g_NominationsResetForward); Call_StartForward(g_NominationsResetForward);
Call_PushString(oldmap); Call_PushString(oldmap);
@ -1052,7 +1052,7 @@ bool:InternalRemoveNominationByMap(String:map[])
{ {
for (new i = 0; i < GetArraySize(g_NominateList); i++) for (new i = 0; i < GetArraySize(g_NominateList); i++)
{ {
new String:oldmap[33]; new String:oldmap[PLATFORM_MAX_PATH];
GetArrayString(g_NominateList, i, oldmap, sizeof(oldmap)); GetArrayString(g_NominateList, i, oldmap, sizeof(oldmap));
if(strcmp(map, oldmap, false) == 0) if(strcmp(map, oldmap, false) == 0)
@ -1096,7 +1096,7 @@ bool:InternalRemoveNominationByOwner(owner)
if (owner && ((index = FindValueInArray(g_NominateOwners, owner)) != -1)) if (owner && ((index = FindValueInArray(g_NominateOwners, owner)) != -1))
{ {
new String:oldmap[33]; new String:oldmap[PLATFORM_MAX_PATH];
GetArrayString(g_NominateList, index, oldmap, sizeof(oldmap)); GetArrayString(g_NominateList, index, oldmap, sizeof(oldmap));
Call_StartForward(g_NominationsResetForward); Call_StartForward(g_NominationsResetForward);
@ -1154,7 +1154,7 @@ public Native_GetExcludeMapList(Handle:plugin, numParams)
return; return;
} }
new size = GetArraySize(g_OldMapList); new size = GetArraySize(g_OldMapList);
decl String:map[33]; decl String:map[PLATFORM_MAX_PATH];
for (new i=0; i<size; i++) for (new i=0; i<size; i++)
{ {
@ -1173,7 +1173,7 @@ public Native_GetNominatedMapList(Handle:plugin, numParams)
if (maparray == INVALID_HANDLE) if (maparray == INVALID_HANDLE)
return; return;
decl String:map[33]; decl String:map[PLATFORM_MAX_PATH];
for (new i = 0; i < GetArraySize(g_NominateList); i++) for (new i = 0; i < GetArraySize(g_NominateList); i++)
{ {