From: Minje Ahn Date: Thu, 7 May 2020 23:26:17 +0000 (+0900) Subject: Remove test code for directory support X-Git-Tag: accepted/tizen/unified/20200529.124312~7 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fmultimedia%2Flibmm-fileinfo.git;a=commitdiff_plain;h=1d4b45e9ec5b6b6830f8113b825a15bad3209560 Remove test code for directory support Change-Id: I176b6b188bacc38591a1c8ee7257d045eb13b87d Signed-off-by: Minje Ahn --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 66a18a7..ca77264 100755 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,8 +2,7 @@ bin_PROGRAMS = mm_file_test mm_file_test_DEPENDENCIES = $(top_builddir)/libmmffile.la -mm_file_test_SOURCES = mm_file_test.c \ - mm_file_traverser.c +mm_file_test_SOURCES = mm_file_test.c mm_file_test_CFLAGS = -I$(top_builddir)/include \ $(MMCOMMON_CFLAGS) \ diff --git a/tests/mm_file_test.c b/tests/mm_file_test.c index 9dbc4f8..62b31ce 100755 --- a/tests/mm_file_test.c +++ b/tests/mm_file_test.c @@ -30,7 +30,6 @@ #include #include -#include "mm_file_traverse.h" #include "mm_file_debug.h" static FILE *msg_tmp_fp = NULL; @@ -258,21 +257,16 @@ int main(int argc, char **argv) int ret = lstat(argv[1], &statbuf); if (ret < 0) { printf("lstat error[%d]\n", ret); - return MMFILE_FAIL; + return -1; } - if (fpFailList == NULL) { + if (fpFailList == NULL) fpFailList = fopen("/opt/var/log/mmfile_fails.txt", "w"); - } - if (S_ISDIR(statbuf.st_mode)) { - mmfile_get_file_names(argv[1], mmfile_get_file_infomation, NULL); - } else { - if (argv[2] == NULL) - mmfile_get_file_infomation(argv[1], NULL, file_test); - else - mmfile_get_video_frame(argv[1], argv[2], file_test); - } + if (argv[2] == NULL) + mmfile_get_file_infomation(argv[1], NULL, file_test); + else + mmfile_get_video_frame(argv[1], argv[2], file_test); if (fpFailList != NULL) { fflush(fpFailList); diff --git a/tests/mm_file_traverse.h b/tests/mm_file_traverse.h deleted file mode 100755 index 3057d51..0000000 --- a/tests/mm_file_traverse.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * libmm-fileinfo - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Haejeong Kim - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef _MM_FILE_TRAVERSE_H_ -#define _MM_FILE_TRAVERSE_H_ - -#define MMFILE_PATH_MAX 4096 - -typedef enum { - MMFILE_FAIL = 0, - MMFILE_SUCCESS -} MMFILE_RETURN; - -#define SAFE_FREE(src) { if (src) {free(src); src = NULL; } } - -typedef int (*MMFunc)(void *data, void *user_data, bool file_test); - -int mmfile_get_file_names(char *root_dir, MMFunc cbfunc, void *user_data); - -#endif /* _MM_FILE_TRAVERSE_H_ */ diff --git a/tests/mm_file_traverser.c b/tests/mm_file_traverser.c deleted file mode 100755 index aec9ce8..0000000 --- a/tests/mm_file_traverser.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * libmm-fileinfo - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Haejeong Kim - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "mm_file_traverse.h" - -int mmfile_get_file_names(char *root_dir, MMFunc cbfunc, void *user_data) -{ - GDir *dir = NULL; - GError *error = NULL; - GArray *dir_array = NULL; - const char *name; - char pdirname[MMFILE_PATH_MAX + 1] = {0, }; - char *current_path = NULL; - char *start_path = NULL; - char *tmp_path = NULL; - - if (!g_file_test(root_dir, G_FILE_TEST_IS_DIR)) { - printf("it is not directory\n"); - return MMFILE_FAIL; - } - - dir_array = g_array_new(false, false, sizeof(char*)); - if (dir_array == NULL) { - printf("g_array_new failed"); - return MMFILE_FAIL; - } - - start_path = g_strdup(root_dir); - if (start_path != NULL) - g_array_append_val(dir_array, start_path); - - while (dir_array->len != 0) { - current_path = g_array_index(dir_array , char*, 0); - g_array_remove_index(dir_array, 0); - - dir = g_dir_open(current_path, 0, &error); - if (dir != NULL && error == NULL) { - while ((name = g_dir_read_name(dir))) { - memset(pdirname, 0, sizeof(pdirname)); - snprintf(pdirname, sizeof(pdirname), "%s/%s", current_path, name); - - if (g_file_test(pdirname, G_FILE_TEST_IS_DIR)) { - tmp_path = g_strdup(pdirname); - g_array_append_val(dir_array, tmp_path); - } else if (g_file_test(pdirname, G_FILE_TEST_IS_REGULAR)) { - if (cbfunc != NULL) - cbfunc(pdirname, user_data, true); - } - } - } else { - printf("g_dir_open failed"); - } - - if (dir) - g_dir_close(dir); - - SAFE_FREE(current_path); - } - - if (dir_array) - g_array_free(dir_array, FALSE); - - return MMFILE_SUCCESS; -} -