forked from enlightenment/efl
elm: Unified the usage of strncmp.
- Use strlen instead of sizeof(x) - 1 for string length calculation. - Use !strncmp for null check.
This commit is contained in:
parent
51e18105ba
commit
5f0ca660b4
|
@ -183,7 +183,7 @@ _access_object_from_path(const char *path)
|
||||||
Elm_Atspi_Object *eo = NULL;
|
Elm_Atspi_Object *eo = NULL;
|
||||||
const char *tmp = path;
|
const char *tmp = path;
|
||||||
|
|
||||||
int len = (sizeof(ELM_ACCESS_OBJECT_PATH_PREFIX) / sizeof(char)) - 1;
|
int len = strlen(ELM_ACCESS_OBJECT_PATH_PREFIX);
|
||||||
|
|
||||||
if (strncmp(path, ELM_ACCESS_OBJECT_PATH_PREFIX, len))
|
if (strncmp(path, ELM_ACCESS_OBJECT_PATH_PREFIX, len))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -994,7 +994,7 @@ _elm_image_smart_file_set(Eo *obj, void *_pd, va_list *list)
|
||||||
sd->remote = NULL;
|
sd->remote = NULL;
|
||||||
|
|
||||||
for (i = 0; i < sizeof (remote_uri) / sizeof (remote_uri[0]); ++i)
|
for (i = 0; i < sizeof (remote_uri) / sizeof (remote_uri[0]); ++i)
|
||||||
if (strncmp(remote_uri[i], file, strlen(remote_uri[i])) == 0)
|
if (!strncmp(remote_uri[i], file, strlen(remote_uri[i])))
|
||||||
{
|
{
|
||||||
// Found a remote target !
|
// Found a remote target !
|
||||||
evas_object_hide(sd->img);
|
evas_object_hide(sd->img);
|
||||||
|
|
|
@ -124,8 +124,8 @@ _icon_signal_emit(Elm_Layout_Smart_Data *sd,
|
||||||
(strcmp("elm.swallow.icon", sub_d->part) &&
|
(strcmp("elm.swallow.icon", sub_d->part) &&
|
||||||
(strcmp("elm.swallow.end", sub_d->part)))) return;
|
(strcmp("elm.swallow.end", sub_d->part)))) return;
|
||||||
|
|
||||||
if (strncmp(sub_d->part, "elm.swallow.", sizeof("elm.swallow.") - 1) == 0)
|
if (!strncmp(sub_d->part, "elm.swallow.", strlen("elm.swallow.")))
|
||||||
type = sub_d->part + sizeof("elm.swallow.") - 1;
|
type = sub_d->part + strlen("elm.swallow.");
|
||||||
else
|
else
|
||||||
type = sub_d->part;
|
type = sub_d->part;
|
||||||
|
|
||||||
|
@ -153,8 +153,8 @@ _text_signal_emit(Elm_Layout_Smart_Data *sd,
|
||||||
|
|
||||||
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd);
|
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd);
|
||||||
|
|
||||||
if (strncmp(sub_d->part, "elm.text.", sizeof("elm.text.") - 1) == 0)
|
if (!strncmp(sub_d->part, "elm.text.", strlen("elm.text.")))
|
||||||
type = sub_d->part + sizeof("elm.text.") - 1;
|
type = sub_d->part + strlen("elm.text.");
|
||||||
else
|
else
|
||||||
type = sub_d->part;
|
type = sub_d->part;
|
||||||
|
|
||||||
|
|
|
@ -2635,11 +2635,11 @@ _xml_name_attrs_dump_cb(void *data,
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(key, EINA_FALSE);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(key, EINA_FALSE);
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(value, EINA_FALSE);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(value, EINA_FALSE);
|
||||||
|
|
||||||
if (!strncmp(key, NOMINATIM_ATTR_LON, sizeof(NOMINATIM_ATTR_LON)))
|
if (!strncmp(key, NOMINATIM_ATTR_LON, strlen(NOMINATIM_ATTR_LON)))
|
||||||
dump->lon = _elm_atof(value);
|
dump->lon = _elm_atof(value);
|
||||||
else if (!strncmp(key, NOMINATIM_ATTR_LAT, sizeof(NOMINATIM_ATTR_LAT)))
|
else if (!strncmp(key, NOMINATIM_ATTR_LAT, strlen(NOMINATIM_ATTR_LAT)))
|
||||||
dump->lat = _elm_atof(value);
|
dump->lat = _elm_atof(value);
|
||||||
else if (!strncmp(key, NOMINATIM_ATTR_ADDRESS, sizeof(NOMINATIM_ATTR_ADDRESS)))
|
else if (!strncmp(key, NOMINATIM_ATTR_ADDRESS, strlen(NOMINATIM_ATTR_ADDRESS)))
|
||||||
{
|
{
|
||||||
if (!dump->address)
|
if (!dump->address)
|
||||||
dump->address = strdup(value);
|
dump->address = strdup(value);
|
||||||
|
@ -2726,8 +2726,7 @@ _xml_name_dump_cb(void *data,
|
||||||
attrs = eina_simple_xml_tag_attributes_find(value, length);
|
attrs = eina_simple_xml_tag_attributes_find(value, length);
|
||||||
if (attrs)
|
if (attrs)
|
||||||
{
|
{
|
||||||
if (!strncmp(value, NOMINATIM_RESULT,
|
if (!strncmp(value, NOMINATIM_RESULT, strlen(NOMINATIM_RESULT)))
|
||||||
sizeof(NOMINATIM_RESULT) - 1))
|
|
||||||
dump->id = NAME_XML_NAME;
|
dump->id = NAME_XML_NAME;
|
||||||
else dump->id = NAME_XML_NONE;
|
else dump->id = NAME_XML_NONE;
|
||||||
|
|
||||||
|
|
|
@ -1636,7 +1636,7 @@ _file_set(Eo *obj, void *_pd, va_list *list)
|
||||||
sd->remote = NULL;
|
sd->remote = NULL;
|
||||||
|
|
||||||
for (i = 0; i < sizeof (remote_uri) / sizeof (remote_uri[0]); ++i)
|
for (i = 0; i < sizeof (remote_uri) / sizeof (remote_uri[0]); ++i)
|
||||||
if (strncmp(remote_uri[i], file, strlen(remote_uri[i])) == 0)
|
if (!strncmp(remote_uri[i], file, strlen(remote_uri[i])))
|
||||||
{
|
{
|
||||||
// Found a remote target !
|
// Found a remote target !
|
||||||
sd->remote = _elm_url_download(file,
|
sd->remote = _elm_url_download(file,
|
||||||
|
|
Loading…
Reference in New Issue