$OpenBSD: patch-src_cache_cpp,v 1.1 2015/10/05 19:46:22 jca Exp $
--- src/cache.cpp.orig	Tue Aug 27 14:20:39 2013
+++ src/cache.cpp	Sun Oct  4 19:56:03 2015
@@ -80,7 +80,7 @@ static int lastmodified_callback(void * handler, int a
 	} else {
 		result->etag = "";
 	}
-	LOG(LOG_INFO, "lastmodified_callback: lastmodified = %d etag = %s", result->lastmodified, result->etag.c_str());
+	LOG(LOG_INFO, "lastmodified_callback: lastmodified = %lld etag = %s", (long long)result->lastmodified, result->etag.c_str());
 	return 0;
 }
 
@@ -295,7 +295,7 @@ void cache::fetch_lastmodified(const std::string& feed
 	}
 	t = result.lastmodified;
 	etag = result.etag;
-	LOG(LOG_DEBUG, "cache::fetch_lastmodified: t = %d etag = %s", t, etag.c_str());
+	LOG(LOG_DEBUG, "cache::fetch_lastmodified: t = %lld etag = %s", (long long)t, etag.c_str());
 }
 
 void cache::update_lastmodified(const std::string& feedurl, time_t t, const std::string& etag) {
@@ -306,7 +306,7 @@ void cache::update_lastmodified(const std::string& fee
 	scope_mutex lock(&mtx);
 	std::string query = "UPDATE rss_feed SET ";
 	if (t > 0)
-		query.append(utils::strprintf("lastmodified = '%d'", t));
+		query.append(utils::strprintf("lastmodified = '%lld'", (long long)t));
 	if (etag.length() > 0)
 		query.append(utils::strprintf("%c etag = %s", (t > 0 ? ',' : ' '), prepare_query("'%q'", etag.c_str()).c_str()));
 	query.append(" WHERE rssurl = ");
@@ -643,9 +643,9 @@ void cache::update_rssitem_unlocked(std::tr1::shared_p
 		}
 	} else {
 		std::string insert = prepare_query("INSERT INTO rss_item (guid,title,author,url,feedurl,pubDate,content,unread,enclosure_url,enclosure_type,enqueued, base) "
-								"VALUES ('%q','%q','%q','%q','%q','%u','%q','%d','%q','%q',%d, '%q')",
+								"VALUES ('%q','%q','%q','%q','%q','%lld','%q','%d','%q','%q',%d, '%q')",
 								item->guid().c_str(), item->title_raw().c_str(), item->author_raw().c_str(), 
-								item->link().c_str(), feedurl.c_str(), item->pubDate_timestamp(), item->description_raw().c_str(), (item->unread() ? 1 : 0),
+								item->link().c_str(), feedurl.c_str(), (long long)item->pubDate_timestamp(), item->description_raw().c_str(), (item->unread() ? 1 : 0),
 								item->enclosure_url().c_str(), item->enclosure_type().c_str(), item->enqueued() ? 1 : 0, item->get_base().c_str());
 		LOG(LOG_DEBUG,"running query: %s", insert.c_str());
 		rc = sqlite3_exec(db,insert.c_str(),NULL,NULL,NULL);
@@ -715,9 +715,9 @@ void cache::update_rssitem_unread_and_enqueued(rss_ite
 		}
 	} else {
 		std::string insert = prepare_query("INSERT INTO rss_item (guid,title,author,url,feedurl,pubDate,content,unread,enclosure_url,enclosure_type,enqueued,flags,base) "
-										"VALUES ('%q','%q','%q','%q','%q','%u','%q','%d','%q','%q',%d, '%q', '%q')",
+										"VALUES ('%q','%q','%q','%q','%q','%lld','%q','%d','%q','%q',%d, '%q', '%q')",
 										item->guid().c_str(), item->title_raw().c_str(), item->author_raw().c_str(), 
-										item->link().c_str(), feedurl.c_str(), item->pubDate_timestamp(), item->description_raw().c_str(), item->unread() ? 1 : 0,
+										item->link().c_str(), feedurl.c_str(), (long long)item->pubDate_timestamp(), item->description_raw().c_str(), item->unread() ? 1 : 0,
 										item->enclosure_url().c_str(), item->enclosure_type().c_str(), item->enqueued() ? 1 : 0, item->flags().c_str(), 
 										item->get_base().c_str());
 		LOG(LOG_DEBUG,"running query: %s", insert.c_str());
@@ -753,9 +753,9 @@ void cache::update_rssitem_unread_and_enqueued(std::tr
 		}
 	} else {
 		std::string insert = prepare_query("INSERT INTO rss_item (guid,title,author,url,feedurl,pubDate,content,unread,enclosure_url,enclosure_type,enqueued,flags,base) "
-										"VALUES ('%q','%q','%q','%q','%q','%u','%q','%d','%q','%q',%d, '%q', '%q')",
+										"VALUES ('%q','%q','%q','%q','%q','%lld','%q','%d','%q','%q',%d, '%q', '%q')",
 										item->guid().c_str(), item->title_raw().c_str(), item->author_raw().c_str(), 
-										item->link().c_str(), feedurl.c_str(), item->pubDate_timestamp(), item->description_raw().c_str(), (item->unread() ? 1 : 0),
+										item->link().c_str(), feedurl.c_str(), (long long)item->pubDate_timestamp(), item->description_raw().c_str(), (item->unread() ? 1 : 0),
 										item->enclosure_url().c_str(), item->enclosure_type().c_str(), item->enqueued() ? 1 : 0, item->flags().c_str(),
 										item->get_base().c_str());
 		LOG(LOG_DEBUG,"running query: %s", insert.c_str());
@@ -876,8 +876,8 @@ void cache::clean_old_articles() {
 	if (days > 0) {
 		time_t old_date = time(NULL) - days*24*60*60;
 
-		std::string query(utils::strprintf("DELETE FROM rss_item WHERE pubDate < %d", old_date));
-		LOG(LOG_DEBUG, "cache::clean_old_articles: about to delete articles with a pubDate older than %d", old_date);
+		std::string query(utils::strprintf("DELETE FROM rss_item WHERE pubDate < %lld", (long long)old_date));
+		LOG(LOG_DEBUG, "cache::clean_old_articles: about to delete articles with a pubDate older than %lld", (long long)old_date);
 		int rc = sqlite3_exec(db, query.c_str(), NULL, NULL, NULL);
 		LOG(LOG_DEBUG, "cache::clean_old_artgicles: old article delete result: rc = %d", rc);
 	} else {
