[style] mass reformat all the non external code to 4 space indents
Ran everything through scripts/codestyle.space, which uses astyle to generally follow K&R style. Biggest non whitespace change is pulling brackets down on function declarations, which I'm pretty ambivalent about, but astyle insists on taking a stance
This commit is contained in:
@@ -54,29 +54,30 @@ typedef enum {
|
||||
} download_type;
|
||||
|
||||
typedef struct {
|
||||
unsigned char* start;
|
||||
unsigned char* end;
|
||||
unsigned char* max;
|
||||
unsigned char *start;
|
||||
unsigned char *end;
|
||||
unsigned char *max;
|
||||
char name[FNAME_SIZE];
|
||||
download_type type;
|
||||
} download_t;
|
||||
|
||||
static download_t* make_download(const char* name)
|
||||
static download_t *make_download(const char *name)
|
||||
{
|
||||
download_t* d = malloc(sizeof(download_t));
|
||||
download_t *d = malloc(sizeof(download_t));
|
||||
memset(d, 0, sizeof(download_t));
|
||||
strncpy(d->name, name, FNAME_SIZE);
|
||||
return d;
|
||||
}
|
||||
|
||||
static void set_ram_zone(download_t* d, int slot) {
|
||||
static void set_ram_zone(download_t *d, int slot)
|
||||
{
|
||||
d->start = DOWNLOAD_BASE + (DOWNLOAD_SLOT_SIZE * slot);
|
||||
d->end = d->start;
|
||||
d->max = d->end + DOWNLOAD_SLOT_SIZE;
|
||||
memset(d->start, 0, DOWNLOAD_SLOT_SIZE);
|
||||
}
|
||||
|
||||
static size_t output_result(const download_t* download)
|
||||
static size_t output_result(const download_t *download)
|
||||
{
|
||||
size_t len = download->end - download->start;
|
||||
unsigned long crc = crc32(0, download->start, len);
|
||||
@@ -85,9 +86,9 @@ static size_t output_result(const download_t* download)
|
||||
return len;
|
||||
}
|
||||
|
||||
static int run_elf(void* entry_point)
|
||||
static int run_elf(void *entry_point)
|
||||
{
|
||||
void (*elf_start)(void) = (void*)entry_point;
|
||||
void (*elf_start)(void) = (void *)entry_point;
|
||||
printf("elf (%p) running ...\n", entry_point);
|
||||
thread_sleep(10);
|
||||
elf_start();
|
||||
@@ -95,9 +96,9 @@ static int run_elf(void* entry_point)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void process_elf_blob(const void* start, size_t len)
|
||||
static void process_elf_blob(const void *start, size_t len)
|
||||
{
|
||||
void* entrypt;
|
||||
void *entrypt;
|
||||
elf_handle_t elf;
|
||||
|
||||
status_t st = elf_open_handle_memory(&elf, start, len);
|
||||
@@ -112,8 +113,8 @@ static void process_elf_blob(const void* start, size_t len)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
entrypt = (void*)elf.entry;
|
||||
if (entrypt < start || entrypt >= (void*)((char*)start + len)) {
|
||||
entrypt = (void *)elf.entry;
|
||||
if (entrypt < start || entrypt >= (void *)((char *)start + len)) {
|
||||
printf("out of bounds entrypoint for elf : %p\n", entrypt);
|
||||
goto exit;
|
||||
}
|
||||
@@ -125,9 +126,9 @@ exit:
|
||||
elf_close_handle(&elf);
|
||||
}
|
||||
|
||||
int tftp_callback(void* data, size_t len, void* arg)
|
||||
int tftp_callback(void *data, size_t len, void *arg)
|
||||
{
|
||||
download_t* download = arg;
|
||||
download_t *download = arg;
|
||||
size_t final_len;
|
||||
|
||||
if (!data) {
|
||||
@@ -156,7 +157,7 @@ static int loader(int argc, const cmd_args *argv)
|
||||
static int any_slot = 0;
|
||||
static int elf_slot = 1;
|
||||
|
||||
download_t* download;
|
||||
download_t *download;
|
||||
int slot;
|
||||
|
||||
if (!DOWNLOAD_BASE) {
|
||||
@@ -190,7 +191,7 @@ usage:
|
||||
slot = argv[3].i;
|
||||
}
|
||||
|
||||
set_ram_zone(download, slot);
|
||||
set_ram_zone(download, slot);
|
||||
tftp_set_write_client(download->name, &tftp_callback, download);
|
||||
printf("ready for %s over tftp (at %p)\n", argv[2].str, download->start);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user