* fixes from José Mejuto, mantis #26352 generating a parameter if the tlb says the param is there but the string is empty in the tlb + small cleanups

git-svn-id: trunk@28243 -
This commit is contained in:
marco 2014-07-20 14:49:37 +00:00
parent f1bfb398e4
commit f0f628798b

View File

@ -116,7 +116,7 @@ Type
function TypeToString(TI: ITypeInfo; TD: TYPEDESC): string; virtual; function TypeToString(TI: ITypeInfo; TD: TYPEDESC): string; virtual;
function ValidateID(id: string): boolean; virtual; function ValidateID(id: string): boolean; virtual;
function ValidateIDAgainstDeclared(id: string): boolean; virtual; function ValidateIDAgainstDeclared(id: string): boolean; virtual;
function MakeValidId(id:string;var valid:string): boolean; virtual; function MakeValidId(id:string;out valid:string): boolean; virtual;
function MakeValidIdAgainstDeclared(id:string;var valid:string): boolean; function MakeValidIdAgainstDeclared(id:string;var valid:string): boolean;
function RemoveTag(typename: string): string; function RemoveTag(typename: string): string;
// The actual routines that do the work. // The actual routines that do the work.
@ -289,7 +289,7 @@ begin
result:=i<0; result:=i<0;
end; end;
function TTypeLibImporter.MakeValidId(id:string;var valid:string): boolean; function TTypeLibImporter.MakeValidId(id:string;out valid:string): boolean;
begin begin
result:= ValidateID(id); result:= ValidateID(id);
if result then if result then
@ -399,7 +399,9 @@ begin
else else
sRefSrc:=GUIDToString(LARef^.GUID); sRefSrc:=GUIDToString(LARef^.GUID);
RegCloseKey(Handle); RegCloseKey(Handle);
end; end
else
sRefSrc:='DLL not registered in the system';
AddToHeader('// Dependency: %s v%d.%d (%s)',[BstrName,LARef^.wMajorVerNum,LARef^.wMinorVerNum,sRefSrc]); AddToHeader('// Dependency: %s v%d.%d (%s)',[BstrName,LARef^.wMajorVerNum,LARef^.wMinorVerNum,sRefSrc]);
FUses.Add(sl); FUses.Add(sl);
TLRef.ReleaseTLibAttr(LARef); TLRef.ReleaseTLibAttr(LARef);
@ -451,7 +453,7 @@ var
RTIT: HREFTYPE; RTIT: HREFTYPE;
TIref: ITypeInfo; TIref: ITypeInfo;
BstrName,BstrNameRef,BstrDocString : WideString; BstrName,BstrNameRef,BstrDocString : WideString;
s,sl,sPropIntfc,sPropDispIntfc,sType,sConv,sFunc,sPar,sVarName,sMethodName, s,sl,sPropDispIntfc,sType,sConv,sFunc,sPar,sVarName,sMethodName,
sPropParam,sPropParam2,sPropParam3:string; sPropParam,sPropParam2,sPropParam3:string;
sEventSignatures,sEventFunctions,sEventProperties,sEventImplementations:string; sEventSignatures,sEventFunctions,sEventProperties,sEventImplementations:string;
i,j,k:integer; i,j,k:integer;
@ -497,13 +499,16 @@ var
function GetName(i:integer):string; //bug in Office10\MSacc.OLB _WizHook.Key function GetName(i:integer):string; //bug in Office10\MSacc.OLB _WizHook.Key
begin begin
if i<cnt then result:='';
result:=BL[i] if i<integer(cnt) then
else result:=BL[i];
if result='' then //No name ?
result:='Param'+inttostr(i); result:='Param'+inttostr(i);
end; end;
begin begin
FillMemory(@TD,Sizeof(TD),0);
TD.vt:=VT_ILLEGAL;
Propertycnt:=0; Propertycnt:=0;
SetLength(aPropertyDefs,TA^.cFuncs+TA^.cVars); // worst case, all functions getters or all setters SetLength(aPropertyDefs,TA^.cFuncs+TA^.cVars); // worst case, all functions getters or all setters
sEventSignatures:=''; sEventSignatures:='';
@ -531,7 +536,6 @@ begin
s:=format(#13#10'// %s : %s'#13#10#13#10' %sDisp = dispinterface'#13#10,[iname,iDoc,iname]) s:=format(#13#10'// %s : %s'#13#10#13#10' %sDisp = dispinterface'#13#10,[iname,iDoc,iname])
else else
s:=format(#13#10'// %s : %s'#13#10#13#10' %s = dispinterface'#13#10,[iname,iDoc,iname]); s:=format(#13#10'// %s : %s'#13#10#13#10' %s = dispinterface'#13#10,[iname,iDoc,iname]);
sPropIntfc:='';
sPropDispIntfc:=''; sPropDispIntfc:='';
s:=s+format(' [''%s'']'#13#10,[GUIDToString(TA^.GUID)]); s:=s+format(' [''%s'']'#13#10,[GUIDToString(TA^.GUID)]);
for j:=0 to TA^.cFuncs-1 do for j:=0 to TA^.cFuncs-1 do
@ -1099,7 +1103,7 @@ Procedure TTypeLibImporter.CreateForwards(Const TL : ITypeLib; TICount : Integer
Var Var
i, j: integer; i, j: integer;
BstrName, BstrNameRef : WideString; BstrName, BstrNameRef : WideString;
dwHelpContext: DWORD; // dwHelpContext: DWORD;
TI, TIref:ITypeInfo; TI, TIref:ITypeInfo;
TA:LPTYPEATTR; TA:LPTYPEATTR;
TIT: TYPEKIND; TIT: TYPEKIND;
@ -1323,7 +1327,8 @@ Var
BstrName, BstrDocString, BstrHelpFile, BstrNameRef : WideString; BstrName, BstrDocString, BstrHelpFile, BstrNameRef : WideString;
dwHelpContext : DWORD; dwHelpContext : DWORD;
TI,TIref,TIref2 : ITypeInfo; TI,TIref,TIref2 : ITypeInfo;
TA,TAref,TAref2 : LPTYPEATTR; TA,TAref: LPTYPEATTR;
//TAref2 : LPTYPEATTR;
TIT : TYPEKIND; TIT : TYPEKIND;
RTIT : HREFTYPE; RTIT : HREFTYPE;
sl: string; sl: string;
@ -1767,6 +1772,7 @@ var
begin begin
Header.Clear; Header.Clear;
InterfaceSection.Clear; InterfaceSection.Clear;
TL:=nil;
OleCheck(LoadTypeLib(PWidechar(InputFileName), TL )); OleCheck(LoadTypeLib(PWidechar(InputFileName), TL ));
OleCheck(TL.GetLibAttr(LA)); OleCheck(TL.GetLibAttr(LA));
try try