diff options
author | SukHyung, Kang <shine.kang@samsung.com> | 2015-12-09 15:28:23 +0900 |
---|---|---|
committer | SukHyung, Kang <shine.kang@samsung.com> | 2015-12-10 15:17:49 +0900 |
commit | cd105dadccc38eee9a94313b7b09a82ca40d0360 (patch) | |
tree | 59b60e7e21ec2ff3dda32b4786bdc4c14c826796 | |
parent | 10b842377825d94b4d0367d60dc3f7586274a663 (diff) | |
download | mime-type-cd105dadccc38eee9a94313b7b09a82ca40d0360.tar.gz mime-type-cd105dadccc38eee9a94313b7b09a82ca40d0360.tar.bz2 mime-type-cd105dadccc38eee9a94313b7b09a82ca40d0360.zip |
change code to apply coding rule and remove TC codessubmit/tizen_common/20151229.154718submit/tizen_common/20151229.144031submit/tizen_common/20151229.142028submit/tizen/20151211.090312accepted/tizen/wearable/20151212.073415accepted/tizen/tv/20151212.072754accepted/tizen/mobile/20151212.071319
Change-Id: Iaa5aaba941fd056317636e6b9c9e2025868b38e6
Signed-off-by: SukHyung, Kang <shine.kang@samsung.com>
-rwxr-xr-x | CMakeLists.txt | 2 | ||||
-rwxr-xr-x | TC/_export_env.sh | 8 | ||||
-rwxr-xr-x | TC/_export_target_env.sh | 7 | ||||
-rwxr-xr-x | TC/build.sh | 16 | ||||
-rwxr-xr-x | TC/clean.sh | 11 | ||||
-rwxr-xr-x | TC/config | 2 | ||||
-rwxr-xr-x | TC/execute.sh | 15 | ||||
-rwxr-xr-x | TC/testcase/Makefile | 24 | ||||
-rwxr-xr-x | TC/testcase/tslist | 1 | ||||
-rwxr-xr-x | TC/testcase/utc_mime_type.c | 366 | ||||
-rwxr-xr-x | TC/tet_scen | 7 | ||||
-rwxr-xr-x | TC/tetbuild.cfg | 5 | ||||
-rwxr-xr-x | TC/tetclean.cfg | 5 | ||||
-rwxr-xr-x | TC/tetexec.cfg | 5 | ||||
-rwxr-xr-x | src/mime_type.c | 49 |
15 files changed, 12 insertions, 511 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 20e016e..365123c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ ADD_CUSTOM_COMMAND( -name install_manifest.txt -or -name *.pc -or -name *~ \) - | grep -v TC | xargs rm -rf + | xargs rm -rf TARGET distclean VERBATIM ) diff --git a/TC/_export_env.sh b/TC/_export_env.sh deleted file mode 100755 index 72a11ec..0000000 --- a/TC/_export_env.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -. ./config -export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh deleted file mode 100755 index 5ddaa53..0000000 --- a/TC/_export_target_env.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -. ./config -export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path -export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target -export PATH=$TET_TARGET_PATH/bin:$PATH -export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH -export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/build.sh b/TC/build.sh deleted file mode 100755 index 72aad6c..0000000 --- a/TC/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -. ./_export_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -FILE_NAME_EXTENSION=`date +%s` - -RESULT_DIR=results -HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal - -mkdir -p $RESULT_DIR - -tcc -c -p ./ -tcc -b -j $JOURNAL_RESULT -p ./ -grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/clean.sh b/TC/clean.sh deleted file mode 100755 index 29743e0..0000000 --- a/TC/clean.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -. ./_export_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -RESULT_DIR=results - -tcc -c -p ./ # executing tcc, with clean option (-c) -rm -r $RESULT_DIR -rm -r tet_tmp_dir -rm testcase/tet_captured diff --git a/TC/config b/TC/config deleted file mode 100755 index 6761a8b..0000000 --- a/TC/config +++ /dev/null @@ -1,2 +0,0 @@ -TET_INSTALL_HOST_PATH=/home/junghyuk/workspace/TETware -TET_INSTALL_TARGET_PATH=/mnt/nfs/workspace/TETware diff --git a/TC/execute.sh b/TC/execute.sh deleted file mode 100755 index a4f6095..0000000 --- a/TC/execute.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -. ./_export_target_env.sh # setting environment variables - -export TET_SUITE_ROOT=`pwd` -FILE_NAME_EXTENSION=`date +%s` - -RESULT_DIR=results -HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal - -mkdir -p $RESULT_DIR - -tcc -e -j $JOURNAL_RESULT -p ./ -grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile deleted file mode 100755 index 58896eb..0000000 --- a/TC/testcase/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -CC ?= gcc - -C_FILES = $(shell ls *.c) - -PKGS = capi-content-mime-type capi-base-common - -LDFLAGS = `pkg-config --libs $(PKGS)` -LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s - -CFLAGS = -I. `pkg-config --cflags $(PKGS)` -CFLAGS += -I$(TET_ROOT)/inc/tet3 -CFLAGS += -Wall - -TCS := $(shell ls -1 *.c | cut -d. -f1) - -all: $(TCS) - -%: %.c - $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) - -clean: - rm -f $(TCS)
\ No newline at end of file diff --git a/TC/testcase/tslist b/TC/testcase/tslist deleted file mode 100755 index f0be022..0000000 --- a/TC/testcase/tslist +++ /dev/null @@ -1 +0,0 @@ -/testcase/utc_mime_type
\ No newline at end of file diff --git a/TC/testcase/utc_mime_type.c b/TC/testcase/utc_mime_type.c deleted file mode 100755 index 9f011fe..0000000 --- a/TC/testcase/utc_mime_type.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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 <tet_api.h> -#include <mime_type.h> - -static void startup(void); -static void cleanup(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_mime_type_get_mime_type_positive1(void); -static void utc_mime_type_get_mime_type_positive2(void); -static void utc_mime_type_get_mime_type_positive3(void); -static void utc_mime_type_get_mime_type_positive4(void); -static void utc_mime_type_get_mime_type_positive5(void); -static void utc_mime_type_get_mime_type_positive5(void); - -static void utc_mime_type_get_mime_type_negative1(void); -static void utc_mime_type_get_mime_type_negative2(void); -static void utc_mime_type_get_mime_type_negative3(void); - -static void utc_mime_type_get_file_extension_positive1(void); -static void utc_mime_type_get_file_extension_positive2(void); - -static void utc_mime_type_get_file_extension_negative1(void); -static void utc_mime_type_get_file_extension_negative2(void); -static void utc_mime_type_get_file_extension_negative3(void); -static void utc_mime_type_get_file_extension_negative4(void); - -struct tet_testlist tet_testlist[] = { - {utc_mime_type_get_mime_type_positive1, 1}, - {utc_mime_type_get_mime_type_positive2, 1}, - {utc_mime_type_get_mime_type_positive3, 1}, - {utc_mime_type_get_mime_type_positive4, 1}, - {utc_mime_type_get_mime_type_positive5, 1}, - - {utc_mime_type_get_mime_type_negative1, 1}, - {utc_mime_type_get_mime_type_negative2, 1}, - {utc_mime_type_get_mime_type_negative3, 1}, - - {utc_mime_type_get_file_extension_positive1, 1}, - {utc_mime_type_get_file_extension_positive2, 1}, - - {utc_mime_type_get_file_extension_negative1, 1}, - {utc_mime_type_get_file_extension_negative2, 1}, - {utc_mime_type_get_file_extension_negative3, 1}, - {utc_mime_type_get_file_extension_negative4, 1}, - - {NULL, 0}, -}; - -static void startup(void) -{ - -} - -static void cleanup(void) -{ - /* end of TC */ -} - -void utc_mime_type_get_mime_type_positive1(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char *mime_type; - - retcode = mime_type_get_mime_type("png", &mime_type); - - if (retcode == MIME_TYPE_ERROR_NONE && !strcmp(mime_type, "image/png")) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_mime_type_positive2(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char *mime_type; - - retcode = mime_type_get_mime_type("jpg", &mime_type); - - if (retcode == MIME_TYPE_ERROR_NONE && !strcmp(mime_type, "image/jpeg")) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_mime_type_positive3(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char *mime_type; - - retcode = mime_type_get_mime_type("mpg", &mime_type); - - if (retcode == MIME_TYPE_ERROR_NONE && !strcmp(mime_type, "video/mpeg")) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_mime_type_positive4(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char *mime_type; - - retcode = mime_type_get_mime_type("mp3", &mime_type); - - if (retcode == MIME_TYPE_ERROR_NONE && !strcmp(mime_type, "audio/mpeg")) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - - -void utc_mime_type_get_mime_type_positive5(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char *mime_type; - - retcode = mime_type_get_mime_type("bin", &mime_type); - - if (retcode == MIME_TYPE_ERROR_NONE && !strcmp(mime_type, "application/octet-stream")) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_mime_type_positive6(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char *mime_type; - - retcode = mime_type_get_mime_type("abcdef", &mime_type); - - if (retcode == MIME_TYPE_ERROR_NONE && !strcmp(mime_type, "application/octet-stream")) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - - -void utc_mime_type_get_mime_type_negative1(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char *mime_type; - - retcode = mime_type_get_mime_type(NULL, &mime_type); - - if (retcode == MIME_TYPE_ERROR_INVALID_PARAMETER) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_mime_type_negative2(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char *mime_type; - - retcode = mime_type_get_mime_type("", &mime_type); - - if (retcode == MIME_TYPE_ERROR_INVALID_PARAMETER) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_mime_type_negative3(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - - retcode = mime_type_get_mime_type("mp3", NULL); - - if (retcode == MIME_TYPE_ERROR_INVALID_PARAMETER) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - - -void utc_mime_type_get_file_extension_positive1(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char **file_extension; - int length; - - retcode = mime_type_get_file_extension("video/mpeg", &file_extension, &length); - - if (retcode == MIME_TYPE_ERROR_NONE && length > 0) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_file_extension_positive2(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char **file_extension; - int length; - - retcode = mime_type_get_file_extension("image/jpeg", &file_extension, &length); - - if (retcode == MIME_TYPE_ERROR_NONE && length > 0) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_file_extension_negative1(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char **file_extension; - int length; - - retcode = mime_type_get_file_extension(NULL, &file_extension, &length); - - if (retcode == MIME_TYPE_ERROR_INVALID_PARAMETER) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_file_extension_negative2(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char **file_extension; - int length; - - retcode = mime_type_get_file_extension("", &file_extension, &length); - - if (retcode == MIME_TYPE_ERROR_INVALID_PARAMETER) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_file_extension_negative3(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - int length; - - retcode = mime_type_get_file_extension("image/jpeg", NULL, &length); - - if (retcode == MIME_TYPE_ERROR_INVALID_PARAMETER) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} - -void utc_mime_type_get_file_extension_negative4(void) -{ - const char *TC_NAME = __FUNCTION__; - - int retcode; - char **file_extension; - - retcode = mime_type_get_file_extension("image/jpeg", &file_extension, NULL); - - if (retcode == MIME_TYPE_ERROR_INVALID_PARAMETER) - { - dts_pass(TC_NAME, "passed"); - } - else - { - dts_fail(TC_NAME, "failed"); - } -} diff --git a/TC/tet_scen b/TC/tet_scen deleted file mode 100755 index 03f029a..0000000 --- a/TC/tet_scen +++ /dev/null @@ -1,7 +0,0 @@ -all - ^TEST -##### Scenarios for TEST ##### - -# Test scenario -TEST - :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg deleted file mode 100755 index f7eda55..0000000 --- a/TC/tetbuild.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option for build operation checking -TET_BUILD_TOOL=make # build with using make command -TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build -TET_API_COMPLIANT=True # use TET API in Test Case ? -TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg deleted file mode 100755 index 02d7030..0000000 --- a/TC/tetclean.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capture option -TET_CLEAN_TOOL= make clean # clean tool -TET_CLEAN_FILE= Makefile # file for clean -TET_API_COMPLIANT=True # TET API useage -TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg deleted file mode 100755 index ef3e452..0000000 --- a/TC/tetexec.cfg +++ /dev/null @@ -1,5 +0,0 @@ -TET_OUTPUT_CAPTURE=True # capturing execution or not -TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional -TET_EXEC_FILE= # ex) exectool : execution file/ Optional -TET_API_COMPLIANT=True # Test case or Tool usesTET API? -TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/src/mime_type.c b/src/mime_type.c index dcc4bf2..53c4a9c 100755 --- a/src/mime_type.c +++ b/src/mime_type.c @@ -11,7 +11,7 @@ * 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. + * limitations under the License. */ #include <stdio.h> @@ -33,8 +33,7 @@ static const char* mime_type_error_to_string(mime_type_error_e error) { - switch (error) - { + switch (error) { case MIME_TYPE_ERROR_NONE: return "NONE"; @@ -47,7 +46,7 @@ static const char* mime_type_error_to_string(mime_type_error_e error) case MIME_TYPE_ERROR_IO_ERROR: return "IO_ERROR"; - default : + default: return "UNKNOWN"; } } @@ -55,13 +54,9 @@ static const char* mime_type_error_to_string(mime_type_error_e error) static int mime_type_error(mime_type_error_e error, const char* function, const char *description) { if (description) - { - LOGE("[%s] %s(0x%08x) : %s", function, mime_type_error_to_string(error), error, description); - } + LOGE("[%s] %s(0x%08x) : %s", function, mime_type_error_to_string(error), error, description); else - { - LOGE("[%s] %s(0x%08x)", function, mime_type_error_to_string(error), error); - } + LOGE("[%s] %s(0x%08x)", function, mime_type_error_to_string(error), error); return error; } @@ -73,41 +68,31 @@ int mime_type_get_mime_type(const char *file_extension, char **mime_type) const char *xdg_mime_type = NULL; if (file_extension == NULL || mime_type == NULL) - { return mime_type_error(MIME_TYPE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); - } if (file_extension[0] == '\0') - { return mime_type_error(MIME_TYPE_ERROR_INVALID_PARAMETER, __FUNCTION__, "the given file extension is an empy string"); - } if (file_extension[0] == FILE_EXTENSION_DELIMITER) - { return mime_type_error(MIME_TYPE_ERROR_INVALID_PARAMETER, __FUNCTION__, "the given file extension includes the leading dot ('.')"); - } snprintf(file_extension_with_dot, sizeof(file_extension_with_dot), ".%s", file_extension); xdg_mime_type = xdg_mime_get_mime_type_from_file_name(file_extension_with_dot); - if (xdg_mime_type == NULL || *xdg_mime_type == '\0') - { + if (xdg_mime_type == NULL || *xdg_mime_type == '\0') { *mime_type = NULL; return mime_type_error(MIME_TYPE_ERROR_IO_ERROR, __FUNCTION__, "failed to get the mime type from the shared MIME database"); } - + char * mime_type_dup = NULL; mime_type_dup = strdup(xdg_mime_type); if (mime_type_dup == NULL) - { return mime_type_error(MIME_TYPE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); - } *mime_type = mime_type_dup; - return MIME_TYPE_ERROR_NONE; } @@ -120,42 +105,30 @@ int mime_type_get_file_extension(const char *mime_type, char *** file_extension, int file_extension_array_index = 0; if (mime_type == NULL || file_extension == NULL || length == NULL) - { return mime_type_error(MIME_TYPE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL); - } if (mime_type[0] == '\0') - { return mime_type_error(MIME_TYPE_ERROR_INVALID_PARAMETER, __FUNCTION__, "the given MIME type is an empy string"); - } xdg_file_extension = xdg_mime_get_file_names_from_mime_type(mime_type); if (xdg_file_extension == NULL) - { return mime_type_error(MIME_TYPE_ERROR_IO_ERROR, __FUNCTION__, "failed to get the file extensions from the shared MIME database"); - } while (xdg_file_extension[xdg_file_extension_length] != NULL) - { xdg_file_extension_length++; - } file_extension_array = calloc(xdg_file_extension_length, sizeof(char*)); - + if (file_extension_array == NULL) - { return mime_type_error(MIME_TYPE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL); - } - for (xdg_file_extension_length = 0; xdg_file_extension[xdg_file_extension_length] != NULL; xdg_file_extension_length++) - { + for (xdg_file_extension_length = 0; xdg_file_extension[xdg_file_extension_length] != NULL; xdg_file_extension_length++) { char *entry = NULL; - + entry = strrchr(xdg_file_extension[xdg_file_extension_length], FILE_EXTENSION_DELIMITER); - if (entry != NULL) - { + if (entry != NULL) { entry++; file_extension_array[file_extension_array_index] = strdup(entry); file_extension_array_index++; |