summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-09 19:23:22 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-09 19:32:14 -0200
commit345bba3ef105969c8f8644818918165db936ccd7 (patch)
treea2927e9ceb66599b5a29a4c6186f55825d838da0
parente5b3d43c4f7930eae8d1671aa35360cdc830ff67 (diff)
downloadefl-345bba3ef105969c8f8644818918165db936ccd7.tar.gz
efl_net_dialer_http: fix build on windows.
Windows time_t is not a long, but long-long, then stick with int64_t so it works everywhere (converts to time_t internally). And there is no gmtime_r(), then use the gmtime() if not detected.
-rw-r--r--configure.ac1
-rw-r--r--src/lib/ecore_con/efl_net_dialer_http.c14
-rw-r--r--src/lib/ecore_con/efl_net_dialer_http.eo4
3 files changed, 13 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index d81b0c5efc..06946b2400 100644
--- a/configure.ac
+++ b/configure.ac
@@ -669,6 +669,7 @@ strlcpy \
geteuid \
getuid \
pause \
+gmtime_r \
])
AC_FUNC_ALLOCA
diff --git a/src/lib/ecore_con/efl_net_dialer_http.c b/src/lib/ecore_con/efl_net_dialer_http.c
index ffd1e46926..341fd1ed49 100644
--- a/src/lib/ecore_con/efl_net_dialer_http.c
+++ b/src/lib/ecore_con/efl_net_dialer_http.c
@@ -2347,7 +2347,7 @@ _efl_net_dialer_http_ssl_certificate_revogation_list_get(Eo *o EINA_UNUSED, Efl_
return pd->ssl.crl;
}
-EOLIAN static long
+EOLIAN static int64_t
_efl_net_dialer_http_date_parse(Efl_Class *cls EINA_UNUSED, void *cd EINA_UNUSED, const char *str)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(str, 0);
@@ -2355,14 +2355,20 @@ _efl_net_dialer_http_date_parse(Efl_Class *cls EINA_UNUSED, void *cd EINA_UNUSED
}
EOLIAN static char *
-_efl_net_dialer_http_date_serialize(Efl_Class *cls EINA_UNUSED, void *cd EINA_UNUSED, long t)
+_efl_net_dialer_http_date_serialize(Efl_Class *cls EINA_UNUSED, void *cd EINA_UNUSED, int64_t ts)
{
static const char *const wkday[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
static const char * const month[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
char buf[128];
- struct tm *tm, storage;
-
+ time_t t = ts;
+ struct tm *tm;
+#ifdef HAVE_GMTIME_R
+ struct tm storage;
tm = gmtime_r(&t, &storage);
+#else
+ tm = gmtime(&t);
+#endif
+
EINA_SAFETY_ON_NULL_RETURN_VAL(tm, NULL);
snprintf(buf, sizeof(buf),
diff --git a/src/lib/ecore_con/efl_net_dialer_http.eo b/src/lib/ecore_con/efl_net_dialer_http.eo
index 894a76521e..f7a063bd7d 100644
--- a/src/lib/ecore_con/efl_net_dialer_http.eo
+++ b/src/lib/ecore_con/efl_net_dialer_http.eo
@@ -372,7 +372,7 @@ class Efl.Net.Dialer.Http (Efl.Loop_User, Efl.Net.Dialer, Efl.Io.Sizer) {
params {
str: string; [[String in HTTP text format: Tue, 15 Nov 1994 12:45:26 GMT]]
}
- return: long; [[Seconds since 1/1/1970]]
+ return: int64; [[Seconds since 1/1/1970]]
}
date_serialize @class {
@@ -381,7 +381,7 @@ class Efl.Net.Dialer.Http (Efl.Loop_User, Efl.Net.Dialer, Efl.Io.Sizer) {
The timezone must be GMT (ie: gmtime()).
]]
params {
- epochtime: long; [[UNIX Epoch time - seconds since 1/1/1970]]
+ epochtime: int64; [[UNIX Epoch time - seconds since 1/1/1970]]
}
return: free(own(ptr(char)), free) @warn_unused; [[Newly allocated null-terminated string on success or NULL on errors]]
}