Merge from 1.2 branch

This commit is contained in:
Matt Woodrow 2009-05-11 11:45:08 +12:00
commit 7710a1fdb0
5 changed files with 19 additions and 20 deletions

View File

@ -194,7 +194,7 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
} }
/* Cache the name for post hooks */ /* Cache the name for post hooks */
pHook->name = strdup(name); pHook->name = sm_strdup(name);
/* Increase reference count */ /* Increase reference count */
pHook->refCount++; pHook->refCount++;
@ -300,7 +300,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
sm_trie_delete(m_EventHooks, name); sm_trie_delete(m_EventHooks, name);
/* Free the cached name */ /* Free the cached name */
free(pHook->name); delete pHook->name;
/* And finally free structure memory */ /* And finally free structure memory */
delete pHook; delete pHook;
@ -472,7 +472,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
assert(pHook->pPostHook == NULL); assert(pHook->pPostHook == NULL);
assert(pHook->pPreHook == NULL); assert(pHook->pPreHook == NULL);
sm_trie_delete(m_EventHooks, pHook->name); sm_trie_delete(m_EventHooks, pHook->name);
free(pHook->name); delete pHook->name;
delete pHook; delete pHook;
} }
} }

View File

@ -48,7 +48,7 @@ static int g_ws_chartable[255] = {0};
bool TextParsers::IsWhitespace(const char *stream) bool TextParsers::IsWhitespace(const char *stream)
{ {
return g_ws_chartable[(unsigned)*stream] == 1; return g_ws_chartable[(unsigned char)*stream] == 1;
} }
TextParsers::TextParsers() TextParsers::TextParsers()
@ -508,7 +508,7 @@ SMCError TextParsers::ParseStream_SMC(void *stream,
else else
{ {
/* Check if we're whitespace or not */ /* Check if we're whitespace or not */
if (!g_ws_chartable[(unsigned)c]) if (!g_ws_chartable[(unsigned char)c])
{ {
bool restage = false; bool restage = false;
/* Check various special tokens: /* Check various special tokens:
@ -823,7 +823,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
***************************************************/ ***************************************************/
/* First strip beginning whitespace */ /* First strip beginning whitespace */
while (*ptr != '\0' && g_ws_chartable[(unsigned)*ptr] != 0) while (*ptr != '\0' && g_ws_chartable[(unsigned char)*ptr] != 0)
{ {
ptr++; ptr++;
} }
@ -876,7 +876,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
/* Lastly, strip ending whitespace off */ /* Lastly, strip ending whitespace off */
for (size_t i=len-1; i>=0 && i<len; i--) for (size_t i=len-1; i>=0 && i<len; i--)
{ {
if (g_ws_chartable[(unsigned)ptr[i]]) if (g_ws_chartable[(unsigned char)ptr[i]])
{ {
ptr[i] = '\0'; ptr[i] = '\0';
len--; len--;
@ -917,7 +917,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
i += _GetUTF8CharBytes(&ptr[i]) - 1; i += _GetUTF8CharBytes(&ptr[i]) - 1;
} }
} else { } else {
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned)c] != 0); alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned char)c] != 0);
} }
if (!alnum) if (!alnum)
{ {
@ -970,12 +970,12 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
i += _GetUTF8CharBytes(&ptr[i]) - 1; i += _GetUTF8CharBytes(&ptr[i]) - 1;
} }
} else { } else {
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned)c] != 0); alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned char)c] != 0);
} }
if (!alnum) if (!alnum)
{ {
if (g_ws_chartable[(unsigned)c]) if (g_ws_chartable[(unsigned char)c])
{ {
/* if it's a space, keep track of the first occurring space */ /* if it's a space, keep track of the first occurring space */
if (!first_space) if (!first_space)
@ -1014,7 +1014,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
if (val_ptr) if (val_ptr)
{ {
/* eat up spaces! there shouldn't be any h*/ /* eat up spaces! there shouldn't be any h*/
while ((*val_ptr != '\0') && g_ws_chartable[(unsigned)*val_ptr] != 0) while ((*val_ptr != '\0') && g_ws_chartable[(unsigned char)*val_ptr] != 0)
{ {
val_ptr++; val_ptr++;
} }

View File

@ -43,7 +43,7 @@
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4" AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core-legacy&quot;;&quot;$(MMSOURCE17)\core-legacy\sourcehook&quot;" AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core-legacy&quot;;&quot;$(MMSOURCE17)\core-legacy\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=1"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -125,7 +125,7 @@
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4" AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core-legacy&quot;;&quot;$(MMSOURCE17)\core-legacy\sourcehook&quot;" AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core-legacy&quot;;&quot;$(MMSOURCE17)\core-legacy\sourcehook&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=1"
RuntimeLibrary="0" RuntimeLibrary="0"
EnableEnhancedInstructionSet="0" EnableEnhancedInstructionSet="0"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"
@ -369,7 +369,7 @@
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4" AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;" AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=1"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -451,7 +451,7 @@
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4" AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;" AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=1"
RuntimeLibrary="0" RuntimeLibrary="0"
EnableEnhancedInstructionSet="0" EnableEnhancedInstructionSet="0"
RuntimeTypeInfo="false" RuntimeTypeInfo="false"

View File

@ -2318,6 +2318,7 @@ static int declloc(int fstatic)
dim_ident = doexpr2(TRUE,FALSE,FALSE,FALSE,&idxtag[numdim],&dim_sym,0,&dim_val); dim_ident = doexpr2(TRUE,FALSE,FALSE,FALSE,&idxtag[numdim],&dim_sym,0,&dim_val);
if (dim_ident == iVARIABLE || dim_ident == iEXPRESSION || dim_ident == iARRAYCELL) { if (dim_ident == iVARIABLE || dim_ident == iEXPRESSION || dim_ident == iARRAYCELL) {
all_constant = 0; all_constant = 0;
dim[numdim] = 0;
} else if (dim_ident == iCONSTEXPR) { } else if (dim_ident == iCONSTEXPR) {
dim[numdim] = dim_val.constval; dim[numdim] = dim_val.constval;
/* :TODO: :URGENT: Make sure this still works */ /* :TODO: :URGENT: Make sure this still works */
@ -2344,7 +2345,7 @@ static int declloc(int fstatic)
ident = iARRAY; ident = iARRAY;
stgdel(_index, _code); stgdel(_index, _code);
} else { } else {
if (tag == pc_tag_string && numdim && dim[numdim-1]) { if (tag == pc_tag_string && numdim) {
stradjust(sPRI); stradjust(sPRI);
} }
pushreg(sPRI); pushreg(sPRI);

View File

@ -2422,8 +2422,6 @@ static int nesting=0;
if (!checktags_string(arg[argidx].tags, arg[argidx].numtags, &lval) if (!checktags_string(arg[argidx].tags, arg[argidx].numtags, &lval)
&& !checktag(arg[argidx].tags,arg[argidx].numtags,lval.tag)) && !checktag(arg[argidx].tags,arg[argidx].numtags,lval.tag))
error(213); error(213);
if (lval.tag!=0)
append_constval(&taglst,arg[argidx].name,lval.tag,0);
break; break;
case iVARIABLE: case iVARIABLE:
if (lval.ident==iLABEL || lval.ident==iFUNCTN || lval.ident==iREFFUNC if (lval.ident==iLABEL || lval.ident==iFUNCTN || lval.ident==iREFFUNC