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:
Steffen Prohaska
2007-11-17 19:16:53 +01:00
parent 43664aa169
commit 329bdf025b

View File

@@ -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