From 22f39b9d262b82de7123fc700c3f9b479600a93f Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 16 Apr 2013 13:55:27 -0300 Subject: [PATCH] tftp.c: use symbolic constant for block size --- software/bios/tftp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/software/bios/tftp.c b/software/bios/tftp.c index ff34cc24..2ceadb94 100644 --- a/software/bios/tftp.c +++ b/software/bios/tftp.c @@ -15,6 +15,9 @@ enum { TFTP_ERROR = 5, /* Error */ }; +#define BLOCK_SIZE 512 /* block size in bytes */ + + static int format_request(uint8_t *buf, uint16_t op, const char *filename) { int len = strlen(filename); @@ -63,11 +66,11 @@ static void rx_callback(uint32_t src_ip, uint16_t src_port, if(block < 1) return; if(opcode == TFTP_DATA) { /* Data */ length -= 4; - offset = (block-1)*512; + offset = (block-1)*BLOCK_SIZE; for(i=0;i