remove compilation warnings.
Change-Id: Ic77984c1bc1faa49ba857910db2835e6cdba3fe0
char *sc_common_date_to_str(struct tm *date)
{
char *ret_str = malloc(DATE_STRING_LENGTH);
- if(ret_str)
- {
- sprintf(ret_str, "%d/%d/%d", date->tm_year + 1900, date->tm_mon + 1, date->tm_mday);
+ if (ret_str) {
+ snprintf(ret_str, DATE_STRING_LENGTH, "%d/%d/%d", date->tm_year + 1900, date->tm_mon + 1, date->tm_mday);
}
return ret_str;
}
&& sc_db_utils_is_success(contacts_record_get_int(record, _contacts_person.id, &id)))
{
contact_data_s *contact_data = (contact_data_s*)malloc(sizeof(*contact_data));
+ memset(contact_data, 0, sizeof(contact_data_s));
contact_data->display_name = NULL;
contact_data->first_name = NULL;
eina_strbuf_append(var_query, "SELECT ");
if(!column_names) {
- var_query = realloc(var_query, strlen(var_query) + 3);
eina_strbuf_append(var_query, "* ");
} else {
int col_count = eina_list_count(column_names);
- char* col_name = NULL;
for(int col = 0; col < col_count ; col++) {
eina_strbuf_append(var_query, eina_list_nth(column_names, col));
if (col < col_count - 1)
if (!ad)
return;
- int size_of_listed_countries = 0;
const char *file_name = ui_utils_get_resource(TG_LIST_OF_COUNTIRES);
if (!file_name)
return;
}
ad->current_user_data = (user_data_s*)malloc(sizeof(user_data_s));
+ memset(ad->current_user_data, 0, sizeof(user_data_s));
Eina_List *row_vals = NULL;
Eina_List *ts_msg = NULL;
EINA_LIST_FREE(peer_details, ts_msg) {
tg_peer_info_s* peer_info = (tg_peer_info_s*)malloc(sizeof(*peer_info));
+ memset(peer_info, 0, sizeof(tg_peer_info_s));
int *temp_peer_id = (int *)eina_list_nth(ts_msg, 0);
if (temp_peer_id) {
eina_list_free(ts_msg);
peer_with_pic_s *item = (peer_with_pic_s*) malloc(sizeof(*item));
+ memset(item, 0, sizeof(peer_with_pic_s));
item->use_data = peer_info;
- item->contact_icon = NULL;
-
ad->peer_list = eina_list_append(ad->peer_list, item);
}
}
tg_main_list_item_s* main_list_item = (tg_main_list_item_s*)malloc(sizeof(tg_main_list_item_s));
+ memset(main_list_item, 0, sizeof(tg_main_list_item_s));
main_list_item->peer_id = peer_info->peer_id;
main_list_item->peer_type = peer_info->peer_type;
set_peer_names(peer_info, main_list_item);
main_list_item->last_seen_time = msg->date;
- main_list_item->profile_pic = NULL;
main_list_item->last_msg_id = msg->msg_id;
main_list_item->last_message = strdup(item->last_message);
main_list_item->last_msg_type = msg->media_type;
if (peer_info->photo_path)
main_list_item->profile_pic_path = strdup(peer_info->photo_path);
- else
- main_list_item->profile_pic_path = NULL;
-
- main_list_item->user_name_lbl = NULL;
- main_list_item->status_lbl = NULL;
- main_list_item->date_lbl = NULL;
- main_list_item->msg_status_lbl = NULL;
- main_list_item->main_item_layout = NULL;
- main_list_item->highlight_text = NULL;
+
ad->main_list = eina_list_append(ad->main_list, main_list_item);
// delete message object
item->last_message = strdup(" ");
if (peer_info->peer_type == TGL_PEER_CHAT) {
tg_main_list_item_s* main_list_item = (tg_main_list_item_s*)malloc(sizeof(tg_main_list_item_s));
+ memset(main_list_item, 0, sizeof(tg_main_list_item_s));
main_list_item->peer_id = peer_info->peer_id;
main_list_item->peer_type = peer_info->peer_type;
set_peer_names(peer_info, main_list_item);
main_list_item->last_seen_time = peer_info->last_seen_time;
- main_list_item->profile_pic = NULL;
main_list_item->last_message = strdup(item->last_message);
main_list_item->last_msg_type = -1;
main_list_item->last_msg_service = 0;
main_list_item->last_msg_status = -1;
main_list_item->number_of_unread_msgs = 0;
- if (peer_info->photo_path) {
+ if (peer_info->photo_path)
main_list_item->profile_pic_path = strdup(peer_info->photo_path);
- } else {
- main_list_item->profile_pic_path = NULL;
- }
- main_list_item->user_name_lbl = NULL;
- main_list_item->status_lbl = NULL;
- main_list_item->date_lbl = NULL;
- main_list_item->msg_status_lbl = NULL;
- main_list_item->main_item_layout = NULL;
- main_list_item->highlight_text = NULL;
ad->main_list = eina_list_append(ad->main_list, main_list_item);
}
}
}
user_data_s *user_data = (user_data_s*)malloc(sizeof(*user_data));
+ memset(user_data, 0, sizeof(user_data_s));
user_data->is_selected = EINA_FALSE;
-
if (temp_user_id) {
user_data->user_id.id = *temp_user_id;
user_data->user_id.type = TGL_PEER_USER;
user_data->highlight_name = NULL;
user_data_with_pic_s *item = (user_data_with_pic_s *)malloc(sizeof(*item));
+ memset(item, 0, sizeof(user_data_with_pic_s));
item->use_data = user_data;
- item->contact_icon = NULL;
ad->unknown_buddy_list = eina_list_append(ad->unknown_buddy_list, item);
eina_list_free(row_vals);
}
user_data_s *user_data = (user_data_s *)malloc(sizeof(*user_data));
+ memset(user_data, 0, sizeof(user_data_s));
user_data->is_selected = EINA_FALSE;
user_data->highlight_name = NULL;
user_data_with_pic_s *item = (user_data_with_pic_s *) malloc(sizeof(*item));
+ memset(item, 0, sizeof(user_data_with_pic_s));
item->use_data = user_data;
item->contact_icon = NULL;
ad->buddy_list = eina_list_append(ad->buddy_list, item);
}
main_list_item = (tg_main_list_item_s*)malloc(sizeof(tg_main_list_item_s));
+ memset(main_list_item, 0, sizeof(tg_main_list_item_s));
main_list_item->peer_id = peer_info->peer_id;
main_list_item->peer_type = peer_info->peer_type;
set_peer_names(peer_info, main_list_item);
main_list_item->last_seen_time = msg->date;
- main_list_item->profile_pic = NULL;
main_list_item->last_msg_id = msg->msg_id;
main_list_item->last_message = strdup(item->last_message);
main_list_item->last_msg_type = msg->media_type;
main_list_item->last_msg_service = msg->service;
main_list_item->number_of_unread_msgs = get_unread_message_count(tablename);
- if (peer_info->photo_path) {
+ if (peer_info->photo_path)
main_list_item->profile_pic_path = strdup(peer_info->photo_path);
- } else {
- main_list_item->profile_pic_path = NULL;
- }
- main_list_item->user_name_lbl = NULL;
- main_list_item->status_lbl = NULL;
- main_list_item->date_lbl = NULL;
- main_list_item->msg_status_lbl = NULL;
- main_list_item->main_item_layout = NULL;
// delete message object
if (msg->message) {
item->last_message = strdup(" ");
if (peer_info->peer_type == TGL_PEER_CHAT) {
main_list_item = (tg_main_list_item_s*)malloc(sizeof(tg_main_list_item_s));
+ memset(main_list_item, 0, sizeof(tg_main_list_item_s));
main_list_item->peer_id = peer_info->peer_id;
main_list_item->peer_type = peer_info->peer_type;
set_peer_names(peer_info, main_list_item);
main_list_item->last_seen_time = peer_info->last_seen_time;
- main_list_item->profile_pic = NULL;
main_list_item->last_message = strdup(item->last_message);
main_list_item->last_msg_type = -1;
main_list_item->last_msg_service = 0;
main_list_item->last_msg_status = -1;
main_list_item->number_of_unread_msgs = 0;
- if (peer_info->photo_path && strlen(peer_info->photo_path) > 0) {
+ if (peer_info->photo_path && strlen(peer_info->photo_path) > 0)
main_list_item->profile_pic_path = strdup(peer_info->photo_path);
- } else {
- main_list_item->profile_pic_path = NULL;
- }
- main_list_item->user_name_lbl = NULL;
- main_list_item->status_lbl = NULL;
- main_list_item->date_lbl = NULL;
- main_list_item->msg_status_lbl = NULL;
- main_list_item->main_item_layout = NULL;
}
}
}
tg_main_list_item_s* main_list_item = (tg_main_list_item_s*)malloc(sizeof(tg_main_list_item_s));
+ memset(main_list_item, 0, sizeof(tg_main_list_item_s));
main_list_item->peer_id = peer_info->peer_id;
main_list_item->peer_type = peer_info->peer_type;
set_peer_names(peer_info, main_list_item);
main_list_item->last_seen_time = msg->date;
- main_list_item->profile_pic = NULL;
main_list_item->last_msg_id = msg->msg_id;
main_list_item->last_message = strdup(item->last_message);
main_list_item->last_msg_type = msg->media_type;
main_list_item->last_msg_service = msg->service;
main_list_item->number_of_unread_msgs = get_unread_message_count(tablename);
- if (peer_info->photo_path) {
+ if (peer_info->photo_path)
main_list_item->profile_pic_path = strdup(peer_info->photo_path);
- } else {
- main_list_item->profile_pic_path = NULL;
- }
- main_list_item->user_name_lbl = NULL;
- main_list_item->status_lbl = NULL;
- main_list_item->date_lbl = NULL;
- main_list_item->msg_status_lbl = NULL;
- main_list_item->main_item_layout = NULL;
+
ad->main_list = eina_list_prepend(ad->main_list, main_list_item);
// delete message object
item->last_message = strdup(" ");
if (peer_info->peer_type == TGL_PEER_CHAT) {
tg_main_list_item_s* main_list_item = (tg_main_list_item_s*)malloc(sizeof(tg_main_list_item_s));
+ memset(main_list_item, 0, sizeof(tg_main_list_item_s));
main_list_item->peer_id = peer_info->peer_id;
main_list_item->peer_type = peer_info->peer_type;
set_peer_names(peer_info, main_list_item);
main_list_item->last_seen_time = peer_info->last_seen_time;
- main_list_item->profile_pic = NULL;
main_list_item->last_message = strdup(item->last_message);
main_list_item->last_msg_type = -1;
main_list_item->last_msg_service = 0;
main_list_item->last_msg_status = -1;
main_list_item->number_of_unread_msgs = 0;
- if (peer_info->photo_path) {
+ if (peer_info->photo_path)
main_list_item->profile_pic_path = strdup(peer_info->photo_path);
- } else {
- main_list_item->profile_pic_path = NULL;
- }
- main_list_item->user_name_lbl = NULL;
- main_list_item->status_lbl = NULL;
- main_list_item->date_lbl = NULL;
- main_list_item->msg_status_lbl = NULL;
- main_list_item->main_item_layout = NULL;
- main_list_item->highlight_text = NULL;
+
ad->main_list = eina_list_prepend(ad->main_list, main_list_item);
}
}
len = strlen(path) + strlen(filename) + 2;
ret = malloc(len);
- if (!ret) {
+ if (!ret)
return NULL;
- }
snprintf(ret, len, "%s/%s", path, filename);
return ret;
len = path_len + strlen(p->d_name) + 2;
buf = malloc(len);
- if (buf)
- {
+ if (buf) {
struct stat statbuf;
snprintf(buf, len, "%s/%s", path, p->d_name);
- if (!stat(buf, &statbuf))
- {
- if (S_ISDIR(statbuf.st_mode))
- {
+ if (!stat(buf, &statbuf)) {
+ if (S_ISDIR(statbuf.st_mode)) {
r2 = remove_directory(buf);
- }
- else
- {
+ } else {
r2 = unlink(buf);
}
}
tg_player_handler *player = NULL;
if (access(audio_file, F_OK) != -1) {
player = (tg_player_handler*)malloc(sizeof(tg_player_handler));
+ memset(player, 0, sizeof(tg_player_handler));
if (player) {
player->timer = NULL;
player->current_pos = 0;
} else if (user_data->peer_type == TGL_PEER_CHAT) {
if (id == 0) {
if (ad->selected_buddy_item) {
- user_data_s *sel_user = ad->selected_buddy_item;
+ /* user_data_s *sel_user = ad->selected_buddy_item; */
show_loading_popup(ad);
send_remove_buddy_from_group_chat_request(ad, ad->service_client, ad->selected_buddy_item->user_id.id, ad->peer_in_cahtting_data->use_data->peer_id);
}
evas_object_smart_callback_add(msg_btn, "clicked", on_chat_camera_button_clicked, msg_btn);
evas_object_data_set(msg_btn, "app_data", ad);
- Elm_Object_Item* navi_item = elm_naviframe_item_push(ad->nf, "Chat Info", NULL, NULL, scroller, NULL);
+ elm_naviframe_item_push(ad->nf, "Chat Info", NULL, NULL, scroller, NULL);
eext_object_event_callback_add(ad->nf, EEXT_CALLBACK_MORE, on_chat_info_menu_button_clicked, ad);
}
{
Eina_List *country_name_list;
Eina_List *country_code_list;
- Evas_Object *popup;
- Evas_Object *btn;
appdata_s* ad;
elm_genlist_item_selected_set(event_info, EINA_FALSE);
#include <mime_type.h>
#include <utils_i18n.h>
-static const char* g_empty_char = "";
+static char* g_empty_char = "";
static const char* g_zero_char = "0.000";
static const int g_base_int = -1;
static const int g_zero_int = 0;
EINA_LIST_FREE(peer_details, ts_msg) {
if (pos == 0) {
tg_peer_info_s* peer_info = (tg_peer_info_s*)malloc(sizeof(tg_peer_info_s));
+ memset(peer_info, 0, sizeof(tg_peer_info_s));
int *temp_peer_id = (int *)eina_list_nth(ts_msg, 0);
if (temp_peer_id) {
eina_list_free(ts_msg);
item = (peer_with_pic_s*) malloc(sizeof(peer_with_pic_s));
+ memset(item, 0, sizeof(peer_with_pic_s));
item->use_data = peer_info;
item->contact_icon = NULL;
} else {
Eina_List *ts_msg = eina_list_nth(chat_details, 0);
chat_info = (tg_chat_info_s*)malloc(sizeof(tg_chat_info_s));
+ memset(chat_info, 0, sizeof(tg_chat_info_s));
int *temp_chat_id = (int *)eina_list_nth(ts_msg, 0);
if (temp_chat_id) {
if (message_details && eina_list_count(message_details) > 0) {
Eina_List *ts_msg = eina_list_nth(message_details, 0);
message = (tg_message_s*)malloc(sizeof(tg_message_s));
+ memset(message, 0, sizeof(tg_message_s));
int *temp_msg_id = (int *)eina_list_nth(ts_msg, 0);
if (temp_msg_id)
if (message_details && eina_list_count(message_details) > 0) {
Eina_List *ts_msg = eina_list_nth(message_details, 0);
message = (tg_message_s*)malloc(sizeof(tg_message_s));
+ memset(message, 0, sizeof(tg_message_s));
int *temp_msg_id = (int *)eina_list_nth(ts_msg, 0);
if (temp_msg_id) {
message->msg_id = *temp_msg_id;
EINA_LIST_FREE(message_details, ts_msg) {
message = (tg_message_s*)malloc(sizeof(tg_message_s));
+ memset(message, 0, sizeof(tg_message_s));
message_list = eina_list_append(message_list, message);
int *temp_msg_id = (int *)eina_list_nth(ts_msg, 0);
int doc_dc = 0;
col_values = eina_list_append(col_values, &doc_dc);
- const char *doc_thumb = NULL;
+ char *doc_thumb = NULL;
get_thumbnail_from_video_url(file_path, &doc_thumb);
if (!doc_thumb) {
}
user_data_s* user_data = (user_data_s*)malloc(sizeof(user_data_s));
+ memset(user_data, 0, sizeof(user_data_s));
user_data->is_selected = EINA_FALSE;
if (temp_user_id) {
user_data->highlight_name = NULL;
user_data_with_pic_s *item = (user_data_with_pic_s*) malloc(sizeof(user_data_with_pic_s));
+ memset(item, 0, sizeof(user_data_with_pic_s));
item->use_data = user_data;
item->contact_icon = NULL;
buddy_list = eina_list_append(buddy_list, item);
Eina_List *ts_msg = NULL;
EINA_LIST_FREE(peer_details, ts_msg) {
tg_peer_info_s* peer_info = (tg_peer_info_s*)malloc(sizeof(tg_peer_info_s));
+ memset(peer_info, 0, sizeof(tg_peer_info_s));
int *temp_peer_id = (int *)eina_list_nth(ts_msg, 0);
if (temp_peer_id) {
peer_info->peer_id = *temp_peer_id;
eina_list_free(ts_msg);
peer_with_pic_s *item = (peer_with_pic_s*) malloc(sizeof(peer_with_pic_s));
+ memset(item, 0, sizeof(peer_with_pic_s));
item->use_data = peer_info;
item->contact_icon = NULL;
peer_list = eina_list_append(peer_list, item);
}
tgl_media_s* media_info = (tgl_media_s*)malloc(sizeof(tgl_media_s));
+ memset(media_info, 0, sizeof(tgl_media_s));
Eina_List *row_vals = eina_list_nth(img_details, 0);
/************************ Menu Handler ********************/
void clear_history_in_gui(appdata_s *ad, tg_peer_info_s *user_data, int peer_type, int peer_id)
{
- if(!ad || !user_data)
+ if (!ad || !user_data)
return;
{
peer_with_pic_s *sel_item = ad->peer_in_cahtting_data;
tg_peer_info_s *user_data = sel_item->use_data;
- if(user_data->peer_type != TGL_PEER_USER)
+ if (user_data->peer_type != TGL_PEER_USER)
return NULL;
switch(id)
itc.item_style = "default";
peer_with_pic_s *sel_item = ad->peer_in_cahtting_data;
+ if (!sel_item || !sel_item->use_data)
+ return;
+
if (sel_item->use_data->peer_type == TGL_PEER_USER) {
itc.func.text_get = on_messaging_menu_text_get_cb;
} else if (sel_item->use_data->peer_type == TGL_PEER_CHAT) {
}
} else {
int strart_number_of_menus = 0;
- if(get_buddy_delete_status(sel_item->use_data->peer_id))
+ if (get_buddy_delete_status(sel_item->use_data->peer_id))
strart_number_of_menus = 1;
for (i = strart_number_of_menus; i < 3; i++) {
elm_genlist_item_append(genlist, &itc, (void *) i, NULL, ELM_GENLIST_ITEM_NONE, on_messaging_menu_option_selected_cb, ad);
appdata_s * ad = evas_object_data_get(data, "app_data");
char *audio_file = evas_object_data_get(data, "audio_file_path");
char *media_id = evas_object_data_get(data, "media_id");
- if (!audio_file || strlen(audio_file) <= 0 || (audio_file && strstr(audio_file, "_null_")) != NULL) {
+
+ if (!ad)
+ return;
+
+ if (!audio_file || strlen(audio_file) <= 0 || !media_id) {
//there is no file. download it.
Evas_Object *progressbar = evas_object_data_get(data, "progress_control");
Eina_Bool is_download_in_progress = (Eina_Bool)evas_object_data_get(progressbar, "is_download_in_progress");
LOGE("Fail to show the bottom of scroller");
}
}
- if(is_end_edge_top)
+ if (is_end_edge_top)
scroller_show_previous_region(chat_scroller);
}
Eina_List *names_of_buddies = NULL;
names_of_buddies = evas_object_data_get(ad->nf, "names_of_buddies");
- if(names_of_buddies != NULL){
+ if (names_of_buddies != NULL){
buddies_info *buddy = NULL;
EINA_LIST_FREE(names_of_buddies, buddy) {
if (buddy) {
- if(buddy->name) {
+ if (buddy->name) {
free(buddy->name);
}
}
char *buddy_name = replace(buddy_full_name, '_', " ");
if (buddy_name) {
buddies_info *buddy_info = (buddies_info*)malloc(sizeof(buddies_info));
+ memset(buddy_info, 0, sizeof(buddies_info));
buddy_info->name = buddy_name;
buddy_info->id = buddy_id;
names_of_buddies = eina_list_append(names_of_buddies, (void*)(buddy_info));
Eina_Bool load_chat_history(Evas_Object *chat_scroller)
{
int offset_num = (int)evas_object_data_get(chat_scroller,"offset_num");
- if(offset_num < -TG_DBMGR_LIMITED) return EINA_FALSE;
+ if (offset_num < -TG_DBMGR_LIMITED) return EINA_FALSE;
appdata_s* ad = evas_object_data_get(chat_scroller, "app_data");
int user_id = (int)evas_object_data_get(chat_scroller, "user_id");
int buddy_id = sel_item->use_data->peer_id;
char* tablename = get_table_name_from_number(buddy_id);
Eina_List *vals = NULL;
- if(offset_num >= 0)
+ if (offset_num >= 0)
vals = get_messages_from_message_table_order_by(tablename, MESSAGE_INFO_TABLE_DATE, EINA_TRUE, TG_DBMGR_LIMITED, offset_num);
else
vals = get_messages_from_message_table_order_by(tablename, MESSAGE_INFO_TABLE_DATE, EINA_TRUE, TG_DBMGR_LIMITED + offset_num, 0);
buddies_info *buddy_info;
for(int i = 0 ; i < buddies_counts ; i++){
buddy_info = (buddies_info*)eina_list_nth(names_of_buddies,i);
- if(buddy_info == NULL) continue;
+ if (buddy_info == NULL) continue;
int len = strlen(buddy_info->name);
char *name_str = (char *)malloc(len + 256);
- if(name_str){
- sprintf(name_str, "<font=Tizen:style=Bold color=#FFFFFF align=center><font_size=40>%s</font_size></font>", buddy_info->name);
+ if (name_str){
+ snprintf(name_str, len + 256, "<font=Tizen:style=Bold color=#FFFFFF align=center><font_size=40>%s</font_size></font>", buddy_info->name);
Elm_Object_Item *button_item = elm_multibuttonentry_item_append(grp_names_lbl, name_str, click_user_name_cb, ad);
elm_object_item_data_set(button_item, (void*)(buddy_info->id));
free(name_str);
int unknown = 0;
sprintf(unknown_str, "%d", unknown);
- char* where_clause = (char *)malloc(strlen(MESSAGE_INFO_TABLE_MARKED_FOR_DELETE) + strlen(" = ") + strlen(unknown_str) + 1);
- sprintf(where_clause, "%s = %s", MESSAGE_INFO_TABLE_MARKED_FOR_DELETE, unknown_str);
+ int len_where = strlen(MESSAGE_INFO_TABLE_MARKED_FOR_DELETE) + strlen(" = ") + strlen(unknown_str) + 1;
+ char* where_clause = (char *)malloc(len_where );
+ snprintf(where_clause, len_where , "%s = %s", MESSAGE_INFO_TABLE_MARKED_FOR_DELETE, unknown_str);
int row_counts = get_number_of_rows(table_name,where_clause);
return (row_counts-TG_DBMGR_LIMITED);
}
}
int user_list_size = chat_info->user_list_size;
- int online_members = 0;
Eina_Bool is_already_present = EINA_FALSE;
for (int i = 0; i < user_list_size; i++) {
return 1;
}
-static bool mp_util_svc_iterate_for_get_video_item_cb(media_info_h item, void *user_data)
-{
- return TRUE;
-}
-
-
static bool __thumbnail_cb(media_info_h item, void *user_data)
{
}
-void tg_notification_create(appdata_s *app, char * icon_path, const char *title, char *content, char *sound_path, char *app_id)
+void tg_notification_create(appdata_s *app, const char * icon_path, const char *title, char *content, char *sound_path, char *app_id)
{
if (app && app->s_notififcation)
notification_delete_all(NOTIFICATION_TYPE_NOTI);
if (sc_db_utils_is_success(contacts_record_get_str_p(record, _contacts_person.display_name, &name))
&& sc_db_utils_is_success(contacts_record_get_int(record, _contacts_person.id, &id))) {
contact_data_s* contact_data = (contact_data_s*)malloc(sizeof(contact_data_s));
+ memset(contact_data, 0, sizeof(contact_data_s));
contact_data->display_name = NULL;
contact_data->first_name = NULL;
contact_data->last_name = NULL;
sqlite3_free(err_msg);
return EINA_FALSE;
}
+ return EINA_TRUE;
}
Eina_Bool insert_table(const char *table_name, Eina_List *column_names, Eina_List *column_types, Eina_List *column_values)
eina_strbuf_append(var_query, "SELECT ");
if(!column_names) {
- var_query = realloc(var_query, strlen(var_query) + 3);
eina_strbuf_append(var_query, "* ");
} else {
int col_count = eina_list_count(column_names);
- char* col_name = NULL;
for(int col = 0; col < col_count ; col++) {
eina_strbuf_append(var_query, eina_list_nth(column_names, col));
if (col < col_count - 1)
return EINA_TRUE;
}
-int get_number_of_rows(char *table_name, char *where_clause)
+int get_number_of_rows(const char *table_name, char *where_clause)
{
int no_of_rows = 0;
if (!table_name || !where_clause)
extern Eina_List* get_values_from_table_sync_order_by(const char* table_name, Eina_List* column_names, Eina_List* column_types, const char* order_column, Eina_Bool is_asc, const char* where_clause);
extern Eina_Bool delete_record(char *tablename, const char* where_clause);
extern Eina_Bool drop_table(char *tablename);
-extern int get_number_of_rows(char* table_name, char* where_clause);
+extern int get_number_of_rows(const char* table_name, char* where_clause);
#endif /* TG_DB_MANAGER_H_ */
tglq_send_query(TLS, TLS->DC_working, packet_ptr - packet_buffer, packet_buffer, &set_profile_name_methods, 0, callback, callback_extra);
}
-void tgl_do_set_username(struct tgl_state *TLS, char *name, void(*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_user *U), void *callback_extra)
+void tgl_do_set_username(struct tgl_state *TLS, const char *name, void(*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_user *U), void *callback_extra)
{
clear_packet();
out_int(CODE_account_update_username);
}
/* {{{ block user */
-static int block_user_on_answer (struct tgl_state *TLS, struct query *q, void *D) {
+static int block_user_on_answer (struct tgl_state *TLS, struct query *q) {
if (q->callback) {
((void (*)(struct tgl_state *, void *, int))q->callback)(TLS, q->callback_extra, 1);
}
extern void tgl_do_set_chat_photo(struct tgl_state *TLS, tgl_peer_id_t chat_id, char *file_name, void(*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_message *M), void *callback_extra);
extern void tgl_do_set_profile_photo(struct tgl_state *TLS, char *file_name, void(*callback)(struct tgl_state *TLS, void *callback_extra, int success), void *callback_extra);
extern void tgl_do_set_profile_name(struct tgl_state *TLS, const char *first_name, const char *last_name, void(*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_user *U), void *callback_extra);
-extern void tgl_do_set_username(struct tgl_state *TLS, char *name, void(*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_user *U), void *callback_extra);
+extern void tgl_do_set_username(struct tgl_state *TLS, const char *name, void(*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_user *U), void *callback_extra);
extern void tgl_do_forward_message(struct tgl_state *TLS, tgl_peer_id_t id, int n, void(*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_message *M), void *callback_extra);
extern void tgl_do_rename_chat(struct tgl_state *TLS, tgl_peer_id_t id, char *name, void(*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_message *M), void *callback_extra);
extern void tgl_do_get_chat_info(struct tgl_state *TLS, tgl_peer_id_t id, int offline_mode, void(*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_chat *C), void *callback_extra);
for (int count = 0 ; count < size ; count++) {
contact_data_s* contact = (contact_data_s*)malloc(sizeof(contact_data_s));
- contact->first_name = NULL;
- contact->last_name = NULL;
- contact->phone_number = NULL;
+ memset(contact, 0, sizeof(contact_data_s));
char first_name_key[20];
snprintf(first_name_key, sizeof(first_name_key), "first_name_%d", count);
EINA_LIST_FREE(unsent_msg_details, ts_msg) {
sent_message_data_s* msg_info = (sent_message_data_s*)malloc(sizeof(sent_message_data_s));
+ memset(msg_info, 0, sizeof(sent_message_data_s));
char *temp_app_name = (char*)eina_list_nth(ts_msg, 0);
if (temp_app_name) {
Eina_List* ts_msg = NULL;
EINA_LIST_FREE(unsent_msg_details, ts_msg) {
sent_media_data_s* msg_info = (sent_media_data_s*)malloc(sizeof(sent_media_data_s));
+ memset(msg_info, 0, sizeof(sent_message_data_s));
char *temp_app_name = (char*)eina_list_nth(ts_msg, 0);
if (temp_app_name) {
if (message_details && eina_list_count(message_details) > 0) {
ts_msg = eina_list_nth(message_details, 0);
message = (struct tgl_message*)malloc(sizeof(struct tgl_message));
+ memset(message, 0, sizeof(struct tgl_message));
int *temp_msg_id = (int*)eina_list_nth(ts_msg, 0);
if (temp_msg_id) {
if (message_details && eina_list_count(message_details) > 0) {
ts_msg = eina_list_nth(message_details, 0);
message = (struct tgl_message*)malloc(sizeof(struct tgl_message));
+ memset(message, 0, sizeof(struct tgl_message));
int *temp_msg_id = (int*)eina_list_nth(ts_msg, 0);
if (temp_msg_id) {
return NULL;
struct tgl_media* media_info = (struct tgl_media*)malloc(sizeof(struct tgl_media));
+ memset(media_info, 0, sizeof(struct tgl_media));
Eina_List* row_vals = eina_list_nth(img_details, 0);
char *temp_media_id = (char *)eina_list_nth(row_vals, 0);
sent_media_data_s* media_info = NULL;
EINA_LIST_FREE(unset_media_msgs, media_info) {
sent_media_data_s* new_media_info = (sent_media_data_s*)malloc(sizeof(sent_media_data_s));
+ memset(new_media_info, 0, sizeof(sent_media_data_s));
new_media_info->app_name = strdup(media_info->app_name);
new_media_info->command = strdup(media_info->command);
new_media_info->buddy_id = strdup(media_info->buddy_id);
if (msg_id > 0) {
send_message_received_response(TLS->callback_data, M->from_id.id, M->to_id.id, msg_id, tgl_get_peer_type(M->to_id));
struct tg_temp_msg_data *msg_data = (struct tg_temp_msg_data*)malloc(sizeof(struct tg_temp_msg_data));
+ memset(msg_data, 0, sizeof(struct tg_temp_msg_data));
msg_data->M = M;
msg_data->TLS = TLS;
msg_data->send_timer = ecore_timer_add(1, on_msg_received_cb, msg_data);
send_message_received_response(TLS->callback_data, M->from_id.id, M->to_id.id, msg_id, tgl_get_peer_type(M->to_id));
struct tg_temp_msg_data *msg_data = (struct tg_temp_msg_data*)malloc(sizeof(struct tg_temp_msg_data));
+ memset(msg_data, 0, sizeof(struct tg_temp_msg_data));
msg_data->M = M;
msg_data->TLS = TLS;
msg_data->send_timer = ecore_timer_add(3, on_msg_received_cb, msg_data);
char* msg_table = get_table_name_from_number(M->to_id.id);
create_buddy_msg_table(msg_table);
- int msg_id = insert_current_date_to_table(msg_table);
+ /* int msg_id = insert_current_date_to_table(msg_table); */
free(msg_table);
struct tgl_photo *pic = &(M->action.photo);
if (pic) {
char* msg_table = get_table_name_from_number(M->to_id.id);
create_buddy_msg_table(msg_table);
- int msg_id = insert_current_date_to_table(msg_table);
+ /* int msg_id = insert_current_date_to_table(msg_table); */
tgl_peer_t* UC = tgl_peer_get(TLS, M->from_id);
int msg_len = strlen(UC->user.first_name) + strlen(" changed profile photo") + 1;
create_buddy_msg_table(msg_table);
- int msg_id = insert_current_date_to_table(msg_table);
+ /* int msg_id = insert_current_date_to_table(msg_table); */
//send_message_received_response(TLS->callback_data, M->from_id.id, M->to_id.id,msg_id, tgl_get_peer_type(M->to_id));
} else if (img_details->media_type == tgl_message_media_photo) {
struct tgl_photo* photo_prop = (struct tgl_photo*)malloc(sizeof(struct tgl_photo));
+ memset(photo_prop, 0, sizeof(struct tgl_photo));
photo_prop->id = img_details->media_id;
photo_prop->access_hash = img_details->access_hash;
photo_prop->user_id = img_details->user_id;
} else if (img_details->media_type == tgl_message_media_document) {
struct tgl_document* doc_prop = (struct tgl_document*)malloc(sizeof(struct tgl_document));
+ memset(doc_prop, 0, sizeof(struct tgl_document));
doc_prop->id = img_details->media_id;;
doc_prop->access_hash = img_details->access_hash;
doc_prop->user_id = img_details->user_id;
if (msg_ids && eina_list_count(msg_ids) > 0) {
msg_list_container_s *msg_list_container = (msg_list_container_s*)malloc(sizeof(msg_list_container_s));
+ memset(msg_list_container, 0, sizeof(msg_list_container_s));
msg_list_container->message_ids = msg_ids;
msg_list_container->buddy_id = buddy_id;
msg_list_container->current_index = 0;
void do_delete_message(int buddy_id, int message_id)
{
msg_container_s *msg_details = (msg_container_s*)malloc(sizeof(msg_container_s));
+ memset(msg_details, 0, sizeof(msg_container_s));
msg_details->buddy_id = buddy_id;
msg_details->message_id = message_id;
tgl_do_delete_msg(s_info.TLS, message_id, &on_message_deleted , (void*)(msg_details));
return tv.tv_sec*(uint64_t)1000000+tv.tv_usec;
}
-void tg_notification_create(tg_engine_data_s* tg_data, char * icon_path, const char *title, char *content, char *sound_path, char *app_id)
+void tg_notification_create(tg_engine_data_s* tg_data, const char * icon_path, const char *title, char *content, char *sound_path, char *app_id)
{
if (tg_data && tg_data->s_notififcation)
notification_delete_all(NOTIFICATION_TYPE_NOTI);
extern char *replace(const char *s, char ch, const char *repl);
-extern void tg_notification_create(tg_engine_data_s* tg_data, char * icon_path, const char *title, char *content, char *sound_path, char *app_id);
+extern void tg_notification_create(tg_engine_data_s* tg_data, const char * icon_path, const char *title, char *content, char *sound_path, char *app_id);
extern void display_badge_with_notification(int unread_msg_cnt, tg_engine_data_s* tg_data);