Skip to content

Commit

Permalink
More consistent code style
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerHann authored and Wollac committed May 17, 2019
1 parent 3041344 commit a8941f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/ui/nano/nano_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,9 @@ void nano_draw_address_digest()
format_address_abbrev(addr, nano_get_text_buffer(TOP));
format_address_checksum(addr, nano_get_text_buffer(BOT));

if (ui_state.state == STATE_BUNDLE)
if (ui_state.state == STATE_BUNDLE) {
NANO_DRAW_ELEMENTS(EL_UP);
}

#ifdef TARGET_NANOS
NANO_DRAW_ELEMENTS(EL_DOWN, EL_CONFIRM);
Expand Down
8 changes: 4 additions & 4 deletions src/ui/ui_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ static size_t format_s64(char *s, const size_t n, const int64_t val)
}

if (ABS(val) < MAX_INT_DEC) {
snprintf(s, n, "%d", (int)ABS(val));
snprintf(s, n, "%d", (int)val);
}
else {
// emulate printing of integers larger than 32 bit
snprintf(s, n, "%d%09d", (int)(ABS(val) / MAX_INT_DEC),
snprintf(s, n, "%d%09d", (int)(val / MAX_INT_DEC),
(int)(ABS(val) % MAX_INT_DEC));
}
return strnlen(s, n);
Expand All @@ -66,7 +66,7 @@ void format_value_full(char *s, const unsigned int n, const int64_t val)
{
char buffer[n];

const size_t num_len = format_s64(buffer, sizeof(buffer), val);
const size_t num_len = format_s64(buffer, sizeof(buffer), ABS(val));
const size_t num_len_comma = num_len + (num_len - 1) / 3;

// if the length with commas plus the unit does not fit
Expand All @@ -82,7 +82,7 @@ void format_value_full(char *s, const unsigned int n, const int64_t val)
void format_value_short(char *s, const unsigned int n, int64_t val)
{
if (ABS(val) < 1000) {
snprintf(s, n, "%d %s", (int)ABS(val), IOTA_UNITS[0]);
snprintf(s, n, "%d %s", (int)(ABS(val)), IOTA_UNITS[0]);
return;
}

Expand Down

0 comments on commit a8941f2

Please sign in to comment.