summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRavi Kiran K N <ravi.kiran@samsung.com>2017-09-12 15:28:41 +0530
committerChulSeung Kim <charles0.kim@samsung.com>2017-11-23 15:17:33 +0900
commit40e2b3e988fe47e91d9966d4b92251ea138197bb (patch)
tree6ee4160e4fec508f543c98e3f1abb039b7e5610c /src
parent731d3acab032e0bcb8ac44769b78259185545862 (diff)
downloadattach-panel-document-40e2b3e988fe47e91d9966d4b92251ea138197bb.tar.gz
attach-panel-document-40e2b3e988fe47e91d9966d4b92251ea138197bb.tar.bz2
attach-panel-document-40e2b3e988fe47e91d9966d4b92251ea138197bb.zip
Fixed errors and warnings generated by coding rule checkersubmit/tizen/20171123.072331accepted/tizen/unified/20171124.064510
Change-Id: I3722df1319db53c868c843b54f52599627a7b877 Signed-off-by: Ravi Kiran K N <ravi.kiran@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/attach-panel-document.c80
-rw-r--r--src/doc-data-type.c5
-rw-r--r--src/doc-data-util.c4
-rw-r--r--src/doc-data.c307
-rw-r--r--src/doc-db-update.c16
-rw-r--r--src/doc-list.c95
-rw-r--r--src/doc-local-data.c2
-rw-r--r--src/doc-ui-util.c8
-rw-r--r--src/doc-util.c11
9 files changed, 234 insertions, 294 deletions
diff --git a/src/attach-panel-document.c b/src/attach-panel-document.c
index 09c8900..ca58baf 100644
--- a/src/attach-panel-document.c
+++ b/src/attach-panel-document.c
@@ -86,11 +86,10 @@ static void _doc_win_rot_changed_cb(void *data, Evas_Object * obj,
}
doc_dbg("New angle: %d, old angle: %d", evt, ugd->rotate_mode);
- if (evt == ugd->rotate_mode) {
+ if (evt == ugd->rotate_mode)
return;
- } else {
+ else
ugd->rotate_mode = evt;
- }
/* Update rotate mode and view */
int len = eina_list_count(ugd->rotate_cbs);
@@ -157,6 +156,32 @@ static int _doc_create_view(doc_ugdata * ugd)
return 0;
}
+void doc_free_sel_info(doc_ugdata * ugd)
+{
+ doc_dbg("Deleting selected media data");
+ DOC_CHECK(ugd);
+ Eina_List *l = NULL;
+ doc_sel_item_s *sit = NULL;
+
+ EINA_LIST_FOREACH(ugd->selected_elist, l, sit) {
+ doc_data_util_free_sel_item(sit);
+ }
+ ugd->selected_elist = NULL;
+ doc_dbg("Deleting selected media data done");
+}
+
+void doc_free_medias(doc_ugdata * ugd)
+{
+ doc_dbg("Deleting media data");
+ DOC_CHECK(ugd);
+ DOC_CHECK(ugd->thumbs_d);
+ if (ugd->thumbs_d->medias_elist) {
+ doc_dbg("Deleting media list");
+ doc_data_util_free_mtype_items(&ugd->thumbs_d->medias_elist);
+ }
+ doc_dbg("Deleting media data done");
+}
+
static int _doc_close_view(doc_ugdata * ugd)
{
DOC_CHECK_VAL(ugd, -1);
@@ -196,6 +221,9 @@ static int _doc_close_view(doc_ugdata * ugd)
doc_db_update_finalize(ugd);
/* Disconnet with libmedia-info */
doc_data_finalize(ugd);
+
+ doc_free_sel_info(ugd);
+ doc_free_medias(ugd);
return 0;
}
@@ -208,13 +236,12 @@ static int _doc_parse_param_file(doc_ugdata * ugd, app_control_h service)
app_control_get_mime(service, &mime);
if (mime) {
- if (!g_strcmp0(mime, DOC_MIME_IMAGE_ALL)) {
+ if (!g_strcmp0(mime, DOC_MIME_IMAGE_ALL))
ugd->file_type_mode = DOC_FILE_T_IMAGE;
- } else if (!g_strcmp0(mime, DOC_MIME_VIDEO_ALL)) {
+ else if (!g_strcmp0(mime, DOC_MIME_VIDEO_ALL))
ugd->file_type_mode = DOC_FILE_T_VIDEO;
- } else {
+ else
ugd->file_type_mode = DOC_FILE_T_ALL;
- }
return 0;
}
@@ -238,7 +265,7 @@ static int _doc_parse_param_file(doc_ugdata * ugd, app_control_h service)
}
- DOC_DEFAULT_FILE_TYPE:
+DOC_DEFAULT_FILE_TYPE:
doc_dbg("file type is default, set default type(ALL).");
ugd->file_type_mode = DOC_FILE_T_ALL;
@@ -263,11 +290,10 @@ static int _doc_parse_param(doc_ugdata * ugd, app_control_h service)
app_control_get_extra_data(service, APP_CONTROL_DATA_TOTAL_SIZE,
&(total_size));
if (ret != APP_CONTROL_ERROR_NONE) {
- if (total_size) {
+ if (total_size)
ugd->limitsize = atol(total_size);
- } else {
+ else
ugd->limitsize = -1;
- }
} else {
ugd->limitsize = -1;
}
@@ -279,9 +305,9 @@ static int _doc_parse_param(doc_ugdata * ugd, app_control_h service)
if (!strcasecmp(select_mode, DOC_BUNDLE_SELECTION_MODE_SINGLE)) {
launch_type = strdup(DOC_LAUNCH_SELECT_ONE);
} else
- if (!strcasecmp(select_mode, DOC_BUNDLE_SELECTION_MODE_MULTI)) {
+ if (!strcasecmp(select_mode, DOC_BUNDLE_SELECTION_MODE_MULTI))
launch_type = strdup(DOC_LAUNCH_SELECT_MULTIPLE);
- }
+
DOC_FREE(select_mode);
}
if (launch_type == NULL) {
@@ -330,9 +356,9 @@ static int _doc_parse_param(doc_ugdata * ugd, app_control_h service)
app_control_get_extra_data(service, "indicator-state", &indicator);
if (indicator) {
doc_dbg("indicator: %s", indicator);
- if (!strcasecmp(indicator, "hide")) {
+ if (!strcasecmp(indicator, "hide"))
ugd->b_hide_indicator = true;
- }
+
DOC_FREE(indicator);
}
}
@@ -417,9 +443,8 @@ static void *_doc_create(ui_gadget_h ug, enum ug_mode mode,
app_control_clone(&(ugd->service), service);
/* Connect DB first */
- if (doc_data_init(ugd) != 0) {
+ if (doc_data_init(ugd) != 0)
doc_dbgE("doc_data_init failed!");
- }
/*Register db udpate callback */
doc_db_update_reg_cb(ugd);
@@ -434,20 +459,19 @@ static void *_doc_create(ui_gadget_h ug, enum ug_mode mode,
char *contact_id = NULL;
app_control_get_extra_data(service, "__CALLER_PANEL__", &contact_id);
if (contact_id && !strcmp(contact_id, "attach-panel")) {
- if (ugd) {
+ if (ugd)
ugd->is_attach_panel = true;
- }
- } else {
+ } else if (ugd) {
ugd->is_attach_panel = false;
}
- if (ugd->overlap_mode) {
+ if (ugd->overlap_mode)
ugd->b_hide_indicator = true;
- } else if (ugd->b_hide_indicator) {
+ else if (ugd->b_hide_indicator)
doc_ui_hide_indicator(ugd);
- } else {
+ else
doc_dbg("Normal mode");
- }
+
if (ugd->file_select_mode != DOC_FILE_SELECT_T_NONE) {
/* create attach-panel-document UG */
if (_doc_create_view(ugd) != 0) {
@@ -588,14 +612,16 @@ static void _doc_message(ui_gadget_h ug, app_control_h msg,
ugd->thumbs_d->tot_selected);
elm_object_item_text_set(ugd->nf_it, text);
+ free(text);
+ text = NULL;
/*Disable DONE Button if count is zero */
if (!ugd->thumbs_d->tot_selected) {
btn =
elm_object_item_part_content_get(ugd->nf_it,
DOC_NAVIFRAME_TITLE_RIGHT_BTN);
- if (btn == NULL) {
+ if (btn == NULL)
doc_dbgE("Failed to get part information");
- }
+
elm_object_disabled_set(btn, EINA_TRUE);
}
} else {
@@ -659,7 +685,7 @@ static void _doc_event(ui_gadget_h ug, enum ug_event event,
return;
- UG_ROTATE_EVENT:
+UG_ROTATE_EVENT:
/* Update rotate mode and view */
doc_dbg("rotate_mode: %d", ugd->rotate_mode);
diff --git a/src/doc-data-type.c b/src/doc-data-type.c
index 96b89a3..43fb99e 100644
--- a/src/doc-data-type.c
+++ b/src/doc-data-type.c
@@ -69,9 +69,8 @@ int doc_data_type_free_item(void **item)
ret = _doc_data_type_free_media((doc_media_s **) item);
}
- if (ret < 0) {
+ if (ret < 0)
return -1;
- } else {
+ else
return 0;
- }
}
diff --git a/src/doc-data-util.c b/src/doc-data-util.c
index 80d60f4..e22e953 100644
--- a/src/doc-data-util.c
+++ b/src/doc-data-util.c
@@ -143,7 +143,7 @@ int doc_data_util_create_filter(doc_filter_s * condition,
*filter = tmp_filter;
return 0;
- DOC_DATA_UTIL_FAILED:
+DOC_DATA_UTIL_FAILED:
if (tmp_filter) {
media_filter_destroy(tmp_filter);
@@ -237,7 +237,7 @@ bool doc_data_util_clone_media(media_info_h media, doc_media_s ** pitem,
*pitem = item;
return true;
- DOC_DATA_UTIL_FAILED:
+DOC_DATA_UTIL_FAILED:
doc_data_type_free_item((void **) (&item));
return false;
diff --git a/src/doc-data.c b/src/doc-data.c
index 13c254d..8a02030 100644
--- a/src/doc-data.c
+++ b/src/doc-data.c
@@ -80,13 +80,15 @@ int doc_data_get_sel_paths(doc_ugdata * ugd, char **filepath,
sit = NULL;
if (_cnt > 0) {
*filepath_arr = (char **) calloc(_cnt, sizeof(char *));
- EINA_LIST_FREE(path_list, sit) {
- if (sit && sit->file_url) {
- (*filepath_arr)[idx] = strdup(sit->file_url);
- idx++;
- sit = NULL;
- } else {
- doc_sdbgE("Invalid file path");
+ if ((*filepath_arr) != NULL) {
+ EINA_LIST_FREE(path_list, sit) {
+ if (sit && sit->file_url) {
+ (*filepath_arr)[idx] = strdup(sit->file_url);
+ idx++;
+ sit = NULL;
+ } else {
+ doc_sdbgE("Invalid file path");
+ }
}
}
doc_dbg("array finished!");
@@ -99,9 +101,9 @@ int doc_data_get_sel_paths(doc_ugdata * ugd, char **filepath,
g_string_truncate(selected_path, str_len - 1);
*filepath = g_string_free(selected_path, false);
- if (cnt) {
+ if (cnt)
*cnt = _cnt;
- }
+
return 0;
}
@@ -110,57 +112,47 @@ static fsFileType _document_attr_get_category_by_file_ext(const char
{
int i = 0;
- if (file_ext == NULL) {
+ if (file_ext == NULL)
return FILE_TYPE_ETC;
- }
- if (file_ext[0] == '.') {
+ if (file_ext[0] == '.')
i = 1;
- }
switch (file_ext[i]) {
case 'a':
case 'A':
- if (strcasecmp("ASF", &file_ext[i]) == 0) {
+ if (strcasecmp("ASF", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
- if (strcasecmp("AMR", &file_ext[i]) == 0) {
+ if (strcasecmp("AMR", &file_ext[i]) == 0)
return FILE_TYPE_VOICE;
- }
- if (strcasecmp("AWB", &file_ext[i]) == 0) {
+ if (strcasecmp("AWB", &file_ext[i]) == 0)
return FILE_TYPE_VOICE;
- }
- if (strcasecmp("AAC", &file_ext[i]) == 0) {
+ if (strcasecmp("AAC", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
- if (strcasecmp("AVI", &file_ext[i]) == 0) {
+ if (strcasecmp("AVI", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
- if (strcasecmp("AAC", &file_ext[i]) == 0) {
+ if (strcasecmp("AAC", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
break;
case 'b':
case 'B':
- if (strcasecmp("BMP", &file_ext[i]) == 0) {
+ if (strcasecmp("BMP", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
break;
case 'c':
case 'C':
- if (strcasecmp("csv", &file_ext[i]) == 0) {
+ if (strcasecmp("csv", &file_ext[i]) == 0)
return FILE_TYPE_CSV;
- }
break;
case 'd':
case 'D':
- if (strcasecmp("DOC", &file_ext[i]) == 0) {
+ if (strcasecmp("DOC", &file_ext[i]) == 0)
return FILE_TYPE_DOC;
- }
- if (strcasecmp("DOCX", &file_ext[i]) == 0) {
+
+ if (strcasecmp("DOCX", &file_ext[i]) == 0)
return FILE_TYPE_DOC;
- }
+
if (strcasecmp("DIVX", &file_ext[i]) == 0) {
{
return FILE_TYPE_VIDEO;
@@ -169,280 +161,205 @@ static fsFileType _document_attr_get_category_by_file_ext(const char
break;
case 'E':
case 'e':
- if (strcasecmp("EML", &file_ext[i]) == 0) {
+ if (strcasecmp("EML", &file_ext[i]) == 0)
return FILE_TYPE_EML;
- }
break;
case 'f':
case 'F':
- if (strcasecmp("FLAC", &file_ext[i]) == 0) {
+ if (strcasecmp("FLAC", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
break;
case 'g':
case 'G':
- if (strcasecmp("GIF", &file_ext[i]) == 0) {
+ if (strcasecmp("GIF", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
- if (strcasecmp("G72", &file_ext[i]) == 0) {
+ if (strcasecmp("G72", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
- if (strcasecmp("GUL", &file_ext[i]) == 0) {
+ if (strcasecmp("GUL", &file_ext[i]) == 0)
return FILE_TYPE_GUL;
- }
break;
case 'h':
case 'H':
- if (strcasecmp("HTML", &file_ext[i]) == 0) {
+ if (strcasecmp("HTML", &file_ext[i]) == 0)
return FILE_TYPE_HTML;
- }
- if (strcasecmp("HTM", &file_ext[i]) == 0) {
+ if (strcasecmp("HTM", &file_ext[i]) == 0)
return FILE_TYPE_HTML;
- }
- if (strcasecmp("HWP", &file_ext[i]) == 0) {
+ if (strcasecmp("HWP", &file_ext[i]) == 0)
return FILE_TYPE_HWP;
- }
break;
case 'i':
case 'I':
- if (strcasecmp("IMY", &file_ext[i]) == 0) {
+ if (strcasecmp("IMY", &file_ext[i]) == 0)
return FILE_TYPE_SOUND;
- }
- if (strcasecmp("IPK", &file_ext[i]) == 0) {
+ if (strcasecmp("IPK", &file_ext[i]) == 0)
return FILE_TYPE_APP;
- }
- if (strcasecmp("ICS", &file_ext[i]) == 0) {
+ if (strcasecmp("ICS", &file_ext[i]) == 0)
return FILE_TYPE_VCALENDAR;
- }
break;
case 'j':
case 'J':
- if (strcasecmp("JAD", &file_ext[i]) == 0) {
+ if (strcasecmp("JAD", &file_ext[i]) == 0)
return FILE_TYPE_JAVA;
- }
- if (strcasecmp("JAR", &file_ext[i]) == 0) {
+ if (strcasecmp("JAR", &file_ext[i]) == 0)
return FILE_TYPE_JAVA;
- }
- if (strcasecmp("JPG", &file_ext[i]) == 0) {
+ if (strcasecmp("JPG", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
- if (strcasecmp("JPEG", &file_ext[i]) == 0) {
+ if (strcasecmp("JPEG", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
- if (strcasecmp("JPE", &file_ext[i]) == 0) {
+ if (strcasecmp("JPE", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
- if (strcasecmp("JP2", &file_ext[i]) == 0) {
+ if (strcasecmp("JP2", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
break;
case 'm':
case 'M':
- if (strcasecmp("MMF", &file_ext[i]) == 0) {
+ if (strcasecmp("MMF", &file_ext[i]) == 0)
return FILE_TYPE_SOUND;
- }
- if (strcasecmp("MP3", &file_ext[i]) == 0) {
+ if (strcasecmp("MP3", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
- if (strcasecmp("MID", &file_ext[i]) == 0) {
+ if (strcasecmp("MID", &file_ext[i]) == 0)
return FILE_TYPE_SOUND;
- }
- if (strcasecmp("MIDI", &file_ext[i]) == 0) {
+ if (strcasecmp("MIDI", &file_ext[i]) == 0)
return FILE_TYPE_SOUND;
- }
- if (strcasecmp("MP4", &file_ext[i]) == 0) {
+ if (strcasecmp("MP4", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
- if (strcasecmp("MPG", &file_ext[i]) == 0) {
+ if (strcasecmp("MPG", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
- if (strcasecmp("MPEG", &file_ext[i]) == 0) {
+ if (strcasecmp("MPEG", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
- if (strcasecmp("M4A", &file_ext[i]) == 0) {
+ if (strcasecmp("M4A", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
- if (strcasecmp("M3G", &file_ext[i]) == 0) {
+ if (strcasecmp("M3G", &file_ext[i]) == 0)
return FILE_TYPE_FLASH;
- }
- if (strcasecmp("MXMF", &file_ext[i]) == 0) {
+ if (strcasecmp("MXMF", &file_ext[i]) == 0)
return FILE_TYPE_SOUND;
- }
- if (strcasecmp("MKV", &file_ext[i]) == 0) {
+ if (strcasecmp("MKV", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
- if (strcasecmp("MKA", &file_ext[i]) == 0) {
+ if (strcasecmp("MKA", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
break;
case 'o':
case 'O':
- if (strcasecmp("opml", &file_ext[i]) == 0) {
+ if (strcasecmp("opml", &file_ext[i]) == 0)
return FILE_TYPE_RSS;
- }
- if (strcasecmp("ogg", &file_ext[i]) == 0) {
+ if (strcasecmp("ogg", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
break;
case 'p':
case 'P':
- if (strcasecmp("PNG", &file_ext[i]) == 0) {
+ if (strcasecmp("PNG", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
- if (strcasecmp("PJPEG", &file_ext[i]) == 0) {
+ if (strcasecmp("PJPEG", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
- if (strcasecmp("PDF", &file_ext[i]) == 0) {
+ if (strcasecmp("PDF", &file_ext[i]) == 0)
return FILE_TYPE_PDF;
- }
- if (strcasecmp("PPT", &file_ext[i]) == 0) {
+ if (strcasecmp("PPT", &file_ext[i]) == 0)
return FILE_TYPE_PPT;
- }
- if (strcasecmp("PPTX", &file_ext[i]) == 0) {
+ if (strcasecmp("PPTX", &file_ext[i]) == 0)
return FILE_TYPE_PPT;
- }
- if (strcasecmp("PEM", &file_ext[i]) == 0) {
+ if (strcasecmp("PEM", &file_ext[i]) == 0)
return FILE_TYPE_CERTIFICATION;
- }
break;
case 'r':
case 'R':
- if (strcasecmp("RA", &file_ext[i]) == 0) {
+ if (strcasecmp("RA", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
- if (strcasecmp("RTF", &file_ext[i]) == 0) {
+ if (strcasecmp("RTF", &file_ext[i]) == 0)
return FILE_TYPE_DOC;
- }
break;
case 's':
case 'S':
- if (strcasecmp("SDP", &file_ext[i]) == 0) {
+ if (strcasecmp("SDP", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
- if (strcasecmp("SPM", &file_ext[i]) == 0) {
+ if (strcasecmp("SPM", &file_ext[i]) == 0)
return FILE_TYPE_SOUND;
- }
- if (strcasecmp("SMP", &file_ext[i]) == 0) {
+ if (strcasecmp("SMP", &file_ext[i]) == 0)
return FILE_TYPE_SOUND;
- }
- if (strcasecmp("SPF", &file_ext[i]) == 0) {
+ if (strcasecmp("SPF", &file_ext[i]) == 0)
return FILE_TYPE_SOUND;
- }
- if (strcasecmp("SWF", &file_ext[i]) == 0) {
+ if (strcasecmp("SWF", &file_ext[i]) == 0)
return FILE_TYPE_FLASH;
- }
- if (strcasecmp("SCN", &file_ext[i]) == 0) {
+ if (strcasecmp("SCN", &file_ext[i]) == 0)
return FILE_TYPE_MOVIE_MAKER;
- }
- if (strcasecmp("SVG", &file_ext[i]) == 0) {
+ if (strcasecmp("SVG", &file_ext[i]) == 0)
return FILE_TYPE_SVG;
- }
- if (strcasecmp("SVGZ", &file_ext[i]) == 0) {
+ if (strcasecmp("SVGZ", &file_ext[i]) == 0)
return FILE_TYPE_SVG;
- }
- if (strcasecmp("SNB", &file_ext[i]) == 0) {
+ if (strcasecmp("SNB", &file_ext[i]) == 0)
return FILE_TYPE_SNB;
- }
- if (strcasecmp("SPD", &file_ext[i]) == 0) {
+ if (strcasecmp("SPD", &file_ext[i]) == 0)
return FILE_TYPE_SPD;
- }
break;
case 't':
case 'T':
- if (strcasecmp("TXT", &file_ext[i]) == 0) {
+ if (strcasecmp("TXT", &file_ext[i]) == 0)
return FILE_TYPE_TXT;
- }
- if (strcasecmp("THM", &file_ext[i]) == 0) {
+ if (strcasecmp("THM", &file_ext[i]) == 0)
return FILE_TYPE_THEME;
- }
- if (strcasecmp("TPK", &file_ext[i]) == 0) {
+ if (strcasecmp("TPK", &file_ext[i]) == 0)
return FILE_TYPE_TPK;
- }
- if (strcasecmp("TIF", &file_ext[i]) == 0) {
+ if (strcasecmp("TIF", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
break;
case 'v':
case 'V':
- if (strcasecmp("VCF", &file_ext[i]) == 0) {
+ if (strcasecmp("VCF", &file_ext[i]) == 0)
return FILE_TYPE_VCONTACT;
- }
- if (strcasecmp("VCS", &file_ext[i]) == 0) {
+ if (strcasecmp("VCS", &file_ext[i]) == 0)
return FILE_TYPE_VCALENDAR;
- }
- if (strcasecmp("VNT", &file_ext[i]) == 0) {
+ if (strcasecmp("VNT", &file_ext[i]) == 0)
return FILE_TYPE_VNOTE;
- }
- if (strcasecmp("VBM", &file_ext[i]) == 0) {
+ if (strcasecmp("VBM", &file_ext[i]) == 0)
return FILE_TYPE_VBOOKMARK;
- }
- if (strcasecmp("VTS", &file_ext[i]) == 0) {
+ if (strcasecmp("VTS", &file_ext[i]) == 0)
return FILE_TYPE_TASK;
- }
break;
case 'w':
case 'W':
- if (strcasecmp("WAV", &file_ext[i]) == 0) {
+ if (strcasecmp("WAV", &file_ext[i]) == 0)
return FILE_TYPE_SOUND;
- }
- if (strcasecmp("WBMP", &file_ext[i]) == 0) {
+ if (strcasecmp("WBMP", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
- if (strcasecmp("WGT", &file_ext[i]) == 0) {
+ if (strcasecmp("WGT", &file_ext[i]) == 0)
return FILE_TYPE_WGT;
- }
- if (strcasecmp("WMA", &file_ext[i]) == 0) {
+ if (strcasecmp("WMA", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
- if (strcasecmp("WMV", &file_ext[i]) == 0) {
+ if (strcasecmp("WMV", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
- if (strcasecmp("WML", &file_ext[i]) == 0) {
+ if (strcasecmp("WML", &file_ext[i]) == 0)
return FILE_TYPE_HTML;
- }
- if (strcasecmp("WAVE", &file_ext[i]) == 0) {
+ if (strcasecmp("WAVE", &file_ext[i]) == 0)
return FILE_TYPE_MUSIC;
- }
- if (strcasecmp("WMF", &file_ext[i]) == 0) {
+ if (strcasecmp("WMF", &file_ext[i]) == 0)
return FILE_TYPE_IMAGE;
- }
break;
case 'x':
case 'X':
- if (strcasecmp("XLS", &file_ext[i]) == 0) {
+ if (strcasecmp("XLS", &file_ext[i]) == 0)
return FILE_TYPE_EXCEL;
- }
- if (strcasecmp("XLSX", &file_ext[i]) == 0) {
+ if (strcasecmp("XLSX", &file_ext[i]) == 0)
return FILE_TYPE_EXCEL;
- }
- if (strcasecmp("XMF", &file_ext[i]) == 0) {
+ if (strcasecmp("XMF", &file_ext[i]) == 0)
return FILE_TYPE_SOUND;
- }
- if (strcasecmp("XHTML", &file_ext[i]) == 0) {
+ if (strcasecmp("XHTML", &file_ext[i]) == 0)
return FILE_TYPE_HTML;
- }
- if (strcasecmp("XML", &file_ext[i]) == 0) {
+ if (strcasecmp("XML", &file_ext[i]) == 0)
return FILE_TYPE_HTML;
- }
break;
case 'z':
case 'Z':
- if (strcasecmp("ZIP", &file_ext[i]) == 0) {
+ if (strcasecmp("ZIP", &file_ext[i]) == 0)
return FILE_TYPE_ZIP;
- }
break;
case '3':
- if (strcasecmp("3GP", &file_ext[i]) == 0) {
+ if (strcasecmp("3GP", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
- if (strcasecmp("3GPP", &file_ext[i]) == 0) {
+ if (strcasecmp("3GPP", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
- if (strcasecmp("3G2", &file_ext[i]) == 0) {
+ if (strcasecmp("3G2", &file_ext[i]) == 0)
return FILE_TYPE_VIDEO;
- }
break;
}
@@ -451,16 +368,15 @@ static fsFileType _document_attr_get_category_by_file_ext(const char
static Eina_Bool _doc_list_is_dir(const char *path)
{
- if (!path) {
+ if (!path)
return 0;
- }
+
struct stat info = { 0, };
if (stat(path, &info) == 0) {
- if (S_ISDIR(info.st_mode)) {
+ if (S_ISDIR(info.st_mode))
return 1;
- }
}
return 0;
@@ -476,11 +392,10 @@ static Eina_Bool _document_attr_is_dir(const char *filepath)
const char *_document_file_get(const char path[])
{
char *file = NULL;
- if ((file = strrchr(path, '/'))) {
+ if ((file = strrchr(path, '/')))
file++;
- } else {
+ else
file = (char *) path;
- }
return file;
}
@@ -569,7 +484,7 @@ int doc_data_get_media_data(doc_ugdata * ugd, int type, int start_pos,
bool isUnsupported = false;
- switch(type) {
+ switch (type) {
case FILE_TYPE_DOC:
case FILE_TYPE_PDF:
case FILE_TYPE_PPT:
@@ -585,7 +500,8 @@ int doc_data_get_media_data(doc_ugdata * ugd, int type, int start_pos,
break;
}
- if (isUnsupported == true) continue;
+ if (isUnsupported == true)
+ continue;
ditem = doc_data_util_calloc_item();
if (ditem == NULL) {
@@ -599,17 +515,16 @@ int doc_data_get_media_data(doc_ugdata * ugd, int type, int start_pos,
ditem->store_type = type;
*pmedias_elist = eina_list_append(*pmedias_elist, ditem);
- if (restore_cb && sel_id) {
+ if (restore_cb && sel_id)
restore_cb(sel_id, ditem);
- }
+
item = NULL;
ditem = NULL;
}
} else {
/* Free Mitems */
- if (itemlist) {
+ if (itemlist)
doc_data_util_free_mtype_items(&itemlist);
- }
}
doc_dbg("medias_elist=%p", *pmedias_elist);
return err;
diff --git a/src/doc-db-update.c b/src/doc-db-update.c
index 9ea0e61..67dfa4e 100644
--- a/src/doc-db-update.c
+++ b/src/doc-db-update.c
@@ -96,9 +96,9 @@ static int _doc_db_update_op(media_content_error_e error, int pid,
int cnt = 0;
int ret = -1;
ret = doc_data_get_item_cnt(ugd, &cnt);
- if (ret != 0 || cnt == 0) {
+ if (ret != 0 || cnt == 0)
doc_dbgE("Empty!");
- }
+
doc_dbg("old: %d, new: %d", db_noti->count, cnt);
if (cnt == db_noti->count) {
doc_dbg("Nothing changed");
@@ -159,10 +159,12 @@ bool doc_db_update_reg_cb(doc_ugdata * ugd)
int ret = -1;
doc_dbg("Set db updated callback");
- ret = media_content_add_db_updated_cb(_doc_db_update_cb, ugd, &ugd->noti_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ ret =
+ media_content_add_db_updated_cb(_doc_db_update_cb, ugd,
+ &ugd->noti_handle);
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
doc_dbgE("Set db updated cb failed[%d]!", ret);
- }
+
return true;
}
@@ -171,10 +173,10 @@ bool doc_db_update_finalize(doc_ugdata * ugd)
int ret = -1;
doc_dbg("Unset db updated callback");
+
ret = media_content_remove_db_updated_cb(ugd->noti_handle);
- if (ret != MEDIA_CONTENT_ERROR_NONE) {
+ if (ret != MEDIA_CONTENT_ERROR_NONE)
doc_dbgE("Unset db updated cb failed[%d]!", ret);
- }
DOC_CHECK_FALSE(ugd);
DOC_CHECK_FALSE(ugd->db_noti_d);
diff --git a/src/doc-list.c b/src/doc-list.c
index a21bb4d..f88393a 100644
--- a/src/doc-list.c
+++ b/src/doc-list.c
@@ -106,9 +106,8 @@ static Eina_Bool _data_list_back_cb(void *data, Elm_Object_Item * it)
}
EINA_LIST_FOREACH(ugd->thumbs_d->medias_elist, l, item) {
- if (item) {
+ if (item)
item->checked = false;
- }
}
ugd->selected_elist = eina_list_free(ugd->selected_elist);
@@ -140,9 +139,8 @@ static Evas_Object *_doc_list_show_thumb(Evas_Object * obj,
Evas_Object *ic = elm_icon_add(obj);
DOC_CHECK_NULL(ic);
- if (!elm_image_file_set(ic, full_path, NULL)) {
+ if (!elm_image_file_set(ic, full_path, NULL))
doc_dbgE("Image set failed");
- }
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1,
1);
@@ -193,22 +191,21 @@ static void _doc_list_navi_done_cb(void *data, Evas_Object * obj, void *ei)
APP_CONTROL_RESULT_SUCCEEDED);
ugd->selected_elist = eina_list_free(ugd->selected_elist);
- DOC_SEND_RESULT_FINISHED:
+DOC_SEND_RESULT_FINISHED:
if (paths) {
g_free(paths);
paths = NULL;
}
if (path_array) {
- for (i = 0; i < sel_cnt; i++) {
+ for (i = 0; i < sel_cnt; i++)
DOC_FREEIF(path_array[i]);
- }
+
DOC_FREE(path_array);
}
- if (!ugd->is_attach_panel) {
+ if (!ugd->is_attach_panel)
ug_destroy_me(ugd->ug);
- }
}
static void _doc_list_check_state_changed_cb(void *data, Evas_Object * obj,
@@ -295,20 +292,20 @@ static void _doc_list_check_state_changed_cb(void *data, Evas_Object * obj,
btn =
elm_object_item_part_content_get(ugd->nf_it,
DOC_NAVIFRAME_TITLE_RIGHT_BTN);
- if (btn == NULL) {
+ if (btn == NULL)
doc_dbgE("Failed to get part information");
- }
- if (ugd->thumbs_d->tot_selected == 0) {
+ if (ugd->thumbs_d->tot_selected == 0)
elm_object_disabled_set(btn, EINA_TRUE);
- } else {
+ else
elm_object_disabled_set(btn, EINA_FALSE);
- }
/* Update the label text */
if (ugd->thumbs_d->tot_selected >= 0) {
text = g_strdup_printf(pd_selected, ugd->thumbs_d->tot_selected);
elm_object_item_text_set(ugd->nf_it, text);
+ free(text);
+ text = NULL;
}
}
@@ -347,9 +344,8 @@ const char *_document_file_attr_get_default_icon_by_type(fsFileType ftype)
{
const char *icon_path = DOC_DEFAULT_ICON;
- if (icon_array[ftype]) {
+ if (icon_array[ftype])
icon_path = icon_array[ftype];
- }
return icon_path;
}
@@ -445,9 +441,9 @@ static int _doc_list_select_one(doc_item * ditem, char *file_url)
app_control_add_extra_data(ugd->service,
DOC_FILE_SELECT_RETURN_PATH, file_url);
- if (ret != APP_CONTROL_ERROR_NONE) {
+ if (ret != APP_CONTROL_ERROR_NONE)
doc_dbgW("Add file path failed!");
- }
+
ret =
app_control_add_extra_data_array(ugd->service,
APP_CONTROL_DATA_SELECTED,
@@ -456,17 +452,16 @@ static int _doc_list_select_one(doc_item * ditem, char *file_url)
app_control_add_extra_data_array(ugd->service,
APP_CONTROL_DATA_PATH,
(const char **) path_array, 1);
- if (ret != APP_CONTROL_ERROR_NONE) {
+ if (ret != APP_CONTROL_ERROR_NONE)
doc_dbgW("Add selected path failed!");
- }
+
ret = ug_send_result_full(ugd->ug, ugd->service,
APP_CONTROL_RESULT_SUCCEEDED);
- if (ret != 0) {
+ if (ret != 0)
doc_dbgW("Send result failed!");
- }
- if (!ugd->is_attach_panel) {
+
+ if (!ugd->is_attach_panel)
ug_destroy_me(ugd->ug);
- }
DOC_FREEIF(path_array[0]);
DOC_FREEIF(path_array);
@@ -493,9 +488,8 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object * obj, void *ei)
if (ugd->file_select_mode == DOC_FILE_SELECT_T_ONE) {
int ret = _doc_list_select_one(ditem, ditem->item->file_url);
- if (ret != 0) {
+ if (ret != 0)
doc_dbgE("Data Transfer Failed.");
- }
} else if (ugd->file_select_mode == DOC_FILE_SELECT_T_MULTIPLE) {
Evas_Object *ck =
elm_object_item_part_content_get((Elm_Object_Item *) ei,
@@ -576,21 +570,21 @@ static void _doc_list_item_sel_cb(void *data, Evas_Object * obj, void *ei)
btn =
elm_object_item_part_content_get(ugd->nf_it,
DOC_NAVIFRAME_TITLE_RIGHT_BTN);
- if (btn == NULL) {
+ if (btn == NULL)
doc_dbgE("Failed to get part information");
- }
- if (ugd->thumbs_d->tot_selected == 0) {
+ if (ugd->thumbs_d->tot_selected == 0)
elm_object_disabled_set(btn, EINA_TRUE);
- } else {
+ else
elm_object_disabled_set(btn, EINA_FALSE);
- }
if (ditem->ugd->thumbs_d->tot_selected >= 0) {
text =
g_strdup_printf(pd_selected,
ditem->ugd->thumbs_d->tot_selected);
elm_object_item_text_set(ditem->ugd->nf_it, text);
+ free(text);
+ text = NULL;
}
}
}
@@ -624,9 +618,8 @@ static void _doc_list_navi_cancel_cb(void *data, Evas_Object * obj,
}
EINA_LIST_FOREACH(app_data->thumbs_d->medias_elist, l, ditem) {
- if (ditem) {
+ if (ditem)
ditem->checked = false;
- }
}
app_data->selected_elist = eina_list_free(app_data->selected_elist);
@@ -753,9 +746,9 @@ int doc_update_genlist(doc_ugdata * ugd)
elm_win_screen_size_get(ugd->win, &win_x, &win_y, &win_w, &win_h);
- if (ugd->thumbs_d->medias_elist) {
+ if (ugd->thumbs_d->medias_elist)
doc_data_util_free_mtype_items(&ugd->thumbs_d->medias_elist);
- }
+
ugd->thumbs_d->medias_cnt = 0;
@@ -867,19 +860,22 @@ int doc_update_genlist(doc_ugdata * ugd)
btn =
elm_object_item_part_content_get(ugd->nf_it,
DOC_NAVIFRAME_TITLE_RIGHT_BTN);
- if (btn == NULL) {
+ if (btn == NULL)
doc_dbgE("Failed to get part information");
- }
- if (ugd->thumbs_d->tot_selected == 0) {
+
+ if (ugd->thumbs_d->tot_selected == 0)
elm_object_disabled_set(btn, EINA_TRUE);
- } else {
+ else
elm_object_disabled_set(btn, EINA_FALSE);
- }
+
char *text = g_strdup_printf(pd_selected, ugd->thumbs_d->tot_selected);
elm_object_item_text_set(ugd->nf_it, text);
+ free(text);
+ text = NULL;
+
return 0;
}
@@ -919,9 +915,9 @@ int doc_create_genlist(doc_ugdata * ugd)
&(ugd->thumbs_d->medias_elist),
NULL, NULL);
- if (ret != 0) {
+ if (ret != 0)
doc_dbgE("###Get items list over[%d]###", ret);
- }
+
ugd->thumbs_d->medias_cnt =
eina_list_count(ugd->thumbs_d->medias_elist);
@@ -1010,14 +1006,14 @@ int doc_create_genlist(doc_ugdata * ugd)
}
char *pd_selected = DOC_STR_PD_SELECTED;
+ char *text = g_strdup_printf(pd_selected, ugd->thumbs_d->tot_selected);
ugd->nf_it =
elm_naviframe_item_push(ugd->naviframe,
- g_strdup_printf(pd_selected,
- ugd->thumbs_d->
- tot_selected), NULL, NULL,
- ugd->list_view, "basic/transparent");
- elm_object_item_color_class_color_set(ugd->nf_it, "bg_title", 150, 155, 158,
- 255);
+ text,
+ NULL, NULL, ugd->list_view,
+ "basic/transparent");
+ elm_object_item_color_class_color_set(ugd->nf_it, "bg_title", 150, 155,
+ 158, 255);
/* Cancel Button */
Evas_Object *btn1 = elm_button_add(ugd->naviframe);
@@ -1045,5 +1041,8 @@ int doc_create_genlist(doc_ugdata * ugd)
elm_naviframe_item_pop_cb_set(ugd->nf_it, _data_list_back_cb, ugd);
+ free(text);
+ text = NULL;
+
return 0;
}
diff --git a/src/doc-local-data.c b/src/doc-local-data.c
index 7d176f9..bce2869 100644
--- a/src/doc-local-data.c
+++ b/src/doc-local-data.c
@@ -81,7 +81,7 @@ static bool _doc_local_data_clone_folder(media_folder_h folder,
*pfolder = tmp_folder;
return true;
- DOC_LOCAL_FAILED:
+DOC_LOCAL_FAILED:
doc_data_type_free_item((void **) (&tmp_folder));
*pfolder = NULL;
diff --git a/src/doc-ui-util.c b/src/doc-ui-util.c
index 8256125..c17638c 100644
--- a/src/doc-ui-util.c
+++ b/src/doc-ui-util.c
@@ -86,9 +86,9 @@ Evas_Object *doc_ui_create_naviframe(doc_ugdata * ugd,
DOC_CHECK_NULL(nf);
/* Disable Naviframe Back Button Auto creation function */
elm_naviframe_prev_btn_auto_pushed_set(nf, EINA_FALSE);
- if (ugd->th) {
+ if (ugd->th)
elm_object_theme_set(nf, ugd->th);
- }
+
elm_object_part_content_set(parent, "elm.swallow.content", nf);
evas_object_show(nf);
@@ -147,9 +147,9 @@ static int _doc_ui_restore_scroller_pos(Evas_Object * obj)
w = (Evas_Coord) evas_object_data_get(obj, "prev_scroller_w");
h = (Evas_Coord) evas_object_data_get(obj, "prev_scroller_h");
doc_dbg("(%dx%d), (%dx%d)", x, y, w, h);
- if (w > 0 && h > 0) {
+ if (w > 0 && h > 0)
elm_scroller_region_show(obj, x, y, w, h);
- }
+
return 0;
}
#endif
diff --git a/src/doc-util.c b/src/doc-util.c
index 1e9c64d..fd41d7b 100644
--- a/src/doc-util.c
+++ b/src/doc-util.c
@@ -86,9 +86,9 @@ Eina_Bool doc_update_view(doc_ugdata * ugd, int mode)
ret = doc_update_genlist(ugd);
- if (ret != 0) {
+ if (ret != 0)
return EINA_FALSE;
- }
+
return EINA_TRUE;
}
@@ -101,9 +101,9 @@ int doc_reg_db_update_noti(doc_ugdata * ugd)
error_code =
storage_set_state_changed_cb(__externalStorageId,
_doc_db_update_sdcard_info, ugd);
- if (error_code != STORAGE_ERROR_NONE) {
+ if (error_code != STORAGE_ERROR_NONE)
doc_dbgE("storage_set_state_changed_cb failed!");
- }
+
return 0;
}
@@ -115,9 +115,8 @@ int doc_dereg_db_update_noti(void)
error_code =
storage_unset_state_changed_cb(__externalStorageId,
_doc_db_update_sdcard_info);
- if (error_code != STORAGE_ERROR_NONE) {
+ if (error_code != STORAGE_ERROR_NONE)
doc_dbgE("storage_set_state_changed_cb failed!");
- }
return 0;
}