Fix DoVarCopyComplex() to support varOleStr kind of data
Original Reporter info from Mantis: abouchez
-
Reporter name: Arnaud Bouchez
Original Reporter info from Mantis: abouchez
- Reporter name: Arnaud Bouchez
Description:
In variants.pas, the following function should be modified as such to handle varOleStr as expected.
Steps to reproduce:
Assign a variant holding a WideString into another variant.
Appeared when using late binding.
Additional information:
procedure DoVarCopyComplex(var Dest: TVarData; const Source: TVarData);
var
Handler: TCustomVariantType;
begin
DoVarClearIfComplex(Dest);
with Source do
if vType < varInt64 then
VarResultCheck(VariantCopy(Dest, Source))
else if vType = varString then begin
Dest.vType := varString;
Dest.vString := nil;
AnsiString(Dest.vString) := AnsiString(vString);
end else if vType = varOleStr then begin
Dest.vType := varOleStr;
Dest.vOleStr := nil;
WideString(Dest.vOleStr) := WideString(vOleStr);
end else if vType = varAny then begin
Dest := Source;
RefAnyProc(Dest);
end else if vType and varArray <> 0 then
DoVarCopyArray(Dest, Source, @DoVarCopy)
else if (vType and varByRef <> 0) and
((vType xor varByRef = varString) or ((vType xor varByRef = varOleStr)) then
Dest := Source
else if FindCustomVariantType(vType, Handler) then
Handler.Copy(Dest, Source, False)
else
VarResultCheck(VariantCopy(Dest, Source));
end;
Mantis conversion info:
- Mantis ID: 27354
- OS: Linux
- OS Build: Any
- Build: Trunk
- Platform: FPC
- Version: 3.1.1
- Fixed in version: 3.0.0
- Fixed in revision: 29645 (#9ebc092a)