forked from enlightenment/efl
fix oh so many warnings and potential errors - scan report.
SVN revision: 56104
This commit is contained in:
parent
64fcf02198
commit
cf7eca75f8
|
@ -1464,6 +1464,7 @@ ecore_x_window_button_grab(Ecore_X_Window win, int button,
|
|||
unsigned int m;
|
||||
unsigned int locks[8];
|
||||
int i, ev;
|
||||
Window *t;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
b = button;
|
||||
|
@ -1487,8 +1488,10 @@ ecore_x_window_button_grab(Ecore_X_Window win, int button,
|
|||
XGrabButton(_ecore_x_disp, b, m | locks[i],
|
||||
win, False, ev, GrabModeSync, GrabModeAsync, None, None);
|
||||
_ecore_window_grabs_num++;
|
||||
_ecore_window_grabs = realloc(_ecore_window_grabs,
|
||||
_ecore_window_grabs_num * sizeof(Window));
|
||||
t = realloc(_ecore_window_grabs,
|
||||
_ecore_window_grabs_num * sizeof(Window));
|
||||
if (!t) return;
|
||||
_ecore_window_grabs = t;
|
||||
_ecore_window_grabs[_ecore_window_grabs_num - 1] = win;
|
||||
} /* ecore_x_window_button_grab */
|
||||
|
||||
|
@ -1514,7 +1517,8 @@ void
|
|||
_ecore_x_window_grab_remove(Ecore_X_Window win)
|
||||
{
|
||||
int i, shuffle = 0;
|
||||
|
||||
Window *t;
|
||||
|
||||
if (_ecore_window_grabs_num > 0)
|
||||
{
|
||||
for (i = 0; i < _ecore_window_grabs_num; i++)
|
||||
|
@ -1528,9 +1532,17 @@ _ecore_x_window_grab_remove(Ecore_X_Window win)
|
|||
if (shuffle)
|
||||
{
|
||||
_ecore_window_grabs_num--;
|
||||
_ecore_window_grabs = realloc(_ecore_window_grabs,
|
||||
_ecore_window_grabs_num *
|
||||
sizeof(Window));
|
||||
if (_ecore_window_grabs_num <= 0)
|
||||
{
|
||||
free(_ecore_window_grabs);
|
||||
_ecore_window_grabs = NULL;
|
||||
return;
|
||||
}
|
||||
t = realloc(_ecore_window_grabs,
|
||||
_ecore_window_grabs_num *
|
||||
sizeof(Window));
|
||||
if (!t) return;
|
||||
_ecore_window_grabs = t;
|
||||
}
|
||||
}
|
||||
} /* _ecore_x_window_grab_remove */
|
||||
|
@ -1578,6 +1590,7 @@ ecore_x_window_key_grab(Ecore_X_Window win, const char *key,
|
|||
unsigned int m;
|
||||
unsigned int locks[8];
|
||||
int i;
|
||||
Window *t;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
if (!strncmp(key, "Keycode-", 8))
|
||||
|
@ -1610,8 +1623,10 @@ ecore_x_window_key_grab(Ecore_X_Window win, const char *key,
|
|||
XGrabKey(_ecore_x_disp, keycode, m | locks[i],
|
||||
win, False, GrabModeSync, GrabModeAsync);
|
||||
_ecore_key_grabs_num++;
|
||||
_ecore_key_grabs = realloc(_ecore_key_grabs,
|
||||
_ecore_key_grabs_num * sizeof(Window));
|
||||
t = realloc(_ecore_key_grabs,
|
||||
_ecore_key_grabs_num * sizeof(Window));
|
||||
if (!t) return;
|
||||
_ecore_key_grabs = t;
|
||||
_ecore_key_grabs[_ecore_key_grabs_num - 1] = win;
|
||||
} /* ecore_x_window_key_grab */
|
||||
|
||||
|
@ -1619,7 +1634,8 @@ void
|
|||
_ecore_x_key_grab_remove(Ecore_X_Window win)
|
||||
{
|
||||
int i, shuffle = 0;
|
||||
|
||||
Window *t;
|
||||
|
||||
if (_ecore_key_grabs_num > 0)
|
||||
{
|
||||
for (i = 0; i < _ecore_key_grabs_num; i++)
|
||||
|
@ -1633,8 +1649,16 @@ _ecore_x_key_grab_remove(Ecore_X_Window win)
|
|||
if (shuffle)
|
||||
{
|
||||
_ecore_key_grabs_num--;
|
||||
_ecore_key_grabs = realloc(_ecore_key_grabs,
|
||||
_ecore_key_grabs_num * sizeof(Window));
|
||||
if (_ecore_key_grabs_num <= 0)
|
||||
{
|
||||
free(_ecore_key_grabs);
|
||||
_ecore_key_grabs = NULL;
|
||||
return;
|
||||
}
|
||||
t = realloc(_ecore_key_grabs,
|
||||
_ecore_key_grabs_num * sizeof(Window));
|
||||
if (!t) return;
|
||||
_ecore_key_grabs = t;
|
||||
}
|
||||
}
|
||||
} /* _ecore_x_key_grab_remove */
|
||||
|
|
|
@ -37,6 +37,7 @@ _ecore_x_dnd_init(void)
|
|||
if (!_ecore_x_dnd_init_count)
|
||||
{
|
||||
_source = calloc(1, sizeof(Ecore_X_DND_Source));
|
||||
if (!_source) return;
|
||||
_source->version = ECORE_X_DND_VERSION;
|
||||
_source->win = None;
|
||||
_source->dest = None;
|
||||
|
@ -44,6 +45,12 @@ _ecore_x_dnd_init(void)
|
|||
_source->prev.window = 0;
|
||||
|
||||
_target = calloc(1, sizeof(Ecore_X_DND_Target));
|
||||
if (!_target)
|
||||
{
|
||||
free(_source);
|
||||
_source = NULL;
|
||||
return;
|
||||
}
|
||||
_target->win = None;
|
||||
_target->source = None;
|
||||
_target->state = ECORE_X_DND_TARGET_IDLE;
|
||||
|
@ -106,6 +113,11 @@ _ecore_x_dnd_converter_copy(char *target __UNUSED__,
|
|||
{
|
||||
int bufsize = strlen((char *)text_prop.value) + 1;
|
||||
*data_ret = malloc(bufsize);
|
||||
if (!*data_ret)
|
||||
{
|
||||
free(mystr);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
memcpy(*data_ret, text_prop.value, bufsize);
|
||||
*size_ret = bufsize;
|
||||
XFree(text_prop.value);
|
||||
|
@ -137,6 +149,7 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
|
|||
{
|
||||
unsigned char *prop_data;
|
||||
int num;
|
||||
Version_Cache_Item *t;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
// this looks hacky - and it is, but we need a way of caching info about
|
||||
|
@ -166,9 +179,11 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
|
|||
if (_version_cache_num > _version_cache_alloc)
|
||||
_version_cache_alloc += 16;
|
||||
|
||||
_version_cache = realloc(_version_cache,
|
||||
_version_cache_alloc *
|
||||
sizeof(Version_Cache_Item));
|
||||
t = realloc(_version_cache,
|
||||
_version_cache_alloc *
|
||||
sizeof(Version_Cache_Item));
|
||||
if (!t) return 0;
|
||||
_version_cache = t;
|
||||
_version_cache[_version_cache_num - 1].win = win;
|
||||
_version_cache[_version_cache_num - 1].ver = version;
|
||||
}
|
||||
|
@ -182,9 +197,10 @@ ecore_x_dnd_version_get(Ecore_X_Window win)
|
|||
if (_version_cache_num > _version_cache_alloc)
|
||||
_version_cache_alloc += 16;
|
||||
|
||||
_version_cache =
|
||||
realloc(_version_cache, _version_cache_alloc *
|
||||
sizeof(Version_Cache_Item));
|
||||
t = realloc(_version_cache, _version_cache_alloc *
|
||||
sizeof(Version_Cache_Item));
|
||||
if (!t) return 0;
|
||||
_version_cache = t;
|
||||
_version_cache[_version_cache_num - 1].win = win;
|
||||
_version_cache[_version_cache_num - 1].ver = 0;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ _ecore_x_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state)
|
|||
case ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME:
|
||||
return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME;
|
||||
|
||||
default: return 0;
|
||||
default: break;
|
||||
} /* switch */
|
||||
return 0;
|
||||
} /* _ecore_x_e_vkbd_atom_get */
|
||||
|
@ -207,7 +207,7 @@ _ecore_x_e_illume_atom_get(Ecore_X_Illume_Mode mode)
|
|||
return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT;
|
||||
|
||||
default:
|
||||
return ECORE_X_ILLUME_MODE_UNKNOWN;
|
||||
break;
|
||||
} /* switch */
|
||||
return ECORE_X_ILLUME_MODE_UNKNOWN;
|
||||
} /* _ecore_x_e_illume_atom_get */
|
||||
|
@ -589,7 +589,7 @@ _ecore_x_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state)
|
|||
return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
} /* switch */
|
||||
return 0;
|
||||
} /* _ecore_x_e_quickpanel_atom_get */
|
||||
|
|
|
@ -226,8 +226,6 @@ _ecore_key_press(int event, XKeyEvent *xevent)
|
|||
"Keycode-%i",
|
||||
xevent->keycode);
|
||||
keyname = keyname_buffer;
|
||||
if (!keyname)
|
||||
return;
|
||||
}
|
||||
|
||||
sym = 0;
|
||||
|
@ -320,9 +318,6 @@ _ecore_key_press(int event, XKeyEvent *xevent)
|
|||
if (!key)
|
||||
key = keyname;
|
||||
|
||||
if (!key)
|
||||
goto on_error;
|
||||
|
||||
e =
|
||||
malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) +
|
||||
(compose ? strlen(compose) : 0) + 3);
|
||||
|
@ -1302,14 +1297,14 @@ _ecore_x_event_handle_property_notify(XEvent *xevent)
|
|||
void
|
||||
_ecore_x_event_handle_selection_clear(XEvent *xevent)
|
||||
{
|
||||
Ecore_X_Selection_Intern *d;
|
||||
// Ecore_X_Selection_Intern *d;
|
||||
Ecore_X_Event_Selection_Clear *e;
|
||||
Ecore_X_Atom sel;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
_ecore_x_last_event_mouse_move = 0;
|
||||
d = _ecore_x_selection_get(xevent->xselectionclear.selection);
|
||||
/* errr..... why? paranoia.
|
||||
d = _ecore_x_selection_get(xevent->xselectionclear.selection);
|
||||
if (d && (xevent->xselectionclear.time > d->time))
|
||||
{
|
||||
_ecore_x_selection_set(None, NULL, 0,
|
||||
|
|
|
@ -179,7 +179,7 @@ EAPI void
|
|||
ecore_x_netwm_desk_names_set(Ecore_X_Window root,
|
||||
const char **names, unsigned int n_desks)
|
||||
{
|
||||
char ss[32], *buf;
|
||||
char ss[32], *buf, *t;
|
||||
const char *s;
|
||||
unsigned int i;
|
||||
int l, len;
|
||||
|
@ -199,8 +199,12 @@ ecore_x_netwm_desk_names_set(Ecore_X_Window root,
|
|||
}
|
||||
|
||||
l = strlen(s) + 1;
|
||||
buf = realloc(buf, len + l);
|
||||
memcpy(buf + len, s, l);
|
||||
t = realloc(buf, len + l);
|
||||
if (t)
|
||||
{
|
||||
buf = t;
|
||||
memcpy(buf + len, s, l);
|
||||
}
|
||||
len += l;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,8 +80,9 @@ ecore_x_randr_version_get(void)
|
|||
{
|
||||
return Ecore_X_Randr_Unset;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
|
|
|
@ -115,6 +115,7 @@ ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, int *num)
|
|||
sizes =
|
||||
XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
|
||||
root), &n);
|
||||
if ((!sizes) || (n <= 0)) return NULL;
|
||||
ret = calloc(n, sizeof(Ecore_X_Randr_Screen_Size_MM));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
|
|
@ -54,9 +54,9 @@ ecore_x_screensaver_idle_time_get(void)
|
|||
XFree(xss);
|
||||
|
||||
return idle;
|
||||
#endif /* ifdef ECORE_XSS */
|
||||
|
||||
#else
|
||||
return 0;
|
||||
#endif /* ifdef ECORE_XSS */
|
||||
} /* ecore_x_screensaver_idle_time_get */
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -151,6 +151,7 @@ _ecore_x_selection_set(Window w,
|
|||
selections[in].time = _ecore_x_event_last_time;
|
||||
|
||||
buf = malloc(size);
|
||||
if (!buf) return EINA_FALSE;
|
||||
memcpy(buf, data, size);
|
||||
selections[in].data = buf;
|
||||
}
|
||||
|
@ -416,11 +417,13 @@ ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
|
|||
}
|
||||
|
||||
cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter));
|
||||
if (!cnv->next) return;
|
||||
cnv = cnv->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
|
||||
if (!converters) return;
|
||||
cnv = converters;
|
||||
}
|
||||
|
||||
|
@ -606,6 +609,11 @@ _ecore_x_selection_converter_text(char *target,
|
|||
{
|
||||
int bufsize = strlen((char *)text_prop.value) + 1;
|
||||
*data_ret = malloc(bufsize);
|
||||
if (!*data_ret)
|
||||
{
|
||||
free(mystr);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
memcpy(*data_ret, text_prop.value, bufsize);
|
||||
*size_ret = bufsize;
|
||||
XFree(text_prop.value);
|
||||
|
@ -619,6 +627,7 @@ _ecore_x_selection_converter_text(char *target,
|
|||
{
|
||||
int bufsize = strlen(text_prop.value) + 1;
|
||||
*data_ret = malloc(bufsize);
|
||||
if (!*data_ret) return EINA_FALSE;
|
||||
memcpy(*data_ret, text_prop.value, bufsize);
|
||||
*size_ret = bufsize;
|
||||
XFree(text_prop.value);
|
||||
|
@ -661,11 +670,13 @@ ecore_x_selection_parser_add(const char *target,
|
|||
}
|
||||
|
||||
prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
|
||||
if (!prs->next) return;
|
||||
prs = prs->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
|
||||
if (!parsers) return;
|
||||
prs = parsers;
|
||||
}
|
||||
|
||||
|
@ -725,6 +736,7 @@ _ecore_x_selection_parse(const char *target, void *data, int size, int format)
|
|||
|
||||
/* Default, just return the data */
|
||||
sel = calloc(1, sizeof(Ecore_X_Selection_Data));
|
||||
if (!sel) return NULL;
|
||||
sel->free = _ecore_x_selection_data_default_free;
|
||||
sel->length = size;
|
||||
sel->format = format;
|
||||
|
@ -750,26 +762,39 @@ _ecore_x_selection_parser_files(const char *target,
|
|||
int format __UNUSED__)
|
||||
{
|
||||
Ecore_X_Selection_Data_Files *sel;
|
||||
char *data = _data;
|
||||
char *t, *data = _data;
|
||||
int i, is;
|
||||
char *tmp;
|
||||
char **t2;
|
||||
|
||||
if (strcmp(target, "text/uri-list") &&
|
||||
strcmp(target, "_NETSCAPE_URL"))
|
||||
return NULL;
|
||||
|
||||
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files));
|
||||
if (!sel) return NULL;
|
||||
ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_files_free;
|
||||
|
||||
if (data[size - 1])
|
||||
{
|
||||
/* Isn't nul terminated */
|
||||
size++;
|
||||
data = realloc(data, size);
|
||||
t = realloc(data, size);
|
||||
if (!t)
|
||||
{
|
||||
free(sel);
|
||||
return NULL;
|
||||
}
|
||||
data = t;
|
||||
data[size - 1] = 0;
|
||||
}
|
||||
|
||||
tmp = malloc(size);
|
||||
if (!tmp)
|
||||
{
|
||||
free(sel);
|
||||
return NULL;
|
||||
}
|
||||
i = 0;
|
||||
is = 0;
|
||||
while ((is < size) && (data[is]))
|
||||
|
@ -786,9 +811,12 @@ _ecore_x_selection_parser_files(const char *target,
|
|||
while ((data[is] == '\r') || (data[is] == '\n')) is++;
|
||||
tmp[i] = 0;
|
||||
sel->num_files++;
|
||||
sel->files =
|
||||
realloc(sel->files, sel->num_files * sizeof(char *));
|
||||
sel->files[sel->num_files - 1] = strdup(tmp);
|
||||
t2 = realloc(sel->files, sel->num_files * sizeof(char *));
|
||||
if (t2)
|
||||
{
|
||||
sel->files = t2;
|
||||
sel->files[sel->num_files - 1] = strdup(tmp);
|
||||
}
|
||||
tmp[0] = 0;
|
||||
i = 0;
|
||||
}
|
||||
|
@ -798,8 +826,12 @@ _ecore_x_selection_parser_files(const char *target,
|
|||
{
|
||||
tmp[i] = 0;
|
||||
sel->num_files++;
|
||||
sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
|
||||
sel->files[sel->num_files - 1] = strdup(tmp);
|
||||
t2 = realloc(sel->files, sel->num_files * sizeof(char *));
|
||||
if (t2)
|
||||
{
|
||||
sel->files = t2;
|
||||
sel->files[sel->num_files - 1] = strdup(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
free(tmp);
|
||||
|
@ -837,14 +869,21 @@ _ecore_x_selection_parser_text(const char *target __UNUSED__,
|
|||
{
|
||||
Ecore_X_Selection_Data_Text *sel;
|
||||
unsigned char *data = _data;
|
||||
void *t;
|
||||
|
||||
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text));
|
||||
|
||||
if (!sel) return NULL;
|
||||
if (data[size - 1])
|
||||
{
|
||||
/* Isn't nul terminated */
|
||||
size++;
|
||||
data = realloc(data, size);
|
||||
t = realloc(data, size);
|
||||
if (!t)
|
||||
{
|
||||
free(sel);
|
||||
return NULL;
|
||||
}
|
||||
data = t;
|
||||
data[size - 1] = 0;
|
||||
}
|
||||
|
||||
|
@ -878,10 +917,16 @@ _ecore_x_selection_parser_targets(const char *target __UNUSED__,
|
|||
int i;
|
||||
|
||||
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets));
|
||||
if (!sel) return NULL;
|
||||
targets = (unsigned long *)data;
|
||||
|
||||
sel->num_targets = size - 2;
|
||||
sel->targets = malloc((size - 2) * sizeof(char *));
|
||||
if (!sel->targets)
|
||||
{
|
||||
free(sel);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 2; i < size; i++)
|
||||
sel->targets[i - 2] = XGetAtomName(_ecore_x_disp, targets[i]);
|
||||
|
||||
|
|
|
@ -309,6 +309,7 @@ EAPI void
|
|||
ecore_x_window_ignore_set(Ecore_X_Window win, int ignore)
|
||||
{
|
||||
int i, j;
|
||||
Ecore_X_Window *t;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
if (ignore)
|
||||
|
@ -320,18 +321,17 @@ ecore_x_window_ignore_set(Ecore_X_Window win, int ignore)
|
|||
if (win == ignore_list[i])
|
||||
return;
|
||||
}
|
||||
ignore_list =
|
||||
realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
|
||||
if (!ignore_list)
|
||||
return;
|
||||
|
||||
t = realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
|
||||
if (!t) return;
|
||||
ignore_list = t;
|
||||
ignore_list[ignore_num++] = win;
|
||||
}
|
||||
else
|
||||
{
|
||||
ignore_num = 0;
|
||||
ignore_list = malloc(sizeof(Ecore_X_Window));
|
||||
ignore_list[ignore_num++] = win;
|
||||
if (ignore_list)
|
||||
ignore_list[ignore_num++] = win;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -346,7 +346,14 @@ ecore_x_window_ignore_set(Ecore_X_Window win, int ignore)
|
|||
else
|
||||
ignore_num--;
|
||||
}
|
||||
ignore_list = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
|
||||
if (ignore_num <= 0)
|
||||
{
|
||||
free(ignore_list);
|
||||
ignore_list = NULL;
|
||||
return;
|
||||
}
|
||||
t = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
|
||||
if (t) ignore_list = t;
|
||||
}
|
||||
} /* ecore_x_window_ignore_set */
|
||||
|
||||
|
|
Loading…
Reference in New Issue