TunnelDetailFragment: avoid integer overflow

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-09 12:38:38 -06:00
parent 2e55e5fd05
commit b7b5d96b3b

View File

@ -44,7 +44,7 @@ public class TunnelDetailFragment extends BaseFragment {
return requireContext().getString(R.string.transfer_kibibytes, bytes / 1024.0);
else if (bytes < 1024 * 1024 * 1024)
return requireContext().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 requireContext().getString(R.string.transfer_gibibytes, bytes / (1024.0 * 1024.0 * 1024.0));
return requireContext().getString(R.string.transfer_tibibytes, bytes / (1024.0 * 1024.0 * 1024.0) / 1024.0);
}