gpsd-dev
[Top][All Lists]
Advanced

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

Re: long long unsigned on 32-bit machines


From: Bernd Zeimetz
Subject: Re: long long unsigned on 32-bit machines
Date: Sun, 26 Jan 2020 15:21:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1


On 1/26/20 2:21 PM, Sanjeev Gupta wrote:> I think we should wait for
Bernd to chime in.

That is just the fix for the change before - unsigned long is still not
64bit on 32bit. I can't remember how I stumbled across it, but I guess
some tool pointed it out.

After looking at the code again - I have no idea why there is something
else than a simple int needed.



commit b1b555e0cb37382655a3a7cb37f2f89cb89eda7a
Author: Gary E. Miller <address@hidden>
Date:   Thu Oct 10 12:19:28 2019 -0700

    monitor_italk.c: 32-bit unsigned too small by one.

    Problem found by cpplint

diff --git a/monitor_italk.c b/monitor_italk.c
index 8da7e17ea..6ee79cbf0 100644
--- a/monitor_italk.c
+++ b/monitor_italk.c
@@ -160,11 +160,11 @@ static void display_itk_navfix(unsigned char *buf,
size_t len)
     (void)wmove(navfixwin, 11, 6);
     {
        char prn[4], satlist[38];
-       unsigned int i;
+       unsigned long i;         // unsigned long just in case ints are
32-bit
        satlist[0] = '\0';
        for (i = 0; i < 32; i++) {
            if (svlist & (1 << i)) {
-               (void)snprintf(prn, 4, "%u ", i + 1);
+               (void)snprintf(prn, 4, "%lu ", i + 1);
                (void)strlcat(satlist, prn, sizeof(satlist));
            }
        }


> 
> --
> Sanjeev

-- 
 Bernd Zeimetz                            Debian GNU/Linux Developer
 http://bzed.de                                http://www.debian.org
 GPG Fingerprint: ECA1 E3F2 8E11 2432 D485  DD95 EB36 171A 6FF9 435F



reply via email to

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