winebuild: Add detection of duplicate resources.

oldstable
Alexandre Julliard 2009-06-02 14:19:31 +02:00
parent a328834f5b
commit e112286366
1 changed files with 17 additions and 0 deletions

View File

@ -318,6 +318,16 @@ static int cmp_res( const void *ptr1, const void *ptr2 )
return res1->lang - res2->lang;
}
static char *format_res_string( const struct string_id *str )
{
int i, len = str->str ? strlenW(str->str) + 1 : 5;
char *ret = xmalloc( len );
if (!str->str) sprintf( ret, "%04x", str->id );
else for (i = 0; i < len; i++) ret[i] = str->str[i]; /* dumb W->A conversion */
return ret;
}
/* build the 3-level (type,name,language) resource tree */
static struct res_tree *build_resource_tree( DLLSPEC *spec )
{
@ -343,6 +353,13 @@ static struct res_tree *build_resource_tree( DLLSPEC *spec )
{
name = add_name( type, &spec->resources[i] );
}
else if (spec->resources[i].lang == spec->resources[i-1].lang)
{
char *type_str = format_res_string( &spec->resources[i].type );
char *name_str = format_res_string( &spec->resources[i].name );
error( "winebuild: duplicate resource type %s name %s language %04x\n",
type_str, name_str, spec->resources[i].lang );
}
else name->nb_languages++;
}
return tree;