d3dx9: Improve get_parameter_by_name().

This commit is contained in:
Rico Schüller 2011-05-13 11:35:27 +02:00 committed by Alexandre Julliard
parent d797e5fc7e
commit ae2c6a164f
1 changed files with 12 additions and 15 deletions

View File

@ -112,8 +112,7 @@ struct ID3DXEffectCompilerImpl
static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base, static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base,
struct d3dx_parameter *parameter, LPCSTR name); struct d3dx_parameter *parameter, LPCSTR name);
static struct d3dx_parameter *get_parameter_annotation_by_name(struct ID3DXBaseEffectImpl *base, static struct d3dx_parameter *get_parameter_annotation_by_name(struct d3dx_parameter *parameter, LPCSTR name);
struct d3dx_parameter *parameter, LPCSTR name);
static inline void read_dword(const char **ptr, DWORD *d) static inline void read_dword(const char **ptr, DWORD *d)
{ {
@ -527,14 +526,13 @@ static inline BOOL get_bool(void *data)
return (*(DWORD *)data) ? TRUE : FALSE; return (*(DWORD *)data) ? TRUE : FALSE;
} }
static struct d3dx_parameter *get_parameter_element_by_name(struct ID3DXBaseEffectImpl *base, static struct d3dx_parameter *get_parameter_element_by_name(struct d3dx_parameter *parameter, LPCSTR name)
struct d3dx_parameter *parameter, LPCSTR name)
{ {
UINT element; UINT element;
struct d3dx_parameter *temp_parameter; struct d3dx_parameter *temp_parameter;
LPCSTR part; LPCSTR part;
TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name)); TRACE("parameter %p, name %s\n", parameter, debugstr_a(name));
if (!name || !*name) return parameter; if (!name || !*name) return parameter;
@ -548,10 +546,10 @@ static struct d3dx_parameter *get_parameter_element_by_name(struct ID3DXBaseEffe
switch (*part++) switch (*part++)
{ {
case '.': case '.':
return get_parameter_by_name(base, temp_parameter, part); return get_parameter_by_name(NULL, temp_parameter, part);
case '@': case '@':
return get_parameter_annotation_by_name(base, temp_parameter, part); return get_parameter_annotation_by_name(temp_parameter, part);
case '\0': case '\0':
TRACE("Returning parameter %p\n", temp_parameter); TRACE("Returning parameter %p\n", temp_parameter);
@ -567,14 +565,13 @@ static struct d3dx_parameter *get_parameter_element_by_name(struct ID3DXBaseEffe
return NULL; return NULL;
} }
static struct d3dx_parameter *get_parameter_annotation_by_name(struct ID3DXBaseEffectImpl *base, static struct d3dx_parameter *get_parameter_annotation_by_name(struct d3dx_parameter *parameter, LPCSTR name)
struct d3dx_parameter *parameter, LPCSTR name)
{ {
UINT i, length; UINT i, length;
struct d3dx_parameter *temp_parameter; struct d3dx_parameter *temp_parameter;
LPCSTR part; LPCSTR part;
TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name)); TRACE("parameter %p, name %s\n", parameter, debugstr_a(name));
if (!name || !*name) return parameter; if (!name || !*name) return parameter;
@ -595,10 +592,10 @@ static struct d3dx_parameter *get_parameter_annotation_by_name(struct ID3DXBaseE
switch (*part++) switch (*part++)
{ {
case '.': case '.':
return get_parameter_by_name(base, temp_parameter, part); return get_parameter_by_name(NULL, temp_parameter, part);
case '[': case '[':
return get_parameter_element_by_name(base, temp_parameter, part); return get_parameter_element_by_name(temp_parameter, part);
default: default:
FIXME("Unhandled case \"%c\"\n", *--part); FIXME("Unhandled case \"%c\"\n", *--part);
@ -651,13 +648,13 @@ static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *
switch (*part++) switch (*part++)
{ {
case '.': case '.':
return get_parameter_by_name(base, temp_parameter, part); return get_parameter_by_name(NULL, temp_parameter, part);
case '@': case '@':
return get_parameter_annotation_by_name(base, temp_parameter, part); return get_parameter_annotation_by_name(temp_parameter, part);
case '[': case '[':
return get_parameter_element_by_name(base, temp_parameter, part); return get_parameter_element_by_name(temp_parameter, part);
default: default:
FIXME("Unhandled case \"%c\"\n", *--part); FIXME("Unhandled case \"%c\"\n", *--part);