#include <Evas.h>
#include <Evas_Engine_Buffer.h>
#include <Ecore.h>
+#include <Ecore_Str.h>
#include <Ecore_X.h>
#include <Ecore_X_Atoms.h>
#include <Ecore_X_Cursor.h>
const char *action, *params;
a1 = alloca(a1stop - a1start + 1);
- strncpy(a1, a1start, a1stop - a1start);
- a1[a1stop - a1start] = 0;
+ ecore_strlcpy(a1, a1start, a1stop - a1start + 1);
action = NULL;
params = NULL;
_delayed_action_list_parse_action(a1, &delay, &da->def.action, &da->def.params);
a2 = alloca(a1stop - a1start + 1);
- strncpy(a2, a2start, a2stop - a2start);
- a2[a2stop - a2start] = 0;
+ ecore_strlcpy(a2, a2start, a2stop - a2start + 1);
_delayed_action_list_parse_action(a2, &delay, &da->delayed.action, &da->delayed.params);
}
da->timer = ecore_timer_add(delay, _delayed_action_cb_timer, da);
sigaction(SIGABRT, &action, NULL);
current_user = _desklock_auth_get_current_user();
- strncpy(da.user, current_user, PATH_MAX);
- strncpy(da.passwd, passwd, PATH_MAX);
+ ecore_strlcpy(da.user, current_user, PATH_MAX);
+ ecore_strlcpy(da.passwd, passwd, PATH_MAX);
/* security - null out passwd string once we are done with it */
for (p = passwd; *p; p++) *p = 0;
da.pam.handle = NULL;
basename[i] = '\0';
}
else
- strncpy(basename, "unnamed_desktop", sizeof(basename));
+ ecore_strlcpy(basename, "unnamed_desktop", sizeof(basename));
i = 0;
snprintf(path, sizeof(path), "%s/applications/%s.desktop",
* also be fuzzy - up to 4 chars of extn is ok - eg .html but 5 or
* more is considered part of the name
*/
- strncpy(buf, ic->info.file, sizeof(buf) - 2);
- buf[sizeof(buf) - 1] = 0;
-
+ ecore_strlcpy(buf, ic->info.file, sizeof(buf));
+
len = strlen(buf);
p = strrchr(buf, '.');
if ((p) && ((len - (p - buf)) < 6))
}
else
*/ {
- strncpy(buf1, l1, sizeof(buf1) - 2);
- strncpy(buf2, l2, sizeof(buf2) - 2);
- buf1[sizeof(buf1) - 1] = 0;
- buf2[sizeof(buf2) - 1] = 0;
+ ecore_strlcpy(buf1, l1, sizeof(buf1));
+ ecore_strlcpy(buf2, l2, sizeof(buf2));
}
p = buf1;
while (*p)
val = evas_hash_find(icon_map, mime);
if (val) return val;
- strncpy(buf2, mime, sizeof(buf2) - 1);
- buf2[sizeof(buf2) - 1] = 0;
+ ecore_strlcpy(buf2, mime, sizeof(buf2));
val = strchr(buf2, '/');
if (val) *val = 0;
mi = l->data;
if (e_util_glob_match(mi->mime, mime))
{
- strncpy(buf, mi->icon, sizeof(buf) - 1);
- buf[sizeof(buf) - 1] = 0;
+ ecore_strlcpy(buf, mi->icon, sizeof(buf));
goto ok;
}
}
_prefix_path = malloc(p - _exe_path + 1);
if (_prefix_path)
{
- strncpy(_prefix_path, _exe_path, p - _exe_path);
- _prefix_path[p - _exe_path] = 0;
+ ecore_strlcpy(_prefix_path, _exe_path, p - _exe_path + 1);
/* bin and lib always together */
snprintf(buf, sizeof(buf), "%s/bin", _prefix_path);
_prefix_path = malloc(p - _exe_path + 1);
if (_prefix_path)
{
- strncpy(_prefix_path, _exe_path, p - _exe_path);
- _prefix_path[p - _exe_path] = 0;
+ strlcpy(_prefix_path, _exe_path, p - _exe_path + 1);
return 1;
}
else
}
}
/* no mapping or set failed - fall back */
- strncpy(buf, category, sizeof(buf) - 1);
- buf[sizeof(buf) - 1] = 0;
+ ecore_strlcpy(buf, category, sizeof(buf));
/* shorten string up to and not including last / char */
p = strrchr(buf, '/');
if (p) *p = 0;
}
}
/* no mapping or set failed - fall back */
- strncpy(buf, category, sizeof(buf) - 1);
- buf[sizeof(buf) - 1] = 0;
+ ecore_strlcpy(buf, category, sizeof(buf));
/* shorten string up to and not including last / char */
p = strrchr(buf, '/');
if (p) *p = 0;
e_util_edje_icon_set(ic, "enlightenment/themes");
}
tmp = strdup(strrchr(themefiles->data, '/') + 1);
- strncpy(themename, tmp, strlen(tmp)-3);
- themename[strlen(tmp)-4] = '\0';
+ strncpy(themename, tmp, strlen(tmp) - 3);
+ themename[strlen(tmp) - 4] = '\0';
e_widget_ilist_append(o, ic, themename, NULL, NULL, NULL);
free(tmp);
exe = ecore_file_app_exe_get(exe_sel->desktop->exec);
if (exe)
{
- strncpy(cmd_buf, exe, EXEBUFLEN - 1);
- cmd_buf[EXEBUFLEN - 1] = 0;
+ ecore_strlcpy(cmd_buf, exe, EXEBUFLEN);
free(exe);
}
}
else if (exe_sel->file)
{
- strncpy(cmd_buf, exe_sel->file, EXEBUFLEN - 1);
- cmd_buf[EXEBUFLEN - 1] = 0;
+ ecore_strlcpy(cmd_buf, exe_sel->file, EXEBUFLEN);
}
}
else
}
if ((exe) && (orig_len < common_len) && (common_len < (EXEBUFLEN - 1)))
{
- strncpy(cmd_buf, exe, common_len);
- cmd_buf[common_len] = 0;
+ ecore_strlcpy(cmd_buf, exe, common_len + 1);
}
if (clear_hist)
_e_exebuf_hist_clear();
snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/%s/.order", homedir, inst->ci->dir);
}
else
- snprintf(buf, sizeof(buf), inst->ci->dir);
+ ecore_strlcpy(buf, inst->ci->dir, sizeof(buf));
b->apps = e_order_new(buf);
e_order_update_callback_set(b->apps, _ibar_cb_app_change, b);
_ibar_fill(b);
snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/%s/.order", homedir, inst->ci->dir);
}
else
- snprintf(buf, sizeof(buf), inst->ci->dir);
+ ecore_strlcpy(buf, inst->ci->dir, sizeof(buf));
inst->ibar->apps = e_order_new(buf);
_ibar_fill(inst->ibar);
_ibar_resize_handle(inst->ibar);
exename = malloc(p - desktop->exec + 1);
if (exename)
{
- strncpy(exename, desktop->exec, p - desktop->exec);
- exename[p - desktop->exec] = 0;
+ ecore_strlcpy(exename, desktop->exec, p - desktop->exec + 1);
}
}
if (exename)
static int
link_ext_get(int fd, const char *name, int req, struct iwreq *rq)
{
- strncpy(rq->ifr_name, name, sizeof(rq->ifr_name));
+ ecore_strlcpy(rq->ifr_name, name, sizeof(rq->ifr_name));
return (ioctl(fd, req, rq));
}
tlabel = malloc(p2 - p + 1);
if (tlabel)
{
- strncpy(tlabel, p, p2 - p);
- tlabel[p2 - p] = 0;
+ ecore_strlcpy(tlabel, p, p2 - p + 1);
tlabel[0] = toupper(tlabel[0]);
if (*p2 == '-')
{
tdesc = malloc(p - p2 + 1);
if (tdesc)
{
- strncpy(tdesc, p2, p - p2);
- tdesc[p - p2] = 0;
+ ecore_strlcpy(tdesc, p2, p - p2 + 1);
tdesc[0] = toupper(tdesc[0]);
snprintf(buf, sizeof(buf), "%s (%s)", tlabel, tdesc);
}