Merge pull request #135 from alliedmodders/typedef-fix

Fix typedefs not fixing string sizes (bug 6220).
This commit is contained in:
David Anderson 2014-08-20 00:30:08 -07:00
commit 233aa5d2df
2 changed files with 29 additions and 0 deletions

View File

@ -4223,6 +4223,9 @@ static void parse_function_type(functag_t *type)
continue;
}
// Account for strings.
fix_char_size(&decl);
funcarg_t *arg = &type->args[type->argcount++];
arg->tagcount = 1;
arg->tags[0] = decl.type.tag;

View File

@ -0,0 +1,26 @@
enum Action: {}
functag public Action:OldFuncTag( String:someString[128] );
typedef NewFuncTag = function Action ( char someString[128] );
native UseOldFuncTag( OldFuncTag func );
native UseNewFuncTag( NewFuncTag func );
public OnPluginStart()
{
// fine
UseOldFuncTag( MyOldFunc );
// also fine
UseOldFuncTag( MyNewFunc );
// error 100: function prototypes do not match
UseNewFuncTag( MyOldFunc );
// error 100: function prototypes do not match
UseNewFuncTag( MyNewFunc );
}
public Action:MyOldFunc( String:someString[128] )
{
}
public Action MyNewFunc( char someString[128] )
{
}