]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/atp/atp_packet.c
Previous fix 9e4e07c1811edbaf3376ad6e238a1353b405002b resulted in the inability to...
[netatalk.git] / libatalk / atp / atp_packet.c
index 994c775b1e9fa296762aa807a36789fe03c0e7fc..a7fae01b565ab59f6960386a7e62285b3c786621 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: atp_packet.c,v 1.4 2001-08-15 02:17:57 srittau Exp $
+ * $Id: atp_packet.c,v 1.6 2009-10-13 22:55:37 didg Exp $
  *
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
@@ -52,8 +52,7 @@
 #ifdef EBUG
 #include <stdio.h>
 
-static void print_func( ctrlinfo )
-    u_int8_t   ctrlinfo;
+static void print_func(u_int8_t ctrlinfo)
 {
     switch ( ctrlinfo & ATP_FUNCMASK ) {
     case ATP_TREQ:
@@ -73,9 +72,7 @@ static void print_func( ctrlinfo )
     }
 }
 
-static void dump_packet( buf, len )
-    char       *buf;
-    int                len;
+static void dump_packet(char *buf, int len)
 {
     int                i;
 
@@ -85,9 +82,7 @@ static void dump_packet( buf, len )
     putchar( '\n' );
 }
 
-void atp_print_addr( s, saddr )
-    char               *s;
-    struct sockaddr_at *saddr;
+void atp_print_addr(char *s, struct sockaddr_at *saddr)
 {
     printf( "%s ", s );
     saddr->sat_family == AF_APPLETALK ? printf( "at." ) :
@@ -121,7 +116,7 @@ void atp_build_req_packet( struct atpbuf *pktbuf,
 
     /* set length
     */
-    pktbuf->atpbuf_dlen = ATP_HDRSIZE + atpb->atp_sreqdlen;
+    pktbuf->atpbuf_dlen = ATP_HDRSIZE + (size_t) atpb->atp_sreqdlen;
 }
 
 void atp_build_resp_packet( struct atpbuf *pktbuf,
@@ -145,7 +140,7 @@ void atp_build_resp_packet( struct atpbuf *pktbuf,
 
     /* set length
     */
-    pktbuf->atpbuf_dlen = ATP_HDRSIZE + atpb->atp_sresiov[ seqnum ].iov_len;
+    pktbuf->atpbuf_dlen = ATP_HDRSIZE + (size_t) atpb->atp_sresiov[ seqnum ].iov_len;
 }
 
 
@@ -205,7 +200,7 @@ atp_recv_atp( ATP ah,
     if ( cq != NULL ) {
        /* we found one in the queue -- copy to rbuf
        */
-       dlen = cq->atpbuf_dlen;
+       dlen = (int) cq->atpbuf_dlen;
        *func = rfunc;
        memcpy( fromaddr, &cq->atpbuf_addr, sizeof( struct sockaddr_at ));
        memcpy( rbuf, cq->atpbuf_info.atpbuf_data, cq->atpbuf_dlen );
@@ -301,7 +296,7 @@ atp_recv_atp( ATP ah,
                memcpy( &inbuf->atpbuf_addr, &faddr, 
                        sizeof( struct sockaddr_at ));
                inbuf->atpbuf_next = ah->atph_queue;
-               inbuf->atpbuf_dlen = recvlen;
+               inbuf->atpbuf_dlen = (size_t) recvlen;
                memcpy( inbuf->atpbuf_info.atpbuf_data, rbuf, recvlen );
            }
        }
@@ -315,9 +310,9 @@ atp_recv_atp( ATP ah,
 }
 
 
-int at_addr_eq( paddr, saddr )
-    struct sockaddr_at *paddr;         /* primary address */
-    struct sockaddr_at *saddr;         /* secondary address */
+int at_addr_eq( 
+    struct sockaddr_at *paddr,         /* primary address */
+    struct sockaddr_at *saddr)         /* secondary address */
 {
 /* compare two atalk addresses -- only check the non-zero fields
     of paddr against saddr.