Permalink
Browse files

* More bobbens paranoia around long ints and saving and such.

  • Loading branch information...
1 parent 3987a22 commit c378356e1ce376a9fe71f5ab2948d45ec53c6c4d @bobbens committed Aug 21, 2012
Showing with 7 additions and 4 deletions.
  1. +3 −0 src/naev.h
  2. +4 −4 src/news.c
View
3 src/naev.h
@@ -83,6 +83,9 @@
#ifndef PRIu64
# define PRIu64 "%ju" /**< Illegal, evil and probably eats babies too. */
#endif
+#ifndef PRIi64
+# define PRIi64 "%jd" /**< Illegal, evil and probably eats babies too. */
+#endif
/*
View
8 src/news.c
@@ -575,8 +575,8 @@ int news_saveArticles( xmlTextWriterPtr writer )
xmlw_attr(writer,"title","%s",ntitle);
xmlw_attr(writer,"desc","%s",ndesc);
xmlw_attr(writer,"faction","%s",article_ptr->faction);
- xmlw_attr(writer,"date","%li",(int64_t) article_ptr->date);
- xmlw_attr(writer,"date_to_rm","%li",(int64_t) article_ptr->date_to_rm);
+ xmlw_attr(writer,"date", "%"PRIi64, article_ptr->date);
+ xmlw_attr(writer,"date_to_rm", "%"PRIi64, article_ptr->date_to_rm);
xmlw_attr(writer,"id","%i",article_ptr->id);
if (article_ptr->tag!=NULL)
@@ -680,15 +680,15 @@ static int news_parseArticle( xmlNodePtr parent )
WARN("Event has missing date attribute, skipping.");
continue;
}
- date = atol(buff);
+ date = atoll(buff);
free(buff);
xmlr_attr(node,"date_to_rm",buff);
if (faction==NULL) {
free(title); free(desc); free(faction);
WARN("Event has missing date attribute, skipping.");
continue;
}
- date_to_rm = atol(buff);
+ date_to_rm = atoll(buff);
free(buff);
xmlr_attr(node,"id",buff);
if (faction==NULL) {

0 comments on commit c378356

Please sign in to comment.