Skip to content

Commit

Permalink
Remove FromLocaleFormat from MakeFloat and MakeInt. See http://www.he…
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarbecker committed Sep 21, 2016
1 parent 24be88d commit 66c55d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions source/helpers.pas
Expand Up @@ -250,8 +250,8 @@ TAppSettings = class(TObject)
function EncodeURLParam(const Value: String): String;
procedure StreamWrite(S: TStream; Text: String = '');
function _GetFileSize(Filename: String): Int64;
function MakeInt(Str: String; FromLocaleFormat: Boolean=True) : Int64;
function MakeFloat(Str: String; FromLocaleFormat: Boolean=True): Extended;
function MakeInt(Str: String) : Int64;
function MakeFloat(Str: String): Extended;
function CleanupNumber(Str: String): String;
function IsNumeric(Str: String): Boolean;
function esc(Text: String; ProcessJokerChars: Boolean=false; DoQuote: Boolean=True): String;
Expand Down Expand Up @@ -555,11 +555,11 @@ function _GetFileSize(Filename: String): Int64;
@param string String-number
@return int64
}
function MakeInt(Str: String; FromLocaleFormat: Boolean=True): Int64;
function MakeInt(Str: String): Int64;
begin
// Result has to be of integer type
try
Result := Trunc(MakeFloat(Str, FromLocaleFormat));
Result := Trunc(MakeFloat(Str));
except
Result := 0;
end;
Expand Down Expand Up @@ -617,15 +617,13 @@ function IsNumeric(Str: String): Boolean;
@param String text representation of a number
@return Extended
}
function MakeFloat(Str: String; FromLocaleFormat: Boolean=True): Extended;
function MakeFloat(Str: String): Extended;
var
p_kb, p_mb, p_gb, p_tb, p_pb : Integer;
begin
// Convert result to a floating point value to ensure
// we don't discard decimal digits for the next step
if FromLocaleFormat then
Str := CleanupNumber(Str);
Result := StrToFloat(Str);
Result := StrToFloat(CleanupNumber(Str));

// Detect if the string was previously formatted by FormatByteNumber
// and convert it back by multiplying it with its byte unit
Expand Down
2 changes: 1 addition & 1 deletion source/main.pas
Expand Up @@ -8450,7 +8450,7 @@ procedure TMainForm.AnyGridGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
if FGridCopying then begin
CellText := Results.Col(Column);
end else if HandleUnixTimestampColumn(Sender, Column) then begin
Timestamp := MakeInt(Results.Col(Column), False);
Timestamp := MakeInt(Results.Col(Column));
Dec(Timestamp, FTimeZoneOffset);
CellText := DateTimeToStr(UnixToDateTime(Timestamp));
end else begin
Expand Down

0 comments on commit 66c55d2

Please sign in to comment.