minor: coding style fixes

This commit is contained in:
goldsimon 2016-07-05 07:36:51 +02:00
parent cb5f7859fd
commit 14ca418ac0
21 changed files with 155 additions and 160 deletions

View File

@ -403,8 +403,7 @@ static void copy_file(const char *filename_in, FILE *fout)
exit(-1); exit(-1);
} }
buf = malloc(COPY_BUFSIZE); buf = malloc(COPY_BUFSIZE);
while((len = fread(buf, 1, COPY_BUFSIZE, fin)) > 0) while ((len = fread(buf, 1, COPY_BUFSIZE, fin)) > 0) {
{
fwrite(buf, 1, len, fout); fwrite(buf, 1, len, fout);
} }
free(buf); free(buf);
@ -493,8 +492,7 @@ u8_t* get_file_data(const char* filename, int* file_size, int can_be_compressed,
} }
fseek(inFile, 0, SEEK_END); fseek(inFile, 0, SEEK_END);
rs = ftell(inFile); rs = ftell(inFile);
if(rs < 0) if (rs < 0) {
{
printf("ftell failed with %d\n", errno); printf("ftell failed with %d\n", errno);
exit(-1); exit(-1);
} }
@ -643,8 +641,7 @@ static int is_valid_char_for_c_var(char x)
if (((x >= 'A') && (x <= 'Z')) || if (((x >= 'A') && (x <= 'Z')) ||
((x >= 'a') && (x <= 'z')) || ((x >= 'a') && (x <= 'z')) ||
((x >= '0') && (x <= '9')) || ((x >= '0') && (x <= '9')) ||
(x == '_')) (x == '_')) {
{
return 1; return 1;
} }
return 0; return 0;
@ -921,14 +918,12 @@ int file_write_http_header(FILE *data_file, const char *filename, int file_size,
memset(&stat_data, 0, sizeof(stat_data)); memset(&stat_data, 0, sizeof(stat_data));
cur_string = modbuf; cur_string = modbuf;
strcpy(modbuf, "Last-Modified: "); strcpy(modbuf, "Last-Modified: ");
if(stat(filename, &stat_data) != 0) if (stat(filename, &stat_data) != 0) {
{
printf("stat(%s) failed with error %d\n", filename, errno); printf("stat(%s) failed with error %d\n", filename, errno);
exit(-1); exit(-1);
} }
t = gmtime(&stat_data.st_mtime); t = gmtime(&stat_data.st_mtime);
if(t == NULL) if (t == NULL) {
{
printf("gmtime() failed with error %d\n", errno); printf("gmtime() failed with error %d\n", errno);
exit(-1); exit(-1);
} }