#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
+#include <errno.h>
#ifdef HAVE_LOCALE_H
# include <locale.h>
if (_ecore_fps_debug_fd >= 0)
{
unsigned int zero = 0;
+ char *buf = (char *)&zero;
+ ssize_t todo = sizeof(unsigned int);
- write(_ecore_fps_debug_fd, &zero, sizeof(unsigned int));
+ while (todo > 0)
+ {
+ ssize_t r = write(_ecore_fps_debug_fd, buf, todo);
+ if (r > 0)
+ {
+ todo -= r;
+ buf += r;
+ }
+ else if ((r < 0) && (errno == EINTR))
+ continue;
+ else
+ {
+ ERR("could not write to file '%s' fd %d: %s",
+ tmp, _ecore_fps_debug_fd, strerror(errno));
+ close(_ecore_fps_debug_fd);
+ _ecore_fps_debug_fd = -1;
+ return;
+ }
+ }
_ecore_fps_runtime_mmap = mmap(NULL, sizeof(unsigned int),
PROT_READ | PROT_WRITE,
MAP_SHARED,
break;
}
- fwrite(text, 1, d - text, fp);
+ if (fwrite(text, 1, d - text, fp) != (size_t)(d - text))
+ return;
d++;
if (strncmp(d, "prog", sizeof("prog") - 1) == 0)
{
if (space)
{
- fwrite(text, 1, i, fp);
+ i = fwrite(text, 1, i, fp);
i++;
text += i;
len -= i;
}
else
{
- fwrite(text, 1, i, fp);
+ i = fwrite(text, 1, i, fp);
text += i;
len -= i;
used += i;
if (svr->delete_me) return 1;
if ((svr->client_limit >= 0) && (!svr->reject_excess_clients))
{
- if (eina_list_count(svr->clients) >= svr->client_limit) return 1;
+ if (eina_list_count(svr->clients) >= (unsigned int)svr->client_limit)
+ return 1;
}
/* a new client */
size_in = sizeof(incoming);
if ((svr->client_limit >= 0) && (svr->reject_excess_clients))
{
- if (eina_list_count(svr->clients) >= svr->client_limit)
+ if (eina_list_count(svr->clients) >= (unsigned int)svr->client_limit)
{
close(new_fd);
return 1;
#include <sys/types.h>
#include <unistd.h>
#include <ctype.h>
+#include <errno.h>
#ifdef __OpenBSD__
# include <sys/types.h>
#endif
static void _ecore_con_dns_slave_free(CB_Data *cbdata);
static int _ecore_con_dns_data_handler(void *data, Ecore_Fd_Handler *fd_handler);
static int _ecore_con_dns_exit_handler(void *data, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_con_write_safe(int fd, void *data, size_t length);
static int dns_init = 0;
static CB_Data *dns_slaves = NULL;
memcpy((struct in_addr *)&addr, he->h_addr,
sizeof(struct in_addr));
- write(fd[1], &(addr.s_addr), sizeof(in_addr_t));
+ _ecore_con_write_safe(fd[1], &(addr.s_addr), sizeof(in_addr_t));
}
else
{
- write(fd[1], "", 1);
+ _ecore_con_write_safe(fd[1], "", 1);
}
close(fd[1]);
# ifdef __USE_ISOC99
_ecore_con_dns_slave_free(cbdata);
return 0;
}
+
+static Eina_Bool
+_ecore_con_write_safe(int fd, void *data, size_t length)
+{
+ char *buf = data;
+ ssize_t todo = (ssize_t)length;
+
+ while (todo > 0)
+ {
+ ssize_t r = write(fd, buf, todo);
+ if (r > 0)
+ {
+ todo -= r;
+ buf += r;
+ }
+ else if ((r < 0) && (errno == EINTR))
+ continue;
+ else
+ {
+ ERR("could not write to fd %d: %s", fd, strerror(errno));
+ return EINA_FALSE;
+ }
+ }
+ return EINA_TRUE;
+}
size = read(ecore_main_fd_handler_fd_get(cbdata->fdh), (char *)torecv + sizeof(Ecore_Con_Info),
torecv_len - sizeof(Ecore_Con_Info));
- if (size == torecv_len - sizeof(Ecore_Con_Info))
+ if ((size > 0) && ((size_t)size == torecv_len - sizeof(Ecore_Con_Info)))
{
recv = (Ecore_Con_Info *)torecv;
recv->info.ai_addr = (struct sockaddr *)((char *)torecv + sizeof(Ecore_Con_Info));
- if (torecv_len != (sizeof(Ecore_Con_Info) + recv->info.ai_addrlen))
+ if ((size_t)torecv_len != (sizeof(Ecore_Con_Info) + recv->info.ai_addrlen))
recv->info.ai_canonname = (char *)torecv + sizeof(Ecore_Con_Info) + recv->info.ai_addrlen;
else
recv->info.ai_canonname = NULL;
int
ecore_con_local_connect(Ecore_Con_Server *svr,
int (*cb_done)(void *data, Ecore_Fd_Handler *fd_handler),
- void *data,
+ void *data __UNUSED__,
void (*cb_free)(void *data, void *ev))
{
char buf[4096];
int
ecore_con_local_listen(Ecore_Con_Server *svr,
int (*cb_listen)(void *data, Ecore_Fd_Handler *fd_handler),
- void *data)
+ void *data __UNUSED__)
{
char buf[4096];
struct sockaddr_un socket_unix;
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
+#include <errno.h>
#include "Ecore.h"
#include "ecore_private.h"
if (_ecore_evas_fps_debug_fd >= 0)
{
unsigned int zero = 0;
+ char *buf = (char *)&zero;
+ ssize_t todo = sizeof(unsigned int);
- write(_ecore_evas_fps_debug_fd, &zero, sizeof(unsigned int));
+ while (todo > 0)
+ {
+ ssize_t r = write(_ecore_evas_fps_debug_fd, buf, todo);
+ if (r > 0)
+ {
+ todo -= r;
+ buf += r;
+ }
+ else if ((r < 0) && (errno == EINTR))
+ continue;
+ else
+ {
+ ERR("could not write to file '%s' fd %d: %s",
+ buf, _ecore_evas_fps_debug_fd, strerror(errno));
+ close(_ecore_evas_fps_debug_fd);
+ _ecore_evas_fps_debug_fd = -1;
+ return;
+ }
+ }
_ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int),
PROT_READ | PROT_WRITE,
MAP_SHARED,
{
ee = ecore_event_window_match(e->data.l[0]);
if (!ee) return 1; /* pass on event */
- if (e->data.l[0] != ee->prop.window) return 1;
+ if (e->data.l[0] != (long)ee->prop.window) return 1;
ee->engine.x.sync_began = 1;
ee->engine.x.sync_cancel = 0;
}
{
ee = ecore_event_window_match(e->data.l[0]);
if (!ee) return 1; /* pass on event */
- if (e->data.l[0] != ee->prop.window) return 1;
+ if (e->data.l[0] != (long)ee->prop.window) return 1;
ee->engine.x.sync_began = 0;
ee->engine.x.sync_cancel = 0;
}
{
ee = ecore_event_window_match(e->data.l[0]);
if (!ee) return 1; /* pass on event */
- if (e->data.l[0] != ee->prop.window) return 1;
+ if (e->data.l[0] != (long)ee->prop.window) return 1;
ee->engine.x.sync_began = 0;
ee->engine.x.sync_cancel = 1;
}
#if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_OPENGL_X11) || defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB) || defined (BUILD_ECORE_EVAS_SOFTWARE_16_X11)
static void
-_ecore_evas_x_flush_pre(void *data, Evas *e, void *event_info)
+_ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
{
Ecore_Evas *ee = data;
}
static void
-_ecore_evas_x_flush_post(void *data, Evas *e, void *event_info)
+_ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
{
Ecore_Evas *ee = data;
}
static int
-_ecore_file_download_url_complete_cb(void *data, int type, void *event)
+_ecore_file_download_url_complete_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Con_Event_Url_Complete *ev = event;
Ecore_File_Download_Job *job;
}
static int
-_ecore_file_download_url_progress_cb(void *data, int type, void *event)
+_ecore_file_download_url_progress_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
{
/* this reports the downloads progress. if we return 0, then download
* continues, if we return anything else, then the download stops */
while (p)
{
const char *q = strchr(p, ':');
- int goodness = _ecore_imf_context_match_locale(locale, p, q ? q - p : strlen (p));
+ int goodness = _ecore_imf_context_match_locale(locale, p, q ? (size_t)(q - p) : strlen (p));
if (goodness > best_goodness)
{
}
static Eina_Bool
-_hash_module_available_get(const Eina_Hash *hash, int *data, void *list)
+_hash_module_available_get(const Eina_Hash *hash __UNUSED__, int *data, void *list)
{
*(Eina_List**)list = eina_list_append(*(Eina_List**)list, data);
return EINA_TRUE;
}
static Eina_Bool
-_hash_ids_get(const Eina_Hash *hash, const char *key, void *list)
+_hash_ids_get(const Eina_Hash *hash __UNUSED__, const char *key, void *list)
{
*(Eina_List**)list = eina_list_append(*(Eina_List**)list, key);
return EINA_TRUE;
}
static Eina_Bool
-_hash_ids_by_canvas_type_get(const Eina_Hash *hash, void *data, void *fdata)
+_hash_ids_by_canvas_type_get(const Eina_Hash *hash __UNUSED__, void *data, void *fdata)
{
Ecore_IMF_Module *module = data;
Ecore_IMF_Selector *selector = fdata;
EAPI unsigned int
ecore_event_modifier_mask(Ecore_Event_Modifier modifier)
{
- int i;
+ size_t i;
for (i = 0; i < sizeof (matchs) / sizeof (Ecore_Event_Modifier_Match); i++)
if (matchs[i].modifier == modifier)
EAPI Ecore_Event_Modifier
ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc)
{
- int i;
+ size_t i;
for (i = 0; i < sizeof (matchs) / sizeof (Ecore_Event_Modifier_Match); i++)
if (strcmp(matchs[i].key, key) == 0)
EAPI int
ecore_event_evas_shutdown(void)
{
- int i;
+ size_t i;
if (--_ecore_event_evas_init_count != 0)
return _ecore_event_evas_init_count;
e->state[0] = _ecore_x_netwm_state_get(xevent->xclient.data.l[1]);
if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN)
{
- char *name;
+// char *name;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[1]);
e->state[1] = _ecore_x_netwm_state_get(xevent->xclient.data.l[2]);
if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN)
{
- char *name;
+// char *name;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[2]);
#include <sys/shm.h>
#include <string.h>
-static int _composite_available;
-
static int _ecore_x_image_shm_can = -1;
static int _ecore_x_image_err = 0;
static void
-_ecore_x_image_error_handler(Display * d, XErrorEvent * ev)
+_ecore_x_image_error_handler(Display * d __UNUSED__, XErrorEvent * ev __UNUSED__)
{
_ecore_x_image_err = 1;
}
}
XShmAttach(_ecore_x_disp, &im->shminfo);
- im->data = im->xim->data;
+ im->data = (unsigned char *)im->xim->data;
im->bpl = im->xim->bytes_per_line;
im->rows = im->xim->height;
ph = XSetErrorHandler((XErrorHandler)_ecore_x_image_error_handler);
if ((sx == 0) && (w == im->w))
{
- im->xim->data =
+ im->xim->data = (char *)
im->data + (im->xim->bytes_per_line * sy) + (sx * im->bpp);
im->xim->width = w;
im->xim->height = h;
}
EAPI void
-ecore_x_image_put(Ecore_X_Image *im, Ecore_X_Drawable draw,
- int x, int y, int sx, int sy, int w, int h)
+ecore_x_image_put(Ecore_X_Image *im __UNUSED__, Ecore_X_Drawable draw __UNUSED__, int x __UNUSED__, int y __UNUSED__, int sx __UNUSED__, int sy __UNUSED__, int w __UNUSED__, int h __UNUSED__)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
printf("ecore_x_image_put: unimplemented!\n");
unsigned short w, h;
};
-static int shadow_count = 0;
static Shadow **shadow_base = NULL;
static int shadow_num = 0;
{
Window *list = NULL;
Window parent_win = 0, root_win = 0;
- int i, j;
unsigned int num;
Shadow *s, **sl;
XWindowAttributes att;
s->children = calloc(1, sizeof(Shadow *) * num);
if (s->children)
{
+ size_t i, j;
s->children_num = num;
for (i = 0; i < num; i++)
{
}
}
+/*
+static int shadow_count = 0;
+
static void
_ecore_x_window_tree_shadow_start(void)
{
if (shadow_count != 0) return;
_ecore_x_window_tree_shadow_free();
}
+*/
static Shadow *
_ecore_x_window_shadow_tree_find_shadow(Shadow *s, Window win)
* @ingroup Ecore_X_Window_Geometry_Group
*/
EAPI Ecore_X_Window
-ecore_x_window_shadow_parent_get(Ecore_X_Window root, Ecore_X_Window win)
+ecore_x_window_shadow_parent_get(Ecore_X_Window root __UNUSED__, Ecore_X_Window win)
{
Shadow *s;
int i;