From: bernie Date: Thu, 12 Aug 2004 23:34:36 +0000 (+0000) Subject: Replace if/else with continue to reduce indentation level. X-Git-Tag: 1.0.0~1107 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=77f3d952385cd7b9bd02ed7e9dacf2021b0a5bdd;p=bertos.git Replace if/else with continue to reduce indentation level. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@134 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/mware/xmodem.c b/mware/xmodem.c index ffb078c5..2adfb28d 100755 --- a/mware/xmodem.c +++ b/mware/xmodem.c @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.3 2004/08/12 23:34:36 bernie + * Replace if/else with continue to reduce indentation level. + * * Revision 1.2 2004/08/12 23:24:07 bernie * Rename UPDCRC() to UPDCRC16(). * @@ -395,39 +398,40 @@ bool xmodem_send(KFile *fd) while (!proceed); if (!size) + { ser_putchar(XM_EOT); - else + continue; + } + + /* Pad block with 0xFF if it's partially full */ + if (size < XM_BUFSIZE) + for (i = size; i < XM_BUFSIZE; i++) + block_buffer[i] = (char)0xFF; + + /* Send block header (STX, blocknr, ~blocknr) */ + ser_putchar(XM_STX); + ser_putchar(blocknr & 0xFF); + ser_putchar(~blocknr & 0xFF); + + /* Send block and compute its CRC/checksum */ + sum = 0; + crc = 0; + for (i = 0; i < XM_BUFSIZE; i++) { - /* Pad block with 0xFF if it's partially full */ - if (size < XM_BUFSIZE) - for (i = size; i < XM_BUFSIZE; i++) - block_buffer[i] = (char)0xFF; - - /* Send block header (STX, blocknr, ~blocknr) */ - ser_putchar(XM_STX); - ser_putchar(blocknr & 0xFF); - ser_putchar(~blocknr & 0xFF); - - /* Send block and compute its CRC/checksum */ - sum = 0; - crc = 0; - for (i = 0; i < XM_BUFSIZE; i++) - { - ser_putchar(block_buffer[i]); - crc = UPDCRC16(block_buffer[i], crc); - sum += block_buffer[i]; - } + ser_putchar(block_buffer[i]); + crc = UPDCRC16(block_buffer[i], crc); + sum += block_buffer[i]; + } - /* Send CRC/Checksum */ - if (usecrc) - { - crc = UPDCRC16(0, crc); - crc = UPDCRC16(0, crc); - ser_putchar(crc >> 8); - ser_putchar(crc & 0xFF); - } - else - ser_putchar(sum); + /* Send CRC/Checksum */ + if (usecrc) + { + crc = UPDCRC16(0, crc); + crc = UPDCRC16(0, crc); + ser_putchar(crc >> 8); + ser_putchar(crc & 0xFF); } + else + ser_putchar(sum); } }