Skip to content

Fix compilation with new gcc #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix format-overflow error
Reduced the number of characters for representing the size
of a file to 23. That number was choosen so that up to
999,999,999,999,999,999 bytes or ~999 pb can be
represented including commata.
niclas committed Jan 18, 2022
commit 1c8a6a0fe76dddb7f064cc0a144cfbf6e6fd6a05
9 changes: 6 additions & 3 deletions xwin.c
Original file line number Diff line number Diff line change
@@ -210,6 +210,9 @@ static char defaultTranslations[] = "\
ALL_UNUSED_IMPL(VA_NUM_ARGS(__VA_ARGS__)) \
(__VA_ARGS__)

/* Assuming that there will never be a file lager than 999 petabytes. */
#define MAX_NUMBER_LABEL_LENGTH 23

/*
* action routines
*/
@@ -500,7 +503,7 @@ void xrepaint()

void readable_float(float number, char* number_label)
{
char number_string[1024];
char number_string[MAX_NUMBER_LABEL_LENGTH];
int i, j, length;
sprintf(number_string, "%.2f", number);
length = (strlen(number_string) - 4) / 3 + strlen(number_string);
@@ -517,7 +520,7 @@ void readable_float(float number, char* number_label)

void readable_long_long(long long number, char* number_label)
{
char number_string[1024];
char number_string[MAX_NUMBER_LABEL_LENGTH];
int i, j, length;
sprintf(number_string, "%lld", number);
length = (strlen(number_string) - 1) / 3 + strlen(number_string);
@@ -537,7 +540,7 @@ void xdrawrect(char* name, long long size, int x, int y, int width, int height)
int textx,
texty;
char label[1024];
char number_label[1024];
char number_label[MAX_NUMBER_LABEL_LENGTH];
XCharStruct overall;
int ascent,
descent,