View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005742 | JEDI Code Library | JclSysUtils | public | 2011-12-17 00:17 | 2012-08-30 15:32 |
Reporter | Arioch | Assigned To | outchy | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Version 2.4 | ||||
Target Version | Fixed in Version | Version 2.4 | |||
Summary | 0005742: String to unsigned int conversion ? | ||||
Description | // SetOrdValue(StrToInt(Value)); // Should care for values between high(integer) and high(cardinal) // Delphi has UIntToStr() but not StrToUInt() function StrToUInt(const Value: string): Cardinal; var i6: Int64; begin i6 := StrToInt64(Value); if ( i6 < Low(Result)) or ( i6 > High(Result)) then raise EConvertError.Create('"'+Value+'" is not within range of Cardinal data type'); //this msg should not end with dot! Result := i6; end; | ||||
Additional Information | Also needed is TryStrToUInt, StrToUintDef and maybe something more. And i seems to saw unsigned UInt64 where shoulbe be no "wrapping" supertype for :-( | ||||
Tags | No tags attached. | ||||
Fixed in GIT commit | |||||
Fixed in SVN revision | 3817 | ||||
IDE version | Delphi/C++Builder XE2 | ||||
|
// helpers for SetOrdValue(StrToInt(Value:Cardinal)); // Should care for values between high(integer) and high(cardinal) // Delphi has UIntToStr() but not StrToUInt() // better be moved to JclSysUtils function TryStrToUInt(const Value: string; out Res: Cardinal): boolean; var i6: Int64; begin Result := false; if not TryStrToInt64(Value, i6) then exit; if ( i6 < Low(Res)) or ( i6 > High(Res)) then exit; Result := true; Res := i6; end; function StrToUIntDef(const Value: string; const Default: Cardinal): Cardinal; begin if not TryStrToUInt(Value, Result) then Result := Default; end; function StrToUInt(const Value: string): Cardinal; begin if not TryStrToUInt(Value, Result) then raise EConvertError.Create('"'+Value+'" is not within range of Cardinal data type'); end; |
|
when implemented, those functions are to be removed from JVCL, design\JvIP4AdressProp 0005716 |
|
This is committed in revision 3732. |
|
i see functions were renamed. i think this renaming is unlucky desicion, sinse it is going to diverge with Delphi RTL naming conventions. http://docwiki.embarcadero.com/Libraries/en/System.SysUtils.UIntToStr - not CardinalToStr |
|
Guys ? |
|
This renaming is committed in JCL revision 3817 and JVCL revision 13396. |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-12-17 00:17 | Arioch | New Issue | |
2011-12-17 00:17 | Arioch | IDE version | => Delphi/C++Builder XE2 |
2011-12-17 11:04 | Arioch | Note Added: 0019217 | |
2011-12-29 23:01 | Arioch | Note Added: 0019284 | |
2012-02-17 21:09 | outchy | Note Added: 0019431 | |
2012-02-17 21:09 | outchy | Assigned To | => outchy |
2012-02-17 21:09 | outchy | Status | new => feedback |
2012-03-03 19:28 | outchy | Fixed in revision | => 3732 |
2012-03-03 19:28 | outchy | Status | feedback => resolved |
2012-03-03 19:28 | outchy | Fixed in Version | => Version 2.4 (Subversion repository/Daily zips) |
2012-03-03 19:28 | outchy | Resolution | open => fixed |
2012-04-15 18:59 | Arioch | Note Added: 0019707 | |
2012-04-15 18:59 | Arioch | Status | resolved => feedback |
2012-04-15 18:59 | Arioch | Resolution | fixed => reopened |
2012-06-11 22:46 | Arioch | Note Added: 0019880 | |
2012-08-13 15:01 | outchy | Note Added: 0020093 | |
2012-08-30 15:32 | outchy | Fixed in revision | 3732 => 3817 |
2012-08-30 15:32 | outchy | Status | feedback => resolved |
2012-08-30 15:32 | outchy | Resolution | reopened => fixed |