summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-01-08 03:05:09 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2010-01-08 03:05:09 +0100
commit82dfadb950a52bbc0cdccb5b8f224a8b49b79ea3 (patch)
tree50d1c80881fd3ea412aba4cb3a9d5efeb33717ac
parente3ecfb708fa6f868fd15a34ac74cad17082c9e7a (diff)
Fixed compiler warnings.
Upgraded word_t's count to long long.
-rw-r--r--export_xml.c62
-rw-r--r--word.h2
2 files changed, 32 insertions, 32 deletions
diff --git a/export_xml.c b/export_xml.c
index 1bacc5c..7bc9c3d 100644
--- a/export_xml.c
+++ b/export_xml.c
@@ -12,26 +12,26 @@
int export_xml(struct channel_t *channel, struct user_t *users) {
/* Create document and set root node. */
- xmlDocPtr doc = xmlNewDoc("1.0");
- xmlNodePtr root_node = xmlNewNode(NULL, "channel");
+ xmlDocPtr doc = xmlNewDoc((const xmlChar*)"1.0");
+ xmlNodePtr root_node = xmlNewNode(NULL, (const xmlChar*)"channel");
xmlDocSetRootElement(doc, root_node);
/* Set the channel name. */
- xmlNewChild(root_node, NULL, "name", channel->name);
+ xmlNewChild(root_node, NULL, (const xmlChar*)"name", (const xmlChar*)channel->name);
/* Add lines. */
- xmlNodePtr lines_node = xmlNewChild(root_node, NULL, "lines", NULL);
+ xmlNodePtr lines_node = xmlNewChild(root_node, NULL, (const xmlChar*)"lines", NULL);
for(int h = 0; h < 24; h++) {
- xmlNodePtr hour_node = xmlNewChild(lines_node, NULL, "hour", NULL);
+ xmlNodePtr hour_node = xmlNewChild(lines_node, NULL, (const xmlChar*)"hour", NULL);
for(int q = 0; q < 4; q++) {
char s[0xf];
- snprintf(s, 0xf, "%d", channel->hours[h*4 + q]);
- xmlNewChild(hour_node, NULL, "quarter", s);
+ snprintf(s, 0xf, "%lu", channel->hours[h*4 + q]);
+ xmlNewChild(hour_node, NULL, (const xmlChar*)"quarter", (const xmlChar*)s);
}
}
/* Add users. */
- xmlNodePtr users_node = xmlNewChild(root_node, NULL, "users", NULL);
+ xmlNodePtr users_node = xmlNewChild(root_node, NULL, (const xmlChar*)"users", NULL);
for(int u = 0; u < USERS_MAX; u++) {
struct user_t *user = &users[u];
/* Iterate while we have a user (nick is non-NULL). */
@@ -42,29 +42,29 @@ int export_xml(struct channel_t *channel, struct user_t *users) {
continue;
}
char s[0xf];
- xmlNodePtr user_node = xmlNewChild(users_node, NULL, "user", NULL);
+ xmlNodePtr user_node = xmlNewChild(users_node, NULL, (const xmlChar*)"user", NULL);
- xmlNewChild(user_node, NULL, "nick", user->nick);
- snprintf(s, 0xf, "%d", user->words);
- xmlNewChild(user_node, NULL, "words", s);
- snprintf(s, 0xf, "%d", user->characters);
- xmlNewChild(user_node, NULL, "characters", s);
- snprintf(s, 0xf, "%d", user->kicks);
- xmlNewChild(user_node, NULL, "kicks", s);
- snprintf(s, 0xf, "%d", user->kicked);
- xmlNewChild(user_node, NULL, "kicked", s);
- snprintf(s, 0xf, "%d", user->monolog_lines);
- xmlNewChild(user_node, NULL, "monolog_lines", s);
- snprintf(s, 0xf, "%d", user->monologs);
- xmlNewChild(user_node, NULL, "monologs", s);
+ xmlNewChild(user_node, NULL, (const xmlChar*)"nick", (xmlChar*)user->nick);
+ snprintf(s, 0xf, "%llu", user->words);
+ xmlNewChild(user_node, NULL, (const xmlChar*)"words", (const xmlChar*)s);
+ snprintf(s, 0xf, "%llu", user->characters);
+ xmlNewChild(user_node, NULL, (const xmlChar*)"characters", (const xmlChar*)s);
+ snprintf(s, 0xf, "%llu", user->kicks);
+ xmlNewChild(user_node, NULL, (const xmlChar*)"kicks", (const xmlChar*)s);
+ snprintf(s, 0xf, "%llu", user->kicked);
+ xmlNewChild(user_node, NULL, (const xmlChar*)"kicked", (const xmlChar*)s);
+ snprintf(s, 0xf, "%llu", user->monolog_lines);
+ xmlNewChild(user_node, NULL, (const xmlChar*)"monolog_lines", (const xmlChar*)s);
+ snprintf(s, 0xf, "%llu", user->monologs);
+ xmlNewChild(user_node, NULL, (const xmlChar*)"monologs", (const xmlChar*)s);
/* Add lines for this user. */
- xmlNodePtr lines_node = xmlNewChild(user_node, NULL, "lines", NULL);
+ xmlNodePtr lines_node = xmlNewChild(user_node, NULL, (const xmlChar*)"lines", NULL);
for(int h = 0; h < 24; h++) {
- xmlNodePtr hour_node = xmlNewChild(lines_node, NULL, "hour", NULL);
+ xmlNodePtr hour_node = xmlNewChild(lines_node, NULL, (const xmlChar*)"hour", NULL);
for(int q = 0; q < 4; q++) {
- snprintf(s, 0xf, "%d", user->lines[h*4 + q]);
- xmlNewChild(hour_node, NULL, "quarter", s);
+ snprintf(s, 0xf, "%lu", user->lines[h*4 + q]);
+ xmlNewChild(hour_node, NULL, (const xmlChar*)"quarter", (const xmlChar*)s);
}
}
user = user->next;
@@ -72,16 +72,16 @@ int export_xml(struct channel_t *channel, struct user_t *users) {
}
/* Add words. */
- xmlNodePtr words_node = xmlNewChild(root_node, NULL, "words", NULL);
+ xmlNodePtr words_node = xmlNewChild(root_node, NULL, (const xmlChar*)"words", NULL);
for(int w = 0; w < WORDS_MAX; w++) {
struct word_t *word = &words[w];
while(word && word->name) {
char s[0xf];
- xmlNodePtr word_node = xmlNewChild(words_node, NULL, "word", NULL);
+ xmlNodePtr word_node = xmlNewChild(words_node, NULL, (const xmlChar*)"word", NULL);
- xmlNewChild(word_node, NULL, "name", word->name);
- snprintf(s, 0xf, "%d", word->count);
- xmlNewChild(word_node, NULL, "count", s);
+ xmlNewChild(word_node, NULL, (const xmlChar*)"name", (const xmlChar*)word->name);
+ snprintf(s, 0xf, "%llu", word->count);
+ xmlNewChild(word_node, NULL, (const xmlChar*)"count", (const xmlChar*)s);
word = word->next;
}
diff --git a/word.h b/word.h
index 1b0f579..adceefa 100644
--- a/word.h
+++ b/word.h
@@ -6,7 +6,7 @@
struct word_t {
unsigned long hash;
char *name;
- unsigned long count;
+ unsigned long long count;
struct word_t *next;
};