Skip to content

Commit

Permalink
refs #4349 fixed a bug in parse_to_qore_value() with floats and numbe…
Browse files Browse the repository at this point in the history
…rs with trailing zeros
  • Loading branch information
davidnich committed Nov 30, 2021
1 parent b39babc commit b6882b8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
3 changes: 3 additions & 0 deletions doxygen/lang/900_release_notes.dox.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
- implemented \c AbstracTable::beginTransaction() to support starting a transaction when using the \c SqlUtil
API with databases and tables
(<a href="https://github.com/qorelanguage/qore/issues/4346">issue 4346</a>)
- <a href="../../modules/Util/html/index.html">Util</a> module
- fixed a bug in \c parse_to_qore_value() with floats and numbers with trailing zeros
(<a href="https://github.com/qorelanguage/qore/issues/4349">issue 4349</a>)
- fixed a bug that caused a core dump with implicit object method calls in arguments in the
@ref background "background operator" expression
(<a href="https://github.com/qorelanguage/qore/issues/4344">issue 4344</a>)
Expand Down
2 changes: 1 addition & 1 deletion lib/Function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ void UserSignature::parseInitPushLocalVars(const QoreTypeInfo* classTypeInfo) {
}

// push argv var on stack and save id
argvid = push_local_var("argv", loc, listOrNothingTypeInfo, err, true, 1);
argvid = push_local_var("argv", loc, autoListOrNothingTypeInfo, err, true, 1);
printd(5, "UserSignature::parseInitPushLocalVars() this: %p (%s) argvid: %p selfid: %p\n", this,
getSignatureText(), argvid, selfid);

Expand Down
34 changes: 29 additions & 5 deletions qlib/Util.qm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

# minimum Qore version
%requires qore >= 0.9.13
%requires qore >= 1.0

# do not use $ for vars, assume local var scope
%new-style
Expand All @@ -35,7 +35,7 @@
%enable-all-warnings

module Util {
version = "1.6.1";
version = "1.6.2";
desc = "user module for generally useful routines";
author = "David Nichols <david@qore.org>";
url = "http://qore.org";
Expand Down Expand Up @@ -88,6 +88,10 @@ module Util {

@section utilrelnotes Release Notes

@subsection util_1_6_2 Util 1.6.2
- fixed a bug in \c parse_to_qore_value() with floats and numbers with trailing zeros
(<a href="https://github.com/qorelanguage/qore/issues/4349">issue 4349</a>)

@subsection util_1_6_1 Util 1.6.1
- fixed a bug in \c parse_memory_size() with numbers larger than \c 9
(<a href="https://github.com/qorelanguage/qore/issues/4198">issue 4198</a>)
Expand Down Expand Up @@ -613,7 +617,7 @@ bool abs = absolute_path_windows(path);
return;

# see if there is aprocessing cmd
if (*list pc = (arg =~ x/^\%(STR|EVAL)=(.*)$/s)) {
if (*list<*string> pc = (arg =~ x/^\%(STR|EVAL)=(.*)$/s)) {
if (pc[0] == "STR")
return pc[1];
else # must be EVAL
Expand All @@ -629,14 +633,34 @@ bool abs = absolute_path_windows(path);

{
float f = float(arg);
if (f == arg)
if (f == arg) {
return f;
} else if (arg =~ /\.[0-9]*0+$/) {
string arg0 = arg;
arg0 =~ s/0+$//;
if (arg0 =~ /\.$/) {
splice arg0, -1;
}
if (f == arg0) {
return f;
}
}
}

{
number n = number(arg);
if (n == arg)
if (n == arg) {
return n;
} else if (arg =~ /\.[0-9]*0+$/) {
string arg0 = arg;
arg0 =~ s/0+$//;
if (arg0 =~ /\.$/) {
splice arg0, -1;
}
if (n == arg0) {
return n;
}
}
}

if (arg == "True" || arg == "true")
Expand Down

0 comments on commit b6882b8

Please sign in to comment.