Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0fa6884

Browse files
Fix sign-compare warnings in pg_iovec.h.
The code in question (pg_preadv() and pg_pwritev()) has been aroundfor a while, but commit15c9ac3 moved it to a header file. Ifthird-party code that includes this header file is built with-Wsign-compare on a system without preadv() or pwritev(), warningsensue. This commit fixes said warnings by casting the result ofpg_pread()/pg_pwrite() to size_t, which should be safe because wewill have already checked for a negative value.Author: Wolfgang WaltherDiscussion:https://postgr.es/m/16989737-1aa8-48fd-8dfe-b7ada06509ab%40technowledgy.deBackpatch-through: 17
1 parentcaca6d8 commit0fa6884

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/include/port/pg_iovec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
6868
}
6969
sum+=part;
7070
offset+=part;
71-
if (part<iov[i].iov_len)
71+
if ((size_t)part<iov[i].iov_len)
7272
returnsum;
7373
}
7474
returnsum;
@@ -107,7 +107,7 @@ pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
107107
}
108108
sum+=part;
109109
offset+=part;
110-
if (part<iov[i].iov_len)
110+
if ((size_t)part<iov[i].iov_len)
111111
returnsum;
112112
}
113113
returnsum;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp