Development discussion of WireGuard
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: "François Guerraz" <kubrick@fgv6.net>
Cc: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: [PATCH][wireguard-android] fix formatBytes to be able to display gibibytes
Date: Wed, 26 Feb 2020 07:14:08 +0800	[thread overview]
Message-ID: <CAHmME9psPiU3CzK=jhjP3y8eE2UuoB0V9UafT2Pic8bcvcp33Q@mail.gmail.com> (raw)
In-Reply-To: <CA+zF5m=eFUxsg+7nQCjYEmM-6rGdsOnov3a5VkC+me6iM7Y+yQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1590 bytes --]

Thanks. Can you resend this with your Signed-off-by line?

On Wed, Feb 26, 2020, 07:12 François Guerraz <kubrick@fgv6.net> wrote:

> The default type for literal numerals is int, not long it, therefore
> 1024*1024*1024*1024
> overflows and
>     bytes < 1024*1024*1024*1024
> is always false.
> Therefore, GiBi is never displayed and switches to TiBi immediately.
> ---
> diff --git
> a/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java
>
> b/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java
> index 57e0d8e..bc0726a 100644
> ---
> a/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java
> +++
> b/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java
> @@ -115,7 +115,7 @@ public class TunnelDetailFragment extends BaseFragment
> {
>              return
> getContext().getString(R.string.transfer_kibibytes, bytes/1024.0);
>          else if (bytes < 1024*1024*1024)
>              return
> getContext().getString(R.string.transfer_mibibytes,
> bytes/(1024.0*1024.0));
> -        else if (bytes < 1024*1024*1024*1024)
> +        else if (bytes < 1024*1024*1024*1024L)
>              return
> getContext().getString(R.string.transfer_gibibytes,
> bytes/(1024.0*1024.0*1024.0));
>          return getContext().getString(R.string.transfer_tibibytes,
> bytes/(1024.0*1024.0*1024.0)/1024.0);
>      }
> _______________________________________________
> WireGuard mailing list
> WireGuard@lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/wireguard
>

[-- Attachment #1.2: Type: text/html, Size: 2133 bytes --]

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

      reply	other threads:[~2020-02-25 23:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 22:41 François Guerraz
2020-02-25 23:14 ` Jason A. Donenfeld [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHmME9psPiU3CzK=jhjP3y8eE2UuoB0V9UafT2Pic8bcvcp33Q@mail.gmail.com' \
    --to=jason@zx2c4.com \
    --cc=kubrick@fgv6.net \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).