diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2009-08-26 14:25:20 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2009-08-26 14:25:20 +0200 |
commit | 4e80effe0ec3edcef9e2f240864eacab9cdbb035 (patch) | |
tree | 16a747db7165db3e6cd6f4e0056b7f12cace7db5 /export_xml.c | |
parent | 2ecd826602bd7a83aac609fbc65c32544062f426 (diff) |
Replace sprintf with snprintf
Diffstat (limited to 'export_xml.c')
-rw-r--r-- | export_xml.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/export_xml.c b/export_xml.c index ffdeffc..4485f9d 100644 --- a/export_xml.c +++ b/export_xml.c @@ -24,7 +24,7 @@ int export_xml(struct channel_t *channel, struct user_t *users) { xmlNodePtr hour_node = xmlNewChild(lines_node, NULL, "hour", NULL); for(int q = 0; q < 4; q++) { char s[0xf]; - sprintf(s, "%d", channel->hours[h*4 + q]); + snprintf(s, 0xf, "%d", channel->hours[h*4 + q]); xmlNewChild(hour_node, NULL, "quarter", s); } } @@ -39,7 +39,7 @@ int export_xml(struct channel_t *channel, struct user_t *users) { xmlNodePtr user_node = xmlNewChild(users_node, NULL, "user", NULL); xmlNewChild(user_node, NULL, "nick", user->nick); - sprintf(s, "%d", user->words); + snprintf(s, 0xf, "%d", user->words); xmlNewChild(user_node, NULL, "words", s); /* Add lines for this user. */ @@ -47,7 +47,7 @@ int export_xml(struct channel_t *channel, struct user_t *users) { for(int h = 0; h < 24; h++) { xmlNodePtr hour_node = xmlNewChild(lines_node, NULL, "hour", NULL); for(int q = 0; q < 4; q++) { - sprintf(s, "%d", user->lines[h*4 + q]); + snprintf(s, 0xf, "%d", user->lines[h*4 + q]); xmlNewChild(hour_node, NULL, "quarter", s); } } @@ -64,7 +64,7 @@ int export_xml(struct channel_t *channel, struct user_t *users) { xmlNodePtr word_node = xmlNewChild(words_node, NULL, "word", NULL); xmlNewChild(word_node, NULL, "name", word->name); - sprintf(s, "%d", word->count); + snprintf(s, 0xf, "%d", word->count); xmlNewChild(word_node, NULL, "count", s); word = word->next; |