all: Code style fixes

This commit is contained in:
Pali Rohár committed 2016-01-23 16:07:02 +01:00
1 parent 62fa041f86
commit fc987674dd
5 files changed
+17 -17

No files matched your search

+2 -2
View File
@@ -224,10 +224,10 @@ static int64_t find_section(void *start, uint64_t count, int want_index, const c
memcpy(sectname, hdr->name, sizeof(hdr->name));
if ( want_index == INDEX_LAST ) {
if ((int)hdr->index <= previous_index)
if ( (int)hdr->index <= previous_index )
goto next;
} else {
if (want_index >= 0 && want_index != hdr->index)
if ( want_index >= 0 && want_index != hdr->index )
goto next;
}
+2 -2
View File
@@ -49,7 +49,7 @@ static void crc32_gentab(void) {
for ( j = 8; j > 0; j-- ) {
if (crc & 1)
if ( crc & 1 )
crc = (crc >> 1) ^ poly;
else
crc >>= 1;
@@ -316,7 +316,7 @@ static int ping_timeout(libusb_device_handle * udev) {
}
if (pong)
if ( pong )
return 0;
else
return -1;
+5 -5
View File
@@ -168,7 +168,7 @@ static void parse_image_arg(char * arg, struct image_list ** image_first) {
}
layout_file = strchr(arg, '%');
if (layout_file)
if ( layout_file )
*(layout_file++) = 0;
type = NULL;
@@ -178,16 +178,16 @@ static void parse_image_arg(char * arg, struct image_list ** image_first) {
layout = NULL;
file = strrchr(arg, ':');
if (file) {
if ( file ) {
*(file++) = 0;
type = strrchr(arg, ':');
if (type) {
if ( type ) {
*(type++) = 0;
version = strrchr(arg, ':');
if (version) {
if ( version ) {
*(version++) = 0;
hwrevs = strchr(arg, ':');
if (hwrevs)
if ( hwrevs )
*(hwrevs++) = 0;
device = arg;
} else {
+1 -1
View File
@@ -82,7 +82,7 @@ struct device_info * dev_detect(void) {
}
clean:
if (usb)
if ( usb )
usb_close_device(usb);
free(dev);
return NULL;
+7 -7
View File
@@ -39,20 +39,20 @@ void printf_progressbar(unsigned long long part, unsigned long long total) {
int tmp, cols = 80;
/* percentage calculation */
pc = total==0?100:(int)(part*100/total);
(pc<0)?pc=0:(pc>100)?pc=100:0;
pc = total == 0 ? 100 : (int)(part*100/total);
( pc < 0 ) ? pc = 0 : ( pc > 100 ) ? pc = 100 : 0;
PRINTF_BACK();
PRINTF_ADD("\x1b[K %3d%% [", pc);
if (columns)
if ( columns )
cols = atoi(columns);
if (cols > 115)
if ( cols > 115 )
cols = 115;
cols-=15;
for(tmp=cols*pc/100;tmp;tmp--) PRINTF_ADD("#");
for(tmp=cols-(cols*pc/100);tmp;tmp--) PRINTF_ADD("-");
for ( tmp = cols*pc/100; tmp; tmp-- ) PRINTF_ADD("#");
for ( tmp = cols-(cols*pc/100); tmp; tmp-- ) PRINTF_ADD("-");
PRINTF_ADD("]");
if (part == total) PRINTF_END();
if ( part == total ) PRINTF_END();
fflush(stdout);
}