Commit 10973843 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent f15d077f
...@@ -262,7 +262,7 @@ extern DLLSPEC *alloc_dll_spec(void); ...@@ -262,7 +262,7 @@ extern DLLSPEC *alloc_dll_spec(void);
extern void free_dll_spec( DLLSPEC *spec ); extern void free_dll_spec( DLLSPEC *spec );
extern const char *make_c_identifier( const char *str ); extern const char *make_c_identifier( const char *str );
extern const char *get_stub_name( const ORDDEF *odp, const DLLSPEC *spec ); 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_alignment(unsigned int align);
extern unsigned int get_page_size(void); extern unsigned int get_page_size(void);
extern unsigned int get_ptr_size(void); extern unsigned int get_ptr_size(void);
......
...@@ -199,9 +199,12 @@ static void set_target( const char *target ) ...@@ -199,9 +199,12 @@ static void set_target( const char *target )
if ((p = strchr( spec, '-' ))) if ((p = strchr( spec, '-' )))
{ {
int cpu;
*p++ = 0; *p++ = 0;
if ((target_cpu = get_cpu_from_name( spec )) == -1) cpu = get_cpu_from_name( spec );
fatal_error( "Unrecognized CPU '%s'\n", spec ); if (cpu == -1) fatal_error( "Unrecognized CPU '%s'\n", spec );
target_cpu = cpu;
platform = p; platform = p;
if ((p = strrchr( p, '-' ))) platform = p + 1; if ((p = strrchr( p, '-' ))) platform = p + 1;
} }
......
...@@ -473,7 +473,7 @@ static const char *parse_spec_flags( DLLSPEC *spec, ORDDEF *odp ) ...@@ -473,7 +473,7 @@ static const char *parse_spec_flags( DLLSPEC *spec, ORDDEF *odp )
odp->flags |= FLAG_CPU_WIN64; odp->flags |= FLAG_CPU_WIN64;
else else
{ {
enum target_cpu cpu = get_cpu_from_name( cpu_name ); int cpu = get_cpu_from_name( cpu_name );
if (cpu == -1) if (cpu == -1)
{ {
error( "Unknown architecture '%s'\n", cpu_name ); error( "Unknown architecture '%s'\n", cpu_name );
......
...@@ -869,7 +869,7 @@ const char *get_stub_name( const ORDDEF *odp, const DLLSPEC *spec ) ...@@ -869,7 +869,7 @@ const char *get_stub_name( const ORDDEF *odp, const DLLSPEC *spec )
} }
/* parse a cpu name and return the corresponding value */ /* 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; unsigned int i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment