diff options
author | Explorer09 <explorer09@gmail.com> | 2023-12-27 06:38:10 +0800 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2023-12-29 16:50:03 +0100 |
commit | e5c09ffd96b5be5f11c7918a922ccc9a085e9cae (patch) | |
tree | 40ed10a9e6e01bad3baa5c9e21a1f62b4417b140 /Row.c | |
parent | e9cf230aa04689047ac95d1fe0613800d71934d9 (diff) |
Row_printTime() code shrink
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Diffstat (limited to 'Row.c')
-rw-r--r-- | Row.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -350,12 +350,12 @@ void Row_printTime(RichString* str, unsigned long long totalHundredths, bool col if (totalMinutes < 60) { unsigned int hundredths = totalHundredths % 100; - len = xSnprintf(buffer, sizeof(buffer), "%2llu:%02u.%02u ", totalMinutes, seconds, hundredths); + len = xSnprintf(buffer, sizeof(buffer), "%2u:%02u.%02u ", (unsigned int)totalMinutes, seconds, hundredths); RichString_appendnAscii(str, baseColor, buffer, len); return; } if (totalHours < 24) { - len = xSnprintf(buffer, sizeof(buffer), "%2lluh", totalHours); + len = xSnprintf(buffer, sizeof(buffer), "%2uh", (unsigned int)totalHours); RichString_appendnAscii(str, hourColor, buffer, len); len = xSnprintf(buffer, sizeof(buffer), "%02u:%02u ", minutes, seconds); RichString_appendnAscii(str, baseColor, buffer, len); @@ -365,7 +365,7 @@ void Row_printTime(RichString* str, unsigned long long totalHundredths, bool col unsigned long long totalDays = totalHours / 24; unsigned int hours = totalHours % 24; if (totalDays < 10) { - len = xSnprintf(buffer, sizeof(buffer), "%1llud", totalDays); + len = xSnprintf(buffer, sizeof(buffer), "%1ud", (unsigned int)totalDays); RichString_appendnAscii(str, dayColor, buffer, len); len = xSnprintf(buffer, sizeof(buffer), "%02uh", hours); RichString_appendnAscii(str, hourColor, buffer, len); @@ -374,7 +374,7 @@ void Row_printTime(RichString* str, unsigned long long totalHundredths, bool col return; } if (totalDays < /* Ignore leap years */365) { - len = xSnprintf(buffer, sizeof(buffer), "%4llud", totalDays); + len = xSnprintf(buffer, sizeof(buffer), "%4ud", (unsigned int)totalDays); RichString_appendnAscii(str, dayColor, buffer, len); len = xSnprintf(buffer, sizeof(buffer), "%02uh ", hours); RichString_appendnAscii(str, hourColor, buffer, len); @@ -384,15 +384,15 @@ void Row_printTime(RichString* str, unsigned long long totalHundredths, bool col unsigned long long years = totalDays / 365; unsigned int days = totalDays % 365; if (years < 1000) { - len = xSnprintf(buffer, sizeof(buffer), "%3lluy", years); + len = xSnprintf(buffer, sizeof(buffer), "%3uy", (unsigned int)years); RichString_appendnAscii(str, yearColor, buffer, len); len = xSnprintf(buffer, sizeof(buffer), "%03ud ", days); RichString_appendnAscii(str, dayColor, buffer, len); } else if (years < 10000000) { - len = xSnprintf(buffer, sizeof(buffer), "%7lluy ", years); + len = xSnprintf(buffer, sizeof(buffer), "%7luy ", (unsigned long)years); RichString_appendnAscii(str, yearColor, buffer, len); } else { - RichString_appendnAscii(str, yearColor, "eternity ", 9); + RichString_appendAscii(str, yearColor, "eternity "); } } |