View Issue Details

IDProjectCategoryView StatusLast Update
0001893JEDI VCL00 JVCL Componentspublic2004-08-30 17:26
ReporterAlexeiRAssigned ToAHUser 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001893: JvInterpreter: wrong types in var parameters.
DescriptionI have used a procedure DecodeDate in my script, and it appeared to return a wrong value of Year (=212).
I have traced a procedure JvInterpreter_DecodeDate (unit jvInterpreter_SysUtils).
The type of variant Args.Values[1] is 'byte' instead of 'word' or 'smallint', so value of year is truncated.
2004=$O7D4, 212=$D4.
I couldn't fix this bug in the interpreter, but a workaround is to use the following version of wrapper procedure:

procedure JvInterpreter_DecodeDate(var Value: Variant; Args: TJvInterpreterArgs);
var Year: word;
begin
  DecodeDate(Args.Values[0], Year, Word(TVarData(Args.Values[2]).vSmallint),
    Word(TVarData(Args.Values[3]).vSmallint));
  Args.Values[1] := Year;
end;

I thought that the problem is in the function Typ2Size, in which the occurs:
    ... varSmallInt: Result := SizeOf(varSmallInt); ...
i.e. Result=1 instead of 2. but it's not called in my example. It seems to me it should look as
    ... varSmallInt: Result := SizeOf(SmallInt); ...
Additional InformationI have also attached application that demonstrates this bug.
TagsNo tags attached.

Activities

2004-06-25 06:53

 

JvInterpreter_Bug_DecodeDate.zip (3,152 bytes)

maxp

2004-08-21 01:26

reporter   ~0005060

I cannot reproduce this bug (using JVCL3-Source-2004-08-17.zip sources).
Running example from JvInterpreter_Bug_DecodeDate.zip always give answer 'Year = 2004'.
But piece of code quoted by AlexeiR
    ... varSmallInt: Result := SizeOf(varSmallInt); ...
indeed looks strange. Can anyone check if it is correct??? From the logic of the whole procedure Typ2Size it seems that there should be
    ... varSmallInt: Result := SizeOf(SmallInt); ....

AHUser

2004-08-30 17:26

developer   ~0005113

Fixed in CVS.

Issue History

Date Modified Username Field Change
2004-06-25 06:53 AlexeiR New Issue
2004-06-25 06:53 AlexeiR File Added: JvInterpreter_Bug_DecodeDate.zip
2004-08-21 01:26 maxp Note Added: 0005060
2004-08-30 17:26 AHUser Status new => resolved
2004-08-30 17:26 AHUser Resolution open => fixed
2004-08-30 17:26 AHUser Assigned To => AHUser
2004-08-30 17:26 AHUser Note Added: 0005113