compings warings. and some did have wrong protypes.

0. fix warning: passing arg 1 of `send' as unsigned due to prototype
1. fix warning: passing arg 3 of `memcpy' as unsigned due to prototype
2. fix warning: passing arg 3 of `send' as signed due to prototype
3. fix warning: unused variable `bytes_written'
4. fix warning: dereferencing type-punned
    pointer will break strict-aliasing rules

5. fix warning: dereferencing type-punned
   pointer will break strict-aliasing rules

svn path=/trunk/; revision=10779
This commit is contained in:
Magnus Olsen 2004-09-03 16:49:18 +00:00
parent d6740a2c10
commit c203723e4f
2 changed files with 10 additions and 10 deletions

View file

@ -29,21 +29,20 @@
#include "adns.h"
int adns_writev(int FileDescriptor, const struct iovec * iov, int iovCount)
int adns_writev(SOCKET FileDescriptor, const struct iovec * iov, int iovCount)
{
size_t total_len = 0;
int bytes_written = 0;
int total_len = 0;
int i = 0, r = 0;
char *buf = NULL, *p = NULL;
for(; i < iovCount; i++)
total_len += iov[i].iov_len;
p = buf = (char *)alloca(total_len);
p = buf = (char *)alloca( (size_t) total_len);
for(; i < iovCount; i++)
{
memcpy(p, iov[i].iov_base, iov[i].iov_len);
memcpy(p, iov[i].iov_base, (size_t) iov[i].iov_len);
p += iov[i].iov_len;
}
@ -68,11 +67,12 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
{
static __int64 Adjustment;
__int64 Now = 0;
if (!Adjustment)
{
SYSTEMTIME st = {1970,1,3,0,0,0,0};
SystemTimeToFileTime(&st, (LPFILETIME)&Adjustment);
{
SYSTEMTIME st = {1970,1,3,0,0,0,0};
SystemTimeToFileTime(&st, ((LPFILETIME)(VOID *)&Adjustment));
}
if (tz)
@ -81,7 +81,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
return -1;
}
GetSystemTimeAsFileTime((LPFILETIME)&Now);
GetSystemTimeAsFileTime(((LPFILETIME)(VOID *)&Now));
Now -= Adjustment;
tv->tv_sec = (long)(Now / 100000000);

View file

@ -129,7 +129,7 @@ struct timezone; /* XXX arty */
* Undef ADNS_MAP_UNIXAPI in the calling code to use natve calls
*/
ADNS_API int adns_gettimeofday(struct timeval *tv, struct timezone *tz);
ADNS_API int adns_writev (int FileDescriptor, const struct iovec * iov, int iovCount);
ADNS_API int adns_writev (SOCKET FileDescriptor, const struct iovec * iov, int iovCount);
ADNS_API int adns_inet_aton(const char *cp, struct in_addr *inp);
ADNS_API int adns_getpid();