Tidy up comments.
This commit is contained in:
@@ -25,20 +25,20 @@ pvdisplay_bytecount_t pv_formatter_average_rate(pvformatter_args_t args)
|
||||
|
||||
/*@-mustfreefresh@ */
|
||||
if (args->control->numeric) {
|
||||
/* numeric - raw value without suffix. */
|
||||
/* Numeric - raw value without suffix. */
|
||||
(void) pv_snprintf(content, sizeof(content),
|
||||
"%.4Lf", ((args->control->bits ? 8.0 : 1.0) * args->calc->average_rate));
|
||||
} else if (args->control->bits && !args->control->linemode) {
|
||||
/* bits per second */
|
||||
/* Bits per second. */
|
||||
pv_describe_amount(content, sizeof(content),
|
||||
"(%s)", 8 * args->calc->average_rate, "", _("b/s"), args->display->count_type);
|
||||
} else {
|
||||
/* bytes or lines per second */
|
||||
/* Bytes or lines per second. */
|
||||
pv_describe_amount(content,
|
||||
sizeof(content), "(%s)", args->calc->average_rate, _("/s"), _("B/s"),
|
||||
args->display->count_type);
|
||||
}
|
||||
/*@+mustfreefresh@ *//* splint: see above. */
|
||||
/*@+mustfreefresh@ *//* splint - false positive from gettext(). */
|
||||
|
||||
return pv_formatter_segmentcontent(content, args);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ static bool pv_barstyle(pvformatter_args_t args, pvbarstyle_t style, const char
|
||||
}
|
||||
/*
|
||||
* flawfinder - strlen() on null-terminated static strings is OK,
|
||||
* and with the memcpy(), we check the buffer is big enough.
|
||||
* and with the memcpy(), the buffer size has been checked.
|
||||
*/
|
||||
|
||||
memset(style, 0, sizeof(*style));
|
||||
@@ -169,7 +169,7 @@ pvdisplay_bytecount_t pv_formatter_bar_default(pvformatter_args_t args)
|
||||
if (NULL == default_name)
|
||||
default_name = "plain";
|
||||
/*@+branchstate@ */
|
||||
/* splint - it doesn't matter that default_name may be static */
|
||||
/* splint - it doesn't matter that default_name may be static. */
|
||||
args->segment->parameter = 1 + pv_display_barstyle_index(args, default_name);
|
||||
}
|
||||
return pv_formatter_progress_bar_only(args);
|
||||
|
||||
+3
-3
@@ -35,8 +35,8 @@ pvdisplay_bytecount_t pv_formatter_eta(pvformatter_args_t args)
|
||||
args->control->size - args->display->initial_offset, args->calc->current_avg_rate);
|
||||
|
||||
/*
|
||||
* Bounds check, so we don't overrun the suffix buffer. This means
|
||||
* the ETA will always be less than 100,000 hours.
|
||||
* Bounds check, to keep within the suffix buffer. This means the
|
||||
* ETA will always be less than 100,000 hours.
|
||||
*/
|
||||
eta = pv_bound_long(eta, 0, (long) 360000000L);
|
||||
|
||||
@@ -55,7 +55,7 @@ pvdisplay_bytecount_t pv_formatter_eta(pvformatter_args_t args)
|
||||
sizeof(content),
|
||||
"%.16s %ld:%02ld:%02ld", _("ETA"), eta / 3600, (eta / 60) % 60, eta % 60);
|
||||
}
|
||||
/*@+mustfreefresh@ *//* splint: see above. */
|
||||
/*@+mustfreefresh@ *//* splint: false positives from gettext(). */
|
||||
|
||||
/*
|
||||
* If this is the final update, show a blank space where the ETA
|
||||
|
||||
@@ -78,7 +78,7 @@ pvdisplay_bytecount_t pv_formatter_fineta(pvformatter_args_t args)
|
||||
|
||||
/*@-mustfreefresh@ */
|
||||
(void) pv_snprintf(content, sizeof(content), "%.16s ", _("FIN"));
|
||||
/*@+mustfreefresh@ *//* splint: see above. */
|
||||
/*@+mustfreefresh@ *//* splint: false positive from gettext(). */
|
||||
content_bytes = strlen(content); /* flawfinder: ignore */
|
||||
/* flawfinder: always bounded with \0 by pv_snprintf(). */
|
||||
(void) strftime(content + content_bytes, sizeof(content) - 1 - content_bytes, time_format, &time);
|
||||
|
||||
+11
-11
@@ -24,8 +24,8 @@
|
||||
} \
|
||||
}
|
||||
/*
|
||||
* flawfinder - we are checking that there is room in the destination
|
||||
* buffer, given its size and our current offset.
|
||||
* flawfinder - the byte count and offset are checked against the buffer
|
||||
* size before memcpy() is called.
|
||||
*/
|
||||
|
||||
|
||||
@@ -87,15 +87,15 @@ static pvdisplay_bytecount_t pv_formatter_progress_knownsize(pvformatter_args_t
|
||||
|
||||
/*@-mustfreefresh@ */
|
||||
if (args->control->bits && !args->control->linemode) {
|
||||
/* bits per second */
|
||||
/* Bits per second. */
|
||||
pv_describe_amount(after_bar, sizeof(after_bar), "/%s",
|
||||
8.0 * args->calc->rate_max, "", _("b/s"), args->display->count_type);
|
||||
} else {
|
||||
/* bytes or lines per second */
|
||||
/* Bytes or lines per second. */
|
||||
pv_describe_amount(after_bar, sizeof(after_bar),
|
||||
"/%s", args->calc->rate_max, _("/s"), _("B/s"), args->display->count_type);
|
||||
}
|
||||
/*@+mustfreefresh@ *//* splint: see above about gettext(). */
|
||||
/*@+mustfreefresh@ *//* splint: false positives from gettext(). */
|
||||
}
|
||||
|
||||
if (!include_amount)
|
||||
@@ -113,7 +113,7 @@ static pvdisplay_bytecount_t pv_formatter_progress_knownsize(pvformatter_args_t
|
||||
if (buffer_size < after_bar_bytes)
|
||||
return 0;
|
||||
if (after_bar_bytes > 1) {
|
||||
/* NB we skip the leading space. */
|
||||
/* NB skip the leading space. */
|
||||
memmove(buffer, after_bar + 1, after_bar_bytes - 1);
|
||||
buffer[after_bar_bytes - 1] = '\0';
|
||||
return after_bar_bytes - 1;
|
||||
@@ -161,7 +161,7 @@ static pvdisplay_bytecount_t pv_formatter_progress_knownsize(pvformatter_args_t
|
||||
pad_count += style->tip.width;
|
||||
}
|
||||
|
||||
/* A partial cell, if there are intermediates and we're not at 100%. */
|
||||
/* A partial cell, if below 100% and there are intermediates. */
|
||||
if (pad_count < bar_area_width && full_cell_index > 1 && !has_tip) {
|
||||
double exact_width = (((double) bar_area_width) * bar_percentage) / 100.0;
|
||||
double cell_portion = exact_width - (double) filled_bar_width;
|
||||
@@ -242,8 +242,8 @@ static pvdisplay_bytecount_t pv_formatter_progress_unknownsize(pvformatter_args_
|
||||
/*
|
||||
* Note that pv_calculate_transfer_rate() sets the percentage when
|
||||
* the size is unknown to a value that goes 0 - 200 and resets, so
|
||||
* here we make values above 100 send the indicator back down again,
|
||||
* so it moves back and forth.
|
||||
* here this is used make values above 100 send the indicator back
|
||||
* down again, so it moves back and forth.
|
||||
*/
|
||||
indicator_position = args->calc->percentage;
|
||||
if (indicator_position > 200.0)
|
||||
@@ -319,7 +319,7 @@ pvdisplay_bytecount_t pv_formatter_progress(pvformatter_args_t args)
|
||||
if (NULL == default_name)
|
||||
default_name = "plain";
|
||||
/*@+branchstate@ */
|
||||
/* splint - it doesn't matter that default_name may be static */
|
||||
/* splint - it doesn't matter that default_name may be static. */
|
||||
args->segment->parameter = 1 + pv_display_barstyle_index(args, default_name);
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ pvdisplay_bytecount_t pv_formatter_progress_bar_only(pvformatter_args_t args)
|
||||
if (NULL == default_name)
|
||||
default_name = "plain";
|
||||
/*@+branchstate@ */
|
||||
/* splint - it doesn't matter that default_name may be static */
|
||||
/* splint - it doesn't matter that default_name may be static. */
|
||||
args->segment->parameter = 1 + pv_display_barstyle_index(args, default_name);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,19 +27,19 @@ pvdisplay_bytecount_t pv_formatter_rate(pvformatter_args_t args)
|
||||
|
||||
/*@-mustfreefresh@ */
|
||||
if (args->control->numeric) {
|
||||
/* numeric - raw value without suffix. */
|
||||
/* Numeric - raw value without suffix. */
|
||||
(void) pv_snprintf(content, sizeof(content),
|
||||
"%.4Lf", ((args->control->bits ? 8.0 : 1.0) * args->calc->transfer_rate));
|
||||
} else if (args->control->bits && !args->control->linemode) {
|
||||
/* bits per second */
|
||||
/* Bits per second. */
|
||||
pv_describe_amount(content, sizeof(content), "[%s]",
|
||||
8 * args->calc->transfer_rate, "", _("b/s"), args->display->count_type);
|
||||
} else {
|
||||
/* bytes or lines per second */
|
||||
/* Bytes or lines per second. */
|
||||
pv_describe_amount(content, sizeof(content),
|
||||
"[%s]", args->calc->transfer_rate, _("/s"), _("B/s"), args->display->count_type);
|
||||
}
|
||||
/*@+mustfreefresh@ *//* splint: see above. */
|
||||
/*@+mustfreefresh@ *//* splint - false positives from gettext(). */
|
||||
|
||||
return pv_formatter_segmentcontent(content, args);
|
||||
}
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ struct sgr_keyword_map_s {
|
||||
return keywords;
|
||||
/*@+compmempass@ */
|
||||
/*
|
||||
* splint - found no other way to pass static back without a false
|
||||
* splint - no other way to pass static back without a false
|
||||
* positive warning about a memory leak.
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ pvdisplay_bytecount_t pv_formatter_timer(pvformatter_args_t args)
|
||||
elapsed_seconds = args->transfer->elapsed_seconds;
|
||||
|
||||
/*
|
||||
* Bounds check, so we don't overrun the prefix buffer. This does
|
||||
* mean that the timer will stop at a 100,000 hours, but since
|
||||
* that's 11 years, it shouldn't be a problem.
|
||||
* Bounds check, to stay within the prefix buffer. This does mean
|
||||
* that the timer will stop at a 100,000 hours, but since that's 11
|
||||
* years, it shouldn't be a problem.
|
||||
*/
|
||||
if (elapsed_seconds > (long double) 360000000.0L)
|
||||
elapsed_seconds = (long double) 360000000.0L;
|
||||
|
||||
Reference in New Issue
Block a user