[pacman-dev] [PATCH 2/2] _alpm_parsedate(): return time_t and not long

Dan McGee dan at archlinux.org
Thu Sep 1 13:36:40 EDT 2011


Signed-off-by: Dan McGee <dan at archlinux.org>
---
 lib/libalpm/util.c |    4 ++--
 lib/libalpm/util.h |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 4cb31a8..9bbac43 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -1099,7 +1099,7 @@ off_t _alpm_strtoofft(const char *line)
 	return (off_t)result;
 }
 
-long _alpm_parsedate(const char *line)
+time_t _alpm_parsedate(const char *line)
 {
 	if(isalpha((unsigned char)line[0])) {
 		/* initialize to null in case of failure */
@@ -1109,7 +1109,7 @@ long _alpm_parsedate(const char *line)
 		setlocale(LC_TIME, "");
 		return mktime(&tmp_tm);
 	}
-	return atol(line);
+	return (time_t)atol(line);
 }
 
 /**
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index c5544a0..2a2d3a9 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -120,7 +120,7 @@ int _alpm_splitname(const char *target, char **name, char **version,
 		unsigned long *name_hash);
 unsigned long _alpm_hash_sdbm(const char *str);
 off_t _alpm_strtoofft(const char *line);
-long _alpm_parsedate(const char *line);
+time_t _alpm_parsedate(const char *line);
 int _alpm_raw_cmp(const char *first, const char *second);
 int _alpm_raw_ncmp(const char *first, const char *second, size_t max);
 int _alpm_access(alpm_handle_t *handle, const char *dir, const char *file, int amode);
-- 
1.7.6



More information about the pacman-dev mailing list