Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent use of run-time floating point math functions for compile-time integer constants #252

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <float.h>
#include "config.h"
#include "progress.h"
#include "gettext.h"
Expand Down Expand Up @@ -119,12 +119,12 @@ static void calculate_speed(struct progress_bar *prog, unsigned long long copied
char Rformated[12], Eformated[12];
char speed_unit[] = " ";
struct tm *Rtm, *Etm;
uint64_t gibyte = pow(2,30);
uint64_t mibyte = pow(2,20);
uint64_t kibyte = pow(2,10);
uint64_t gbyte = 1000000000.0;
uint64_t mbyte = 1000000;
uint64_t kbyte = 1000;
uint64_t gibyte = UINT64_C(1) << 30;
uint64_t mibyte = UINT64_C(1) << 20;
uint64_t kibyte = UINT64_C(1) << 10;
uint64_t gbyte = UINT64_C(1000000000);
uint64_t mbyte = UINT64_C(1000000);
uint64_t kbyte = UINT64_C(1000);
int spflen = 0;
int prefered_bits_size = prog->binary_prefix;

Expand Down