mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Fix ntohl() related warnings about printf formatting
On Windows, ntohl() returns unsinged long. On Unix it returns uint32_t. This makes choosing a suitable printf format string hard. This commit introduces a mingw specific helper function git_ntohl() that casts to unsigned int before returning. This makes gcc's printf format check happy. It should be safe because we expect ntohl to use 32-bit numbers. Signed-off-by: Steffen Prohaska <prohaska@zib.de>
This commit is contained in:
@@ -593,6 +593,10 @@ static inline int mingw_fcntl(int fd, int cmd, long arg)
|
||||
{ return cmd == F_GETFD || cmd == F_SETFD ? 0 : (errno = EINVAL, -1); }
|
||||
#define fcntl mingw_fcntl
|
||||
|
||||
static inline unsigned int git_ntohl(unsigned int x)
|
||||
{ return (unsigned int)ntohl(x); }
|
||||
#define ntohl git_ntohl
|
||||
|
||||
extern __attribute__((noreturn)) int git_exit(int code);
|
||||
#define exit git_exit
|
||||
|
||||
|
||||
Reference in New Issue
Block a user