winebuild: Avoid assigning values outside of the target_cpu enum range.

This commit is contained in:
Alexandre Julliard 2015-03-04 17:25:06 +09:00
parent f15d077f93
commit 1097384377
4 changed files with 8 additions and 5 deletions

View File

@ -262,7 +262,7 @@ extern DLLSPEC *alloc_dll_spec(void);
extern void free_dll_spec( DLLSPEC *spec );
extern const char *make_c_identifier( const char *str );
extern const char *get_stub_name( const ORDDEF *odp, const DLLSPEC *spec );
extern enum target_cpu get_cpu_from_name( const char *name );
extern int get_cpu_from_name( const char *name );
extern unsigned int get_alignment(unsigned int align);
extern unsigned int get_page_size(void);
extern unsigned int get_ptr_size(void);

View File

@ -199,9 +199,12 @@ static void set_target( const char *target )
if ((p = strchr( spec, '-' )))
{
int cpu;
*p++ = 0;
if ((target_cpu = get_cpu_from_name( spec )) == -1)
fatal_error( "Unrecognized CPU '%s'\n", spec );
cpu = get_cpu_from_name( spec );
if (cpu == -1) fatal_error( "Unrecognized CPU '%s'\n", spec );
target_cpu = cpu;
platform = p;
if ((p = strrchr( p, '-' ))) platform = p + 1;
}

View File

@ -473,7 +473,7 @@ static const char *parse_spec_flags( DLLSPEC *spec, ORDDEF *odp )
odp->flags |= FLAG_CPU_WIN64;
else
{
enum target_cpu cpu = get_cpu_from_name( cpu_name );
int cpu = get_cpu_from_name( cpu_name );
if (cpu == -1)
{
error( "Unknown architecture '%s'\n", cpu_name );

View File

@ -869,7 +869,7 @@ const char *get_stub_name( const ORDDEF *odp, const DLLSPEC *spec )
}
/* parse a cpu name and return the corresponding value */
enum target_cpu get_cpu_from_name( const char *name )
int get_cpu_from_name( const char *name )
{
unsigned int i;