Addressed more issues raised by splint, and corrected some type confusion between off_t and size_t / ssize_t.

This commit is contained in:
Andrew Wood
2023-09-14 22:19:49 +01:00
parent e696b737e3
commit 252213fbc2
8 changed files with 152 additions and 71 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ struct opts_s { /* structure describing run-time options */
bool bytes; /* bytes transferred flag */
bool bits; /* report transfer size in bits */
bool bufpercent; /* transfer buffer percentage flag */
unsigned int lastwritten; /* show N bytes last written */
size_t lastwritten; /* show N bytes last written */
bool force; /* force-if-not-terminal flag */
bool cursor; /* whether to use cursor positioning */
bool numeric; /* numeric output only */
+5 -5
View File
@@ -31,7 +31,7 @@ extern "C" {
#define PV_DISPLAY_OUTPUTBUF 256
#define PV_DISPLAY_FINETA 512
#define RATE_GRANULARITY 100000000.0L /* nsec between -L rate chunks */
#define RATE_GRANULARITY 100000000 /* nsec between -L rate chunks */
#define RATE_BURST_WINDOW 5 /* rate burst window (multiples of rate) */
#define REMOTE_INTERVAL 100000000 /* nsec between checks for -R */
#define BUFFER_SIZE (size_t) 409600 /* default transfer buffer size */
@@ -170,8 +170,8 @@ struct pvstate_s {
off_t initial_offset;
/*@only@*/ char *display_buffer;
long display_buffer_size;
int lastoutput_length; /* number of last-output bytes to show */
unsigned char lastoutput_buffer[PV_SIZEOF_LASTOUTPUT_BUFFER];
size_t lastoutput_length; /* number of last-output bytes to show */
char lastoutput_buffer[PV_SIZEOF_LASTOUTPUT_BUFFER];
int prev_width; /* screen width last time we were called */
int prev_length; /* length of last string we output */
char str_name[PV_SIZEOF_STR_NAME];
@@ -226,7 +226,7 @@ struct pvstate_s {
* is the offset in the buffer that we've written data up to. It
* will always be less than or equal to read_position.
*/
unsigned char *transfer_buffer; /* data transfer buffer */
/*@keep@*/ /*@null@*/ char *transfer_buffer; /* data transfer buffer */
size_t buffer_size; /* size of buffer */
size_t read_position; /* amount of data in buffer */
size_t write_position; /* buffered data written */
@@ -285,7 +285,7 @@ void pv_error(pvstate_t, char *, ...);
int pv_main_loop(pvstate_t);
void pv_display(pvstate_t, long double, off_t, off_t);
off_t pv_transfer(pvstate_t, int, bool *, bool *, off_t, long *);
ssize_t pv_transfer(pvstate_t, int, bool *, bool *, off_t, long *);
int pv_next_file(pvstate_t, unsigned int, int);
/*@out@*/ const char *pv_current_file_name(pvstate_t);
+1 -1
View File
@@ -139,7 +139,7 @@ extern void pv_state_set_format(pvstate_t state, bool progress,
bool fineta, bool rate,
bool average_rate, bool bytes,
bool bufpercent,
unsigned int lastwritten,
size_t lastwritten,
/*@null@*/ const char *name);
/*