diff options
author | stephan <stephan@noemail.net> | 2023-04-21 15:37:33 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2023-04-21 15:37:33 +0000 |
commit | 0e38c6e696620bb3d519c7ca06df7dae4090c1b6 (patch) | |
tree | 1f5b64857618985c42857b494c41799dca6e210f /src | |
parent | 88ed72349030f5e0f79b1dcaab5ff1ae2223a25f (diff) | |
download | sqlite-0e38c6e696620bb3d519c7ca06df7dae4090c1b6.tar.gz sqlite-0e38c6e696620bb3d519c7ca06df7dae4090c1b6.zip |
Change the return type of the ts_read/write() family of functions from int to ssize_t, per report in [forum post 947169d5e7](forum:947169d5e7).
FossilOrigin-Name: 7809e7ce6a70657b8ea239eb4778698f7986a658e9177a57b2fb7814c069c936
Diffstat (limited to 'src')
-rw-r--r-- | src/test_syscall.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/test_syscall.c b/src/test_syscall.c index 947f9a9d9..3cd1034d3 100644 --- a/src/test_syscall.c +++ b/src/test_syscall.c @@ -110,15 +110,15 @@ static int ts_stat(const char *zPath, struct stat *p); static int ts_fstat(int fd, struct stat *p); static int ts_ftruncate(int fd, off_t n); static int ts_fcntl(int fd, int cmd, ... ); -static int ts_read(int fd, void *aBuf, size_t nBuf); -static int ts_pread(int fd, void *aBuf, size_t nBuf, off_t off); +static ssize_t ts_read(int fd, void *aBuf, size_t nBuf); +static ssize_t ts_pread(int fd, void *aBuf, size_t nBuf, off_t off); /* Note: pread64() and pwrite64() actually use off64_t as the type on their ** last parameter. But that datatype is not defined on many systems ** (ex: Mac, OpenBSD). So substitute a likely equivalent: sqlite3_uint64 */ -static int ts_pread64(int fd, void *aBuf, size_t nBuf, sqlite3_uint64 off); -static int ts_write(int fd, const void *aBuf, size_t nBuf); -static int ts_pwrite(int fd, const void *aBuf, size_t nBuf, off_t off); -static int ts_pwrite64(int fd, const void *aBuf, size_t nBuf, sqlite3_uint64 off); +static ssize_t ts_pread64(int fd, void *aBuf, size_t nBuf, sqlite3_uint64 off); +static ssize_t ts_write(int fd, const void *aBuf, size_t nBuf); +static ssize_t ts_pwrite(int fd, const void *aBuf, size_t nBuf, off_t off); +static ssize_t ts_pwrite64(int fd, const void *aBuf, size_t nBuf, sqlite3_uint64 off); static int ts_fchmod(int fd, mode_t mode); static int ts_fallocate(int fd, off_t off, off_t len); static void *ts_mmap(void *, size_t, int, int, int, off_t); @@ -211,7 +211,7 @@ static int tsErrno(const char *zFunc){ /* ** A wrapper around tsIsFail(). If tsIsFail() returns non-zero, set the ** value of errno before returning. -*/ +*/ static int tsIsFailErrno(const char *zFunc){ if( tsIsFail() ){ errno = tsErrno(zFunc); @@ -313,7 +313,7 @@ static int ts_fcntl(int fd, int cmd, ... ){ /* ** A wrapper around read(). */ -static int ts_read(int fd, void *aBuf, size_t nBuf){ +static ssize_t ts_read(int fd, void *aBuf, size_t nBuf){ if( tsIsFailErrno("read") ){ return -1; } @@ -323,7 +323,7 @@ static int ts_read(int fd, void *aBuf, size_t nBuf){ /* ** A wrapper around pread(). */ -static int ts_pread(int fd, void *aBuf, size_t nBuf, off_t off){ +static ssize_t ts_pread(int fd, void *aBuf, size_t nBuf, off_t off){ if( tsIsFailErrno("pread") ){ return -1; } @@ -333,7 +333,7 @@ static int ts_pread(int fd, void *aBuf, size_t nBuf, off_t off){ /* ** A wrapper around pread64(). */ -static int ts_pread64(int fd, void *aBuf, size_t nBuf, sqlite3_uint64 off){ +static ssize_t ts_pread64(int fd, void *aBuf, size_t nBuf, sqlite3_uint64 off){ if( tsIsFailErrno("pread64") ){ return -1; } @@ -343,7 +343,7 @@ static int ts_pread64(int fd, void *aBuf, size_t nBuf, sqlite3_uint64 off){ /* ** A wrapper around write(). */ -static int ts_write(int fd, const void *aBuf, size_t nBuf){ +static ssize_t ts_write(int fd, const void *aBuf, size_t nBuf){ if( tsIsFailErrno("write") ){ if( tsErrno("write")==EINTR ) orig_write(fd, aBuf, nBuf/2); return -1; @@ -354,7 +354,7 @@ static int ts_write(int fd, const void *aBuf, size_t nBuf){ /* ** A wrapper around pwrite(). */ -static int ts_pwrite(int fd, const void *aBuf, size_t nBuf, off_t off){ +static ssize_t ts_pwrite(int fd, const void *aBuf, size_t nBuf, off_t off){ if( tsIsFailErrno("pwrite") ){ return -1; } @@ -364,7 +364,7 @@ static int ts_pwrite(int fd, const void *aBuf, size_t nBuf, off_t off){ /* ** A wrapper around pwrite64(). */ -static int ts_pwrite64(int fd, const void *aBuf, size_t nBuf, sqlite3_uint64 off){ +static ssize_t ts_pwrite64(int fd, const void *aBuf, size_t nBuf, sqlite3_uint64 off){ if( tsIsFailErrno("pwrite64") ){ return -1; } |