From aafb3ef8d734af1012545ab9e32a05fb0d56de09 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 16 Apr 2013 13:55:25 -0300 Subject: [PATCH] tftp.c: use uintNN_t instead of "unsigned short", etc. --- software/bios/tftp.c | 21 +++++++++++---------- software/bios/tftp.h | 4 +++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/software/bios/tftp.c b/software/bios/tftp.c index 8e255b0f..e1a8fb52 100644 --- a/software/bios/tftp.c +++ b/software/bios/tftp.c @@ -1,3 +1,4 @@ +#include #include #include "microudp.h" @@ -14,7 +15,7 @@ enum { TFTP_ERROR = 5, /* Error */ }; -static int format_request(unsigned char *buf, const char *filename) +static int format_request(uint8_t *buf, const char *filename) { int len = strlen(filename); @@ -32,7 +33,7 @@ static int format_request(unsigned char *buf, const char *filename) return 9+strlen(filename); } -static int format_ack(unsigned char *buf, unsigned short block) +static int format_ack(uint8_t *buf, uint16_t block) { *buf++ = 0x00; /* Opcode: Ack */ *buf++ = TFTP_ACK; @@ -41,17 +42,17 @@ static int format_ack(unsigned char *buf, unsigned short block) return 4; } -static unsigned char *packet_data; +static uint8_t *packet_data; static int total_length; static int transfer_finished; -static unsigned char *dst_buffer; +static uint8_t *dst_buffer; -static void rx_callback(unsigned int src_ip, unsigned short src_port, - unsigned short dst_port, void *_data, unsigned int length) +static void rx_callback(uint32_t src_ip, uint16_t src_port, + uint16_t dst_port, void *_data, unsigned int length) { - unsigned char *data = (unsigned char *)_data; - unsigned short opcode; - unsigned short block; + uint8_t *data = _data; + uint16_t opcode; + uint16_t block; int i; int offset; @@ -78,7 +79,7 @@ static void rx_callback(unsigned int src_ip, unsigned short src_port, } } -int tftp_get(unsigned int ip, const char *filename, void *buffer) +int tftp_get(uint32_t ip, const char *filename, void *buffer) { int len; int tries; diff --git a/software/bios/tftp.h b/software/bios/tftp.h index 53a6cba6..a32837f1 100644 --- a/software/bios/tftp.h +++ b/software/bios/tftp.h @@ -1,7 +1,9 @@ #ifndef __TFTP_H #define __TFTP_H -int tftp_get(unsigned int ip, const char *filename, void *buffer); +#include + +int tftp_get(uint32_t ip, const char *filename, void *buffer); #endif /* __TFTP_H */ -- 2.30.2