View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005766 | JEDI VCL | 00 JVCL Components | public | 2012-01-12 21:39 | 2012-09-10 14:15 |
Reporter | Kiriakos | Assigned To | AHUser | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in Version | 3.46 | |||
Summary | 0005766: 64-bt incompatibility in AppIniStorage | ||||
Description | AppIniStorage stores float properties using the following code. procedure TJvCustomAppIniStorage.DoWriteFloat(const Path: string; Value: Extended); ... WriteValue(Section, Key, BufToBinStr(@Value, SizeOf(Value))); end; and read it with function TJvCustomAppIniStorage.DoReadFloat(const Path: string; Default: Extended): Extended; ... if BinStrToBuf(Value, @Result, SizeOf(Result)) <> SizeOf(Result) then ... The problem is the Extended in CPUX64 is identical to double, so if an ini file was written by a 32-bit application it will not be read correctly by a 64-bit application and vice-versa. Suggested fix: Replace DoReadFloat, DoWriteFloat with following: function TJvCustomAppIniStorage.DoReadFloat(const Path: string; Default: Extended): Extended; var Section: string; Key: string; Value: string; {$IFDEF CPUX64} TempValue : Extended80; {$ENDIF CPUX64} begin SplitKeyPath(Path, Section, Key); if ValueExists(Section, Key) then begin Value := ReadValue(Section, Key); {$IFDEF CPUX64} if BinStrToBuf(Value, @TempValue, SizeOf(TempValue)) <> SizeOf(TempValue) then Result := Default else try Result := TempValue; except Result := Default; end; {$ELSE CPUX64} if BinStrToBuf(Value, @Result, SizeOf(Result)) <> SizeOf(Result) then Result := Default; {$ENDIF CPUX64} end else Result := Default; end; procedure TJvCustomAppIniStorage.DoWriteFloat(const Path: string; Value: Extended); var Section: string; Key: string; {$IFDEF CPUX64} TempValue : Extended80; {$ENDIF CPUX64} begin SplitKeyPath(Path, Section, Key); {$IFDEF CPUX64} TempValue := Value; WriteValue(Section, Key, BufToBinStr(@TempValue, SizeOf(TempValue))); {$ELSE CPUX64} WriteValue(Section, Key, BufToBinStr(@Value, SizeOf(Value))); {$ENDIF CPUX64} end; This has been tested and works fine. | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2012-01-12 21:39 | Kiriakos | New Issue | |
2012-01-19 21:31 | AHUser | Note Added: 0019326 | |
2012-01-19 21:31 | AHUser | Status | new => resolved |
2012-01-19 21:31 | AHUser | Fixed in Version | => Daily / SVN |
2012-01-19 21:31 | AHUser | Resolution | open => fixed |
2012-01-19 21:31 | AHUser | Assigned To | => AHUser |
2012-09-10 14:15 | obones | Fixed in Version | Daily / SVN => 3.46 |