gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4317-g5843187


From: Andrew J. Schorr
Subject: [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4317-g5843187
Date: Mon, 27 Sep 2021 10:26:39 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-5.1-stable has been updated
       via  58431879b19a1b1cd5ff3a6575be07c46c73db39 (commit)
      from  d249840cccab9490a5fd9580ba5aa6181930bca5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=58431879b19a1b1cd5ff3a6575be07c46c73db39

commit 58431879b19a1b1cd5ff3a6575be07c46c73db39
Author: Andrew J. Schorr <aschorr@telemetry-investments.com>
Date:   Mon Sep 27 10:26:15 2021 -0400

    Patch ord function to avoid returning negative values.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index f4e6ea4..d795260 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2021-09-27         Andrew J. Schorr      <aschorr@telemetry-investments.com>
+
+       * ordchr.c (do_ord): Need to cast to unsigned char to avoid returning
+       negative values.
+
 2021-09-22         Arnold D. Robbins     <arnold@skeeve.com>
 
        * configure.ac: Update version to 5.1.1 in preparation for release.
diff --git a/extension/ordchr.c b/extension/ordchr.c
index e1afade..d367988 100644
--- a/extension/ordchr.c
+++ b/extension/ordchr.c
@@ -67,7 +67,7 @@ do_ord(int nargs, awk_value_t *result, struct awk_ext_func 
*unused)
        assert(result != NULL);
 
        if (get_argument(0, AWK_STRING, & str)) {
-               ret = str.str_value.str[0];
+               ret = (unsigned char)str.str_value.str[0];
        } else if (do_lint)
                lintwarn(ext_id, _("ord: first argument is not a string"));
 
diff --git a/test/ChangeLog b/test/ChangeLog
index 18025e7..553ba2b 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2021-09-27         Andrew J. Schorr      <aschorr@telemetry-investments.com>
+
+       * ordchr.awk, ordchr.awk: Add test for ord signedness.
+
 2021-09-19         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.am (EXTRA_DIST): Remove commas.in from the list.
diff --git a/test/ordchr.awk b/test/ordchr.awk
index 0295105..5d6ffe9 100644
--- a/test/ordchr.awk
+++ b/test/ordchr.awk
@@ -7,4 +7,5 @@ BEGIN {
    # test if type conversion between strings and numbers is working properly
    print chr(ord(0))
    print ord(chr("65"))
+   print ord(chr("159"))
 }
diff --git a/test/ordchr.ok b/test/ordchr.ok
index 86d901e..be3997c 100644
--- a/test/ordchr.ok
+++ b/test/ordchr.ok
@@ -3,3 +3,4 @@ A
 65
 0
 65
+159

-----------------------------------------------------------------------

Summary of changes:
 extension/ChangeLog | 5 +++++
 extension/ordchr.c  | 2 +-
 test/ChangeLog      | 4 ++++
 test/ordchr.awk     | 1 +
 test/ordchr.ok      | 1 +
 5 files changed, 12 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]