forked from enlightenment/efl
parent
394664a09a
commit
3a84f04c4f
|
@ -189,7 +189,7 @@ extern "C" {
|
||||||
EAPI int ecore_con_url_shutdown(void);
|
EAPI int ecore_con_url_shutdown(void);
|
||||||
EAPI Ecore_Con_Url *ecore_con_url_new(const char *url);
|
EAPI Ecore_Con_Url *ecore_con_url_new(const char *url);
|
||||||
EAPI void ecore_con_url_destroy(Ecore_Con_Url *url_con);
|
EAPI void ecore_con_url_destroy(Ecore_Con_Url *url_con);
|
||||||
EAPI void ecore_con_url_data_set(Ecore_Con_Url *url_con, const void *data);
|
EAPI void ecore_con_url_data_set(Ecore_Con_Url *url_con, void *data);
|
||||||
EAPI void *ecore_con_url_data_get(Ecore_Con_Url *url_con);
|
EAPI void *ecore_con_url_data_get(Ecore_Con_Url *url_con);
|
||||||
EAPI int ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url);
|
EAPI int ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url);
|
||||||
EAPI int ecore_con_url_send(Ecore_Con_Url *url_con, void *data, size_t length, char *content_type);
|
EAPI int ecore_con_url_send(Ecore_Con_Url *url_con, void *data, size_t length, char *content_type);
|
||||||
|
|
|
@ -74,7 +74,7 @@ struct _Ecore_Con_Url
|
||||||
|
|
||||||
Ecore_Con_Url_Time condition;
|
Ecore_Con_Url_Time condition;
|
||||||
time_t time;
|
time_t time;
|
||||||
const void *data;
|
void *data;
|
||||||
|
|
||||||
Ecore_Fd_Handler *fd_handler;
|
Ecore_Fd_Handler *fd_handler;
|
||||||
|
|
||||||
|
|
|
@ -58,17 +58,17 @@ static Ecore_List *_url_con_list = NULL;
|
||||||
static fd_set _current_fd_set;
|
static fd_set _current_fd_set;
|
||||||
static int init_count = 0;
|
static int init_count = 0;
|
||||||
|
|
||||||
struct _little_ecore_con_url_event_s
|
struct _Ecore_Con_Url_Event
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
void *ev;
|
void *ev;
|
||||||
};
|
};
|
||||||
typedef struct _little_ecore_con_url_event_s _little_ecore_con_url_event_t;
|
typedef struct _Ecore_Con_Url_Event Ecore_Con_Url_Event;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_url_complete_idler_cb(void *data)
|
_url_complete_idler_cb(void *data)
|
||||||
{
|
{
|
||||||
_little_ecore_con_url_event_t *lev;
|
Ecore_Con_Url_Event *lev;
|
||||||
|
|
||||||
lev = data;
|
lev = data;
|
||||||
|
|
||||||
|
@ -81,9 +81,9 @@ _url_complete_idler_cb(void *data)
|
||||||
static void
|
static void
|
||||||
_url_complete_push_event(int type, void *ev)
|
_url_complete_push_event(int type, void *ev)
|
||||||
{
|
{
|
||||||
_little_ecore_con_url_event_t *lev;
|
Ecore_Con_Url_Event *lev;
|
||||||
|
|
||||||
lev = malloc(sizeof (_little_ecore_con_url_event_t));
|
lev = malloc(sizeof(Ecore_Con_Url_Event));
|
||||||
lev->type = type;
|
lev->type = type;
|
||||||
lev->ev = ev;
|
lev->ev = ev;
|
||||||
|
|
||||||
|
@ -208,8 +208,8 @@ ecore_con_url_new(const char *url)
|
||||||
|
|
||||||
return url_con;
|
return url_con;
|
||||||
#else
|
#else
|
||||||
url = NULL;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
url = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ ecore_con_url_destroy(Ecore_Con_Url *url_con)
|
||||||
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
{
|
{
|
||||||
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_destroy");
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_destroy");
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE);
|
ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE);
|
||||||
|
@ -237,6 +237,7 @@ ecore_con_url_destroy(Ecore_Con_Url *url_con)
|
||||||
free(url_con->url);
|
free(url_con->url);
|
||||||
free(url_con);
|
free(url_con);
|
||||||
#else
|
#else
|
||||||
|
return;
|
||||||
url_con = NULL;
|
url_con = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -258,33 +259,33 @@ ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url)
|
||||||
if (url)
|
if (url)
|
||||||
url_con->url = strdup(url);
|
url_con->url = strdup(url);
|
||||||
curl_easy_setopt(url_con->curl_easy, CURLOPT_URL, url_con->url);
|
curl_easy_setopt(url_con->curl_easy, CURLOPT_URL, url_con->url);
|
||||||
|
return 1;
|
||||||
#else
|
#else
|
||||||
|
return 0;
|
||||||
url_con = NULL;
|
url_con = NULL;
|
||||||
url = NULL;
|
url = NULL;
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_con_url_data_set(Ecore_Con_Url *url_con, const void *data)
|
ecore_con_url_data_set(Ecore_Con_Url *url_con, void *data)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
{
|
{
|
||||||
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_set");
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_set");
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
url_con->data = data;
|
url_con->data = data;
|
||||||
#else
|
#else
|
||||||
(void*) url_con;
|
return;
|
||||||
(const void*) data;
|
url_con = NULL;
|
||||||
|
data = NULL;
|
||||||
return ;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void*
|
EAPI void *
|
||||||
ecore_con_url_data_get(Ecore_Con_Url *url_con)
|
ecore_con_url_data_get(Ecore_Con_Url *url_con)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
|
@ -294,11 +295,10 @@ ecore_con_url_data_get(Ecore_Con_Url *url_con)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (void*) url_con->data;
|
return url_con->data;
|
||||||
#else
|
#else
|
||||||
(void*) url_con;
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
url_con = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,15 +309,16 @@ ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, time_t
|
||||||
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
|
||||||
{
|
{
|
||||||
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_time");
|
ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_time");
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
url_con->condition = condition;
|
url_con->condition = condition;
|
||||||
url_con->time = tm;
|
url_con->time = tm;
|
||||||
#else
|
#else
|
||||||
(void*) url_con;
|
return;
|
||||||
condition;
|
url_con = NULL;
|
||||||
tm;
|
condition = 0;
|
||||||
|
tm = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,11 +377,11 @@ ecore_con_url_send(Ecore_Con_Url *url_con, void *data, size_t length, char *cont
|
||||||
|
|
||||||
return _ecore_con_url_perform(url_con);
|
return _ecore_con_url_perform(url_con);
|
||||||
#else
|
#else
|
||||||
|
return 0;
|
||||||
url_con = NULL;
|
url_con = NULL;
|
||||||
data = NULL;
|
data = NULL;
|
||||||
length = 0;
|
length = 0;
|
||||||
content_type = NULL;
|
content_type = NULL;
|
||||||
return 0;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,18 +407,20 @@ _ecore_con_url_data_cb(void *buffer, size_t size, size_t nmemb, void *userp)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ECORE_CON_URL_TRANSMISSION(Transmit, Event, Url_con, Total, Now) \
|
#define ECORE_CON_URL_TRANSMISSION(Transmit, Event, Url_con, Total, Now) \
|
||||||
{ \
|
{ \
|
||||||
Ecore_Con_Event_Url_Progress *e; \
|
Ecore_Con_Event_Url_Progress *e; \
|
||||||
if (Total != 0 || Now != 0) { \
|
if ((Total != 0) || (Now != 0)) \
|
||||||
|
{ \
|
||||||
e = calloc(1, sizeof(Ecore_Con_Event_Url_Progress)); \
|
e = calloc(1, sizeof(Ecore_Con_Event_Url_Progress)); \
|
||||||
if (e) { \
|
if (e) \
|
||||||
|
{ \
|
||||||
e->url_con = url_con; \
|
e->url_con = url_con; \
|
||||||
e->total = Total; \
|
e->total = Total; \
|
||||||
e->now = Now; \
|
e->now = Now; \
|
||||||
ecore_event_add(Event, e, _ecore_con_event_url_free, NULL); \
|
ecore_event_add(Event, e, _ecore_con_event_url_free, NULL); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
_ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||||
|
|
Loading…
Reference in New Issue