oleaut32: Fix ICreateTypeLib2::SetFuncAndParamNames.
Getters and setters for same property can have an identical name
This commit is contained in:
parent
57c784e205
commit
b4025a3ed1
|
@ -982,10 +982,12 @@ static void test_CreateTypeLib(void) {
|
|||
static WCHAR defaultW[] = {'d','e','f','a','u','l','t',0x3213,0};
|
||||
static OLECHAR func1W[] = {'f','u','n','c','1',0};
|
||||
static OLECHAR func2W[] = {'f','u','n','c','2',0};
|
||||
static OLECHAR prop1W[] = {'P','r','o','p','1',0};
|
||||
static OLECHAR param1W[] = {'p','a','r','a','m','1',0};
|
||||
static OLECHAR param2W[] = {'p','a','r','a','m','2',0};
|
||||
static OLECHAR *names1[] = {func1W, param1W, param2W};
|
||||
static OLECHAR *names2[] = {func2W, param1W, param2W};
|
||||
static OLECHAR *propname[] = {prop1W, param1W};
|
||||
static const GUID custguid = {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x70}};
|
||||
|
||||
char filename[MAX_PATH];
|
||||
|
@ -1171,6 +1173,16 @@ static void test_CreateTypeLib(void) {
|
|||
hres = ICreateTypeInfo_SetFuncHelpContext(createti, 1, 0xabcdefab);
|
||||
ok(hres == S_OK, "got %08x\n", hres);
|
||||
|
||||
hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 0, propname, 1);
|
||||
ok(hres == S_OK, "got %08x\n", hres);
|
||||
|
||||
hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 1, propname, 1);
|
||||
ok(hres == S_OK, "got %08x\n", hres);
|
||||
|
||||
hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 1, propname, 2);
|
||||
ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
|
||||
|
||||
|
||||
funcdesc.invkind = INVOKE_PROPERTYPUTREF;
|
||||
hres = ICreateTypeInfo_AddFuncDesc(createti, 0, &funcdesc);
|
||||
ok(hres == S_OK, "got %08x\n", hres);
|
||||
|
|
|
@ -2132,21 +2132,27 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetFuncAndParamNames(
|
|||
if(index >= This->typeinfo->cElement || !cNames)
|
||||
return TYPE_E_ELEMENTNOTFOUND;
|
||||
|
||||
len = ctl2_encode_name(This->typelib, rgszNames[0], &namedata);
|
||||
for(iter2=This->typedata->next->next; iter2!=This->typedata->next; iter2=iter2->next) {
|
||||
if(i == index)
|
||||
iter = iter2;
|
||||
else if(iter2->name!=-1 && !memcmp(namedata,
|
||||
This->typelib->typelib_segment_data[MSFT_SEG_NAME]+iter2->name+8, len))
|
||||
return TYPE_E_AMBIGUOUSNAME;
|
||||
|
||||
i++;
|
||||
}
|
||||
for(iter=This->typedata->next->next, i=0; i<index; i++)
|
||||
iter=iter->next;
|
||||
|
||||
/* cNames == cParams for put or putref accessor, cParams+1 otherwise */
|
||||
if(cNames != iter->u.data[5] + ((iter->u.data[4]>>3)&(INVOKE_PROPERTYPUT|INVOKE_PROPERTYPUTREF) ? 0 : 1))
|
||||
return TYPE_E_ELEMENTNOTFOUND;
|
||||
|
||||
len = ctl2_encode_name(This->typelib, rgszNames[0], &namedata);
|
||||
for(iter2=This->typedata->next->next; iter2!=This->typedata->next; iter2=iter2->next) {
|
||||
if(iter2->name!=-1 && !memcmp(namedata,
|
||||
This->typelib->typelib_segment_data[MSFT_SEG_NAME]+iter2->name+8, len))
|
||||
{
|
||||
/* getters/setters can have a same name */
|
||||
INT inv1 = iter2->u.data[4] >> 3;
|
||||
INT inv2 = iter->u.data[4] >> 3;
|
||||
if (!((inv1&(INVOKE_PROPERTYPUT|INVOKE_PROPERTYPUTREF)) && (inv2&INVOKE_PROPERTYGET)) &&
|
||||
!((inv2&(INVOKE_PROPERTYPUT|INVOKE_PROPERTYPUTREF)) && (inv1&INVOKE_PROPERTYGET)))
|
||||
return TYPE_E_AMBIGUOUSNAME;
|
||||
}
|
||||
}
|
||||
|
||||
offset = ctl2_alloc_name(This->typelib, rgszNames[0]);
|
||||
if(offset == -1)
|
||||
return E_OUTOFMEMORY;
|
||||
|
|
Loading…
Reference in New Issue