From b1aae66daad8f5b07fb886feb8e5a9a70c3383d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ho=C3=A0=20Vi=C3=AAt=20Dinh?= Date: Sun, 6 May 2001 12:47:27 +0000 Subject: [PATCH] scoring - bugfix for summaryview --- ChangeLog.claws | 8 ++++++++ src/summaryview.c | 6 ++++-- src/utils.c | 15 ++++++++++++--- src/utils.h | 1 + 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index 3c59b6d10..624e998d4 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,11 @@ +2001-05-06 [hoa] + + * src/utils.[ch] + added function itos_buf() to enable use of several buffers + * src/summaryview.c + use of itos_buf() instead of itos() in summary list + to fix the broken display of message number. + 2001-05-06 [alfons] * src/gtkstext.c: bug in cursor up navigation fixed, diff --git a/src/summaryview.c b/src/summaryview.c index 13bc81db1..8712c2e96 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -1536,13 +1536,15 @@ static void summary_set_header(gchar *text[], MsgInfo *msginfo) { static gchar date_modified[80]; static gchar *to = NULL; + static gchar col_number[11]; + static gchar col_score[11]; text[S_COL_MARK] = NULL; text[S_COL_UNREAD] = NULL; text[S_COL_MIME] = NULL; - text[S_COL_NUMBER] = itos(msginfo->msgnum); + text[S_COL_NUMBER] = itos_buf(col_number, msginfo->msgnum); text[S_COL_SIZE] = to_human_readable(msginfo->size); - text[S_COL_SCORE] = itos(msginfo->score); + text[S_COL_SCORE] = itos_buf(col_score, msginfo->score); if (msginfo->date_t) { procheader_date_get_localtime(date_modified, diff --git a/src/utils.c b/src/utils.c index 5052db1d9..62e95ad71 100644 --- a/src/utils.c +++ b/src/utils.c @@ -106,13 +106,22 @@ gint to_number(const gchar *nstr) return atoi(nstr); } -/* convert integer into string */ +/* convert integer into string + nstr must be a 11 characters table +*/ +gchar *itos_buf(gchar nstr[], gint n) +{ + g_snprintf(nstr, 11, "%d", n); + return nstr; +} + +/* convert integer into string + use an internal static buffer */ gchar *itos(gint n) { static gchar nstr[11]; - g_snprintf(nstr, 11, "%d", n); - return nstr; + return itos_buf(nstr, n); } gchar *to_human_readable(off_t size) diff --git a/src/utils.h b/src/utils.h index b591b72e1..630c190eb 100644 --- a/src/utils.h +++ b/src/utils.h @@ -131,6 +131,7 @@ void ptr_array_free_strings (GPtrArray *array); /* number-string conversion */ gint to_number (const gchar *nstr); gchar *itos (gint n); +gchar *itos_buf (gchar nstr[], gint n); gchar *to_human_readable (off_t size); /* alternative string functions */ -- 2.25.1