if (ret == SQLITE_ROW) {
const char *ret_val = (const char *)sqlite3_column_text(stmt, 0);
LOG_ERR("ret_val: %s", ret_val);
- if (ret_val && strcmp(ret_val, "ok") == 0) {
+ if (ret_val && !strncmp(ret_val, "ok", strlen("ok"))) {
result = 0;
} else {
LOG_ERR("failed to check integrity");
for (l = list; l != NULL; l = l->next) {
mdgd_grp_t *grp = (mdgd_grp_t *)l->data;
- if (strcmp(grp->name, name) == 0) {
+ if (!strncmp(grp->name, name, strlen(grp->name))) {
LOG_ERR("already exists name in structure");
return MDGD_ERROR_UNKNOWN;
}
while (iter != NULL) {
char *pairwise_uuid = (char *)iter->data;
- if (strcmp(pairwise_uuid, uuid) == 0)
+ if (!strncmp(pairwise_uuid, uuid, strlen(uuid)))
return 0;
iter = g_list_next(iter);
while (iter != NULL) {
mdgd_grp_t *group = (mdgd_grp_t *)iter->data;
- if (strcmp(group_name, group->name) == 0) {
+ if (!strncmp(group_name, group->name, strlen(group->name))) {
GList *device_iter = group->device_list;
while (device_iter != NULL) {
char *device_uuid = (char *)device_iter->data;
- if (strcmp(device_uuid, uuid) == 0)
+ if (!strncmp(device_uuid, uuid, strlen(device_uuid)))
return -1;
device_iter = g_list_next(device_iter);
iter = mdgd_ctx->grp_list;
while (iter != NULL) {
mdgd_grp_t *group = (mdgd_grp_t *)iter->data;
- if (strcmp(group_name, group->name) == 0) {
+ if (!strncmp(group_name, group->name, strlen(group_name))) {
GList *device_iter = group->device_list;
device_iter = g_list_remove_all(device_iter, uuid);
return TRUE;
}
- if (strcmp(cmd->arg1, "disc_mot_enb_devs_done") == 0)
+ if (!strncmp(cmd->arg1, "disc_mot_enb_devs_done", strlen(cmd->arg1)))
mowned = false;
else
mowned = true;
mdgd_check_null_ret_error("device", device, TRUE);
- if (strcmp(cmd->uuid, resource_device_id) != 0) {
+ if (strncmp(cmd->uuid, resource_device_id, strlen(cmd->uuid))) {
LOG_DEBUG("Get peer description from another device");
/* Get Peer Description using "Get" operation */
device->type = MDGD_GROUP_DEVICE_REMOTE;
LOG_DEBUG("Resource Type %s", resource_type);
LOG_DEBUG("Command Device ID: %s", cmd ? cmd->uuid : "NULL");
- if (cmd != NULL && strcmp(cmd->uuid, resource_device_id) == 0) {
+ if (cmd != NULL && !strncmp(cmd->uuid, resource_device_id, strlen(cmd->uuid))) {
OCRepresentation rep;
LOG_DEBUG("Request to Remote Device");
if (cmd->command != MDGD_REQ_KEEP_ALIVE)
notify_send_data_finish("RESP_DATA", last_get_result);
} else if (cmd->resource_type == MDGD_RESOURCE_TYPE_DEVICE) {
- if (strcmp(cmd->arg1, "disc_mot_enb_devs_done") == 0) {
+ if (!strncmp(cmd->arg1, "disc_mot_enb_devs_done", strlen(cmd->arg1))) {
LOG_DEBUG("Device Find Done. notified");
mdgd_group_notify_mot_enable_device_done();
}
#endif
-static void _free_device_info(mdgd_mot_device_t *device)
-{
- if (!device)
- return;
-
- if (device->device_id != NULL) {
- g_free(device->device_id);
- device->device_id = NULL;
- }
- if (device->addr != NULL) {
- g_free(device->addr);
- device->addr = NULL;
- }
- if (device->route_data != NULL) {
- g_free(device->route_data);
- device->route_data = NULL;
- }
- if (device->remote_id != NULL) {
- g_free(device->remote_id);
- device->remote_id = NULL;
- }
- if (device->sec_ver != NULL) {
- g_free(device->sec_ver);
- device->sec_ver = NULL;
- }
- g_free(device);
- device = NULL;
-}
-
static void _agent_signal_handler(GDBusConnection *connection,
const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
const gchar *signal_name, GVariant *parameters, gpointer userdata)