[evolution-data-server] Mute a compiler warning from e_collator_generate_key()



commit 7e1bd41f8db077dfeb8f64c98beaa28ef92c13ce
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 5 13:38:39 2017 +0200

    Mute a compiler warning from e_collator_generate_key()
    
    Nothing great, just give it large enough buffer. The warning in question was:
    
    In function ‘e_collator_generate_key’:
    src/libedataserver/e-collator.c:524:37: warning: ‘snprintf’ output truncated before the last format 
character [-Wformat-truncation=]
       snprintf (collation_key, 4, "%03d-", alphabet_index);
                                         ^
    src/libedataserver/e-collator.c:524:3: note: ‘snprintf’ output between 5 and 13 bytes into a destination 
of size 4
       snprintf (collation_key, 4, "%03d-", alphabet_index);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 src/libedataserver/e-collator.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/libedataserver/e-collator.c b/src/libedataserver/e-collator.c
index d7c8f69..334b8f1 100644
--- a/src/libedataserver/e-collator.c
+++ b/src/libedataserver/e-collator.c
@@ -521,7 +521,7 @@ e_collator_generate_key (ECollator *collator,
                collation_key = g_malloc (key_len + 5);
 
                /* Format the alphabetic index into the first 4 chars */
-               snprintf (collation_key, 4, "%03d-", alphabet_index);
+               snprintf (collation_key, key_len, "%03d-", alphabet_index);
 
                /* Get the sort key and put it in &collation_key[4] */
                ucol_getSortKey (


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]