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 5a09d6a3ac
commit c2849fc4b1

View File

@@ -594,6 +594,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
#endif /* __MINGW32__ */
#endif