Subject Bug in AsWideString?
Author Salvatore Besso
hello all,

I'm testing IBO 4.9.11 with RAD Studio XE and I got a strange behaviour in function TIB_ColumnVarText.SetAsWideString,
located in IB_Components.pas.

In the test program I'm using string variables that default to UnicodeString. This assignment:

GroupsQuery.FieldByName('REFERENCE').AsWideString := Reference;

where the variable Reference as a value of 'ABCDEF' results in a stored value of 'ABCDE', the last character been
truncated. Looking in the source code I have noticed this:

44930 Len := 2 * Length(NewValue);
44931 if Len > DataSize - 2 then
44932 Len := DataSize - 2;
44938 Move( PWideChar(NewValue)^, vary_string, Len );

The string passed as a parameter to the function (NewValue) contains six characters. Len at line 44930 is correctly set
to 12. DataSize equals to 12 as well, but why Len is shortened to 10 at line 44932 resulting in a string truncated of
the last character stored in the buffer at line 44938?