lib: fix formatting nits (part 3)

From `lib/h` to `lib/w`.

part 1: 47a1ab2ebe #19764
part 2: 86b346443b #19800

Closes #19811
This commit is contained in:
Viktor Szakats 2025-12-02 07:25:18 +01:00
parent dc8c0d54a5
commit c3b030b860
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
102 changed files with 2001 additions and 2226 deletions

View file

@ -87,7 +87,7 @@ static char *max6data(curl_off_t bytes, char *max6)
/* xxx.yU */
curl_msnprintf(max6, 7, "%3" CURL_FORMAT_CURL_OFF_T
".%" CURL_FORMAT_CURL_OFF_T "%c", nbytes,
(bytes%1024) / (1024/10), unit[k]);
(bytes % 1024) / (1024 / 10), unit[k]);
}
return max6;
}
@ -351,7 +351,7 @@ void Curl_pgrsSetUploadSize(struct Curl_easy *data, curl_off_t size)
void Curl_pgrsEarlyData(struct Curl_easy *data, curl_off_t sent)
{
data->progress.earlydata_sent = sent;
data->progress.earlydata_sent = sent;
}
/* returns the average speed in bytes / second */
@ -360,7 +360,7 @@ static curl_off_t trspeed(curl_off_t size, /* number of bytes */
{
if(us < 1)
return size * 1000000;
else if(size < CURL_OFF_T_MAX/1000000)
else if(size < CURL_OFF_T_MAX / 1000000)
return (size * 1000000) / us;
else if(us >= 1000000)
return size / (us / 1000000);
@ -422,18 +422,18 @@ static bool progress_calc(struct Curl_easy *data, struct curltime *pnow)
((i_latest + 1) % CURL_SPEED_RECORDS);
/* How much we transferred between oldest and current records */
amount = p->speed_amount[i_latest]- p->speed_amount[i_oldest];
amount = p->speed_amount[i_latest] - p->speed_amount[i_oldest];
/* How long this took */
duration_ms = curlx_timediff_ms(p->speed_time[i_latest],
p->speed_time[i_oldest]);
if(duration_ms <= 0)
duration_ms = 1;
if(amount > (CURL_OFF_T_MAX/1000)) {
if(amount > (CURL_OFF_T_MAX / 1000)) {
/* the 'amount' value is bigger than would fit in 64 bits if
multiplied with 1000, so we use the double math for this */
p->current_speed = (curl_off_t)
(((double)amount * 1000.0)/(double)duration_ms);
p->current_speed =
(curl_off_t)(((double)amount * 1000.0) / (double)duration_ms);
}
else {
/* the 'amount' value is small enough to fit within 32 bits even
@ -459,7 +459,7 @@ static curl_off_t pgrs_est_percent(curl_off_t total, curl_off_t cur)
if(total > 10000)
return cur / (total / 100);
else if(total > 0)
return (cur*100) / total;
return (cur * 100) / total;
return 0;
}
@ -488,7 +488,7 @@ static void progress_meter(struct Curl_easy *data)
char time_left[10];
char time_total[10];
char time_spent[10];
curl_off_t cur_secs = (curl_off_t)p->timespent/1000000; /* seconds */
curl_off_t cur_secs = (curl_off_t)p->timespent / 1000000; /* seconds */
if(!p->headers_out) {
if(data->state.resume_from) {
@ -516,11 +516,9 @@ static void progress_meter(struct Curl_easy *data)
time2str(time_spent, cur_secs);
/* Get the total amount of data expected to get transferred */
total_expected_size =
p->ul_size_known ? p->ul.total_size : p->ul.cur_size;
total_expected_size = p->ul_size_known ? p->ul.total_size : p->ul.cur_size;
dl_size =
p->dl_size_known ? p->dl.total_size : p->dl.cur_size;
dl_size = p->dl_size_known ? p->dl.total_size : p->dl.cur_size;
/* integer overflow check */
if((CURL_OFF_T_MAX - total_expected_size) < dl_size)
@ -561,7 +559,6 @@ static void progress_meter(struct Curl_easy *data)
#define progress_meter(x) Curl_nop_stmt
#endif
/*
* Curl_pgrsUpdate() returns 0 for success or the value returned by the
* progress callback!