poke-devel
[Top][All Lists]
Advanced

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

[COMMITED] doc: fix variable's type in code snippet in manual


From: Mohammad-Reza Nabipoor
Subject: [COMMITED] doc: fix variable's type in code snippet in manual
Date: Wed, 7 Jul 2021 04:55:23 +0430

From: "Guillermo E. Martinez" <guillermo.e.martinez@oracle.com>

declaring int b[4] and using read (fd, &b[i], 1),
just read the first 8-bits for an integer variable
(32-bits wide). So doing the OR and bit shift operations
doesn't warranty that most significat bits are zeros,
and the computed number value is not right.

2021-07-04  Guillermo E. Martinez  <guillermo.e.martinez@oracle.com>

        * doc/poke.texi (Decode-Compute-Encode): Fix `double_number`
        function: s/int/unsigned char/ for bytes.
---

Hi, Guillermo!

Thanks for the patch.
I fixed your fix a little bit :)
And also added a ChangeLog entry.

Pushed both to master and maint/poke-1 as a trivial change.


Regards,
Mohammad-Reza


 ChangeLog     | 5 +++++
 doc/poke.texi | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 76ea7c5d..c1879867 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2021-07-04  Guillermo E. Martinez  <guillermo.e.martinez@oracle.com>
+
+       * doc/poke.texi (Decode-Compute-Encode): Fix `double_number`
+       function: s/int/unsigned char/ for bytes.
+
 2021-06-06  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
 
        * common/pk-utils.h (pk_format_binary): New function declaration.
diff --git a/doc/poke.texi b/doc/poke.texi
index 975c39b0..1187d137 100644
--- a/doc/poke.texi
+++ b/doc/poke.texi
@@ -309,7 +309,7 @@ multiply it by two, and store the result at the same offset.
 void double_number (int fd, off_t offset, int endian)
 @{
    int number, i;
-   int b[4];
+   unsigned char b[4];
 
    /* Decode.  */
    lseek (fd, offset, SEEK_SET);
-- 
2.32.0




reply via email to

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