Fix typedefs not fixing string sizes (bug 6220).

This commit is contained in:
David Anderson 2014-08-20 00:26:09 -07:00
parent 385d3708a3
commit 1f51393e26
2 changed files with 29 additions and 0 deletions

View File

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