Author: uwe Date: 2007-07-02 22:57:45 +0200 (Mon, 02 Jul 2007) New Revision: 430
Modified: LinuxBIOSv3/util/lar/bootblock.c LinuxBIOSv3/util/lar/create.c LinuxBIOSv3/util/lar/extract.c Log: Coding style fixes via 'indent' (trivial).
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: LinuxBIOSv3/util/lar/bootblock.c =================================================================== --- LinuxBIOSv3/util/lar/bootblock.c 2007-06-30 22:55:10 UTC (rev 429) +++ LinuxBIOSv3/util/lar/bootblock.c 2007-07-02 20:57:45 UTC (rev 430) @@ -48,11 +48,11 @@ */ if (bootblock_len != BOOTBLOCK_SIZE) { printf("Warning: %s does not seem to be a bootblock, " - "so ignore it\n", bootblock); - bootblock_code=NULL; - bootblock_len=0; + "so ignore it\n", bootblock); + bootblock_code = NULL; + bootblock_len = 0; // Is this an error condition? - } + }
bootblock_code = malloc(bootblock_len); if (!bootblock_code) { @@ -78,13 +78,12 @@ uint32_t *size_pos;
/* This cleans out the area after the reset vector */ - for(i=13; i>0; i--) + for (i = 13; i > 0; i--) bootblock_code[bootblock_len - i] = '\0'; - + /* add lar size to image */ - size_pos=(uint32_t *)(bootblock_code+bootblock_len-12); + size_pos = (uint32_t *) (bootblock_code + bootblock_len - 12); size_pos[0] = get_larsize();
return 0; } -
Modified: LinuxBIOSv3/util/lar/create.c =================================================================== --- LinuxBIOSv3/util/lar/create.c 2007-06-30 22:55:10 UTC (rev 429) +++ LinuxBIOSv3/util/lar/create.c 2007-07-02 20:57:45 UTC (rev 430) @@ -36,13 +36,15 @@
extern enum compalgo algo;
-void compress_impossible(char *in, u32 in_len, char *out, u32 *out_len) { +void compress_impossible(char *in, u32 in_len, char *out, u32 *out_len) +{ fprintf(stderr, "The selected compression algorithm wasn't compiled in.\n"); exit(1); }
-void do_no_compress(char *in, u32 in_len, char *out, u32 *out_len) { +void do_no_compress(char *in, u32 in_len, char *out, u32 *out_len) +{ memcpy(out, in, in_len); out_len[0] = in_len; } @@ -116,7 +118,7 @@ header = (struct lar_header *)tempmem; pathname = tempmem + sizeof(struct lar_header); pathlen = snprintf(pathname, MAX_PATHLEN - 1, name) + 1; - pathlen = (pathlen + 15) & 0xfffffff0;/* Align to 16 bytes. */ + pathlen = (pathlen + 15) & 0xfffffff0; /* Align to 16 bytes. */
/* Read file into memory. */ filebuf = malloc(filelen); @@ -184,15 +186,17 @@
if (bootblock_len) { if (verbose()) - printf ("Detected bootblock of %d bytes\n", bootblock_len); + printf("Detected bootblock of %d bytes\n", + bootblock_len);
bb_header_len = sizeof(struct lar_header) + - ((strlen(basename(get_bootblock()))+15) & 0xfffffff0); + ((strlen(basename(get_bootblock())) + 15) & 0xfffffff0);
bb_header_len = (bb_header_len + 15) & 0xfffffff0;
if (verbose()) - printf ("Required bootblock header of %d bytes\n", bb_header_len); + printf("Required bootblock header of %d bytes\n", + bb_header_len);
diff -= bootblock_len; diff -= bb_header_len; @@ -239,15 +243,15 @@ struct lar_header *bb;
bootblock_header = malloc(bb_header_len); - if(!bootblock_header) { + if (!bootblock_header) { fprintf(stderr, "Out of memory.\n"); exit(1); }
- memset (bootblock_header, 0, bb_header_len); + memset(bootblock_header, 0, bb_header_len);
/* construct header */ - bb=(struct lar_header *)bootblock_header; + bb = (struct lar_header *)bootblock_header; memcpy(bb->magic, MAGIC, 8); bb->reallen = htonl(bootblock_len); bb->len = htonl(bootblock_len); @@ -258,8 +262,8 @@ /* Write filename. we calculated the buffer size, * so no overflow danger here. */ - strcpy(bootblock_header+sizeof(struct lar_header), - basename(get_bootblock()) ); + strcpy(bootblock_header + sizeof(struct lar_header), + basename(get_bootblock()));
fwrite(bootblock_header, bb_header_len, 1, archive); fwrite(bootblock_code, bootblock_len, 1, archive);
Modified: LinuxBIOSv3/util/lar/extract.c =================================================================== --- LinuxBIOSv3/util/lar/extract.c 2007-06-30 22:55:10 UTC (rev 429) +++ LinuxBIOSv3/util/lar/extract.c 2007-07-02 20:57:45 UTC (rev 430) @@ -33,13 +33,15 @@ #include "lib.h" #include "lar.h"
-void uncompress_impossible(char *dst, char *src, u32 len) { +void uncompress_impossible(char *dst, char *src, u32 len) +{ fprintf(stderr, "Cannot uncompress data (algorithm not compiled in).\n"); exit(1); }
-void do_no_uncompress(char *dst, char *src, u32 len) { +void do_no_uncompress(char *dst, char *src, u32 len) +{ memcpy(dst, src, len); }
@@ -117,7 +119,7 @@ if (pos) { pos[1] = 0; /* printf("Pathname %s\n",pathname); */ - mkdirp(pathname,0755); + mkdirp(pathname, 0755); } free(pathname);
@@ -133,8 +135,7 @@ } else { char *buf = malloc(ntohl(header->reallen)); uncompress_functions[ntohl(header->compression)](buf, - walk + ntohl(header->offset), - ntohl(header->len)); + walk + ntohl(header->offset), ntohl(header->len)); fwrite(buf, ntohl(header->reallen), 1, file_to_extract); free(buf); }