Changeset 2094 for Whitix/branches

Show
Ignore:
Timestamp:
05/27/10 12:20:46 (21 months ago)
Author:
mwhitworth
Message:

Fix UDP warnings.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/netchannel/user/sdk/network/dns.c

    r2086 r2094  
    66#include <types.h> 
    77#include <string.h> 
     8#include <stdio.h> 
     9 
     10#include "udp.h" 
    811 
    912/* Protocol structures. */ 
     
    4851} 
    4952 
    50 int DnsPutName(char* buf, char* name) 
     53int DnsPutName(char* buf, const char* name) 
    5154{ 
    5255        int total = 0; 
     
    7477} 
    7578 
    76 void DnsAddQuery(struct DnsState* state, char* name, int type) 
     79void DnsAddQuery(struct DnsState* state, const char* name, int type) 
    7780{ 
    7881        struct DnsQuestionEnd* end; 
     
    179182} 
    180183 
     184int DnsSkipRecord(struct DnsState* state, struct DnsAnswer* answer) 
     185{ 
     186        return sizeof(struct DnsAnswer) + NetToHostShort(answer->length); 
     187} 
     188 
    181189int DnsGetCanonicalName(struct DnsState* state, char* name, int length, int 
    182190                start) 
     
    204212} 
    205213 
    206 int DnsSkipRecord(struct DnsState* state, struct DnsAnswer* answer) 
    207 { 
    208         ushort type = NetToHostShort(answer->type); 
    209                  
    210         return sizeof(struct DnsAnswer) + NetToHostShort(answer->length); 
    211 } 
    212  
    213214int DnsGetIpAddresses(struct DnsState* state, ulong* address, int 
    214215                start) 
    215216{ 
    216         int i, length; 
    217         char* p; 
     217        int i; 
    218218        struct DnsAnswer* answer = (struct DnsAnswer*)(state->buf+state->offset); 
    219219 
     
    226226        for (i = start; i < state->answers; i++) 
    227227        { 
     228                ushort class = NetToHostShort(answer->class); 
    228229                ushort type = NetToHostShort(answer->type); 
    229                 ushort class = NetToHostShort(answer->class); 
    230                 ushort len = NetToHostShort(answer->length); 
    231230         
    232231                if (class != DNS_CLASS_IN) 
     
    282281        length = DnsFinishHeader(&state); 
    283282                 
    284         if (SocketSendTo(dnsSocket, buf, length, 0, &dnsAddr) < length) 
     283        if (SocketSendTo(dnsSocket, buf, length, 0, (struct SockAddr*)&dnsAddr) < length) 
    285284                return 1; 
    286285                 
    287286        length = 1024; 
    288287 
    289         if ((length = SocketRecvFrom(dnsSocket, buf, length, dnsAddr)) <= 0) 
     288        if ((length = SocketRecvFrom(dnsSocket, buf, length, 0, (struct SockAddr*)&dnsAddr)) <= 0) 
    290289                return 1; 
    291290