Module: wine Branch: master Commit: 109738437749028bacb747984a7fe1271d895691 URL: http://source.winehq.org/git/wine.git/?a=commit;h=109738437749028bacb747984a... Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Mar 4 17:25:06 2015 +0900 winebuild: Avoid assigning values outside of the target_cpu enum range. --- tools/winebuild/build.h | 2 +- tools/winebuild/main.c | 7 +++++-- tools/winebuild/parser.c | 2 +- tools/winebuild/utils.c | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index 41cec91..4a71eed 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -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); diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c index 807cf61..d1717c0 100644 --- a/tools/winebuild/main.c +++ b/tools/winebuild/main.c @@ -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; } diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c index 0498e75..bae2b47 100644 --- a/tools/winebuild/parser.c +++ b/tools/winebuild/parser.c @@ -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 ); diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 566911f..b9318c3 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -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;