tizen 2.3.1 release accepted/tizen_2.4_mobile tizen_2.3.1 tizen_2.4 accepted/tizen/2.4/mobile/20151029.034620 submit/tizen_2.3.1/20150915.075833 submit/tizen_2.4/20151028.063629 tizen_2.3.1_release tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 13:10:29 +0000 (22:10 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Tue, 8 Sep 2015 13:10:29 +0000 (22:10 +0900)
14 files changed:
capi-content-mime-type.manifest [new file with mode: 0644]
debian/README [new file with mode: 0755]
debian/capi-content-mime-type-dev.install [new file with mode: 0755]
debian/capi-content-mime-type-dev.postinst [new file with mode: 0755]
debian/capi-content-mime-type.install [new file with mode: 0755]
debian/capi-content-mime-type.postinst [new file with mode: 0755]
debian/changelog [new file with mode: 0755]
debian/compat [new file with mode: 0755]
debian/control [new file with mode: 0755]
debian/rules [new file with mode: 0755]
doc/content_mime_type_doc.h [new file with mode: 0755]
include/mime_type.h
packaging/capi-content-mime-type.spec
src/mime_type.c

diff --git a/capi-content-mime-type.manifest b/capi-content-mime-type.manifest
new file mode 100644 (file)
index 0000000..75b0fa5
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+    <request>
+        <domain name="_"/>
+    </request>
+</manifest>
diff --git a/debian/README b/debian/README
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/debian/capi-content-mime-type-dev.install b/debian/capi-content-mime-type-dev.install
new file mode 100755 (executable)
index 0000000..761a28b
--- /dev/null
@@ -0,0 +1,4 @@
+/usr/include/*
+/usr/include/*/*
+/usr/lib/pkgconfig/*.pc
+
diff --git a/debian/capi-content-mime-type-dev.postinst b/debian/capi-content-mime-type-dev.postinst
new file mode 100755 (executable)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/capi-content-mime-type.install b/debian/capi-content-mime-type.install
new file mode 100755 (executable)
index 0000000..4a755a4
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/lib*.so*
diff --git a/debian/capi-content-mime-type.postinst b/debian/capi-content-mime-type.postinst
new file mode 100755 (executable)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/changelog b/debian/changelog
new file mode 100755 (executable)
index 0000000..3c61b8e
--- /dev/null
@@ -0,0 +1,9 @@
+capi-content-mime-type (0.0.1-1) unstable; urgency=low
+
+  * Initial upload
+  * Git: slp/api/mime-type
+  * Tag: capi-content-mime-type_0.0.1-1
+
+ -- Junghyuk Park <junghyuk.park@samsung.com>  Mon, 23 Apr 2012 15:31:12 +0900
+
+
diff --git a/debian/compat b/debian/compat
new file mode 100755 (executable)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..f443709
--- /dev/null
@@ -0,0 +1,22 @@
+
+Source: capi-content-mime-type
+Section: libs
+Priority: extra
+Maintainer: Woongsuk Cho <ws77.cho@samsung.com>, Junghyuk Park <junghyuk.park@samsung.com>
+Build-Depends: debhelper (>= 5), dlog-dev, capi-base-common-dev, libxdgmime-dev
+
+Package: capi-content-mime-type
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: A MIME type library in Tizen Native API
+
+Package: capi-content-mime-type-dev
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-content-mime-type (= ${Source-Version}), capi-base-common-dev
+Description: A MIME type library in Tizen Native API (DEV)
+
+Package: capi-content-mime-type-dbg
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-content-mime-type (= ${Source-Version})
+Description: A MIME type library in Tizen Native API (DBG)
+
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..dac85b2
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/make -f
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+CMAKE_ROOT_DIR ?= $(CURDIR)
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
+MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
+       touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure-stamp 
+       dh_testdir
+       cd $(CMAKE_BUILD_DIR) && $(MAKE)
+       touch $@
+
+clean:
+       cd $(CMAKE_ROOT_DIR)
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       rm -f `find . -name *.pc`
+       rm -rf $(CMAKE_BUILD_DIR)
+       dh_clean
+       
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+binary-indep: build install
+
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=capi-content-mime-type-dbg
+       dh_fixperms
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
+
diff --git a/doc/content_mime_type_doc.h b/doc/content_mime_type_doc.h
new file mode 100755 (executable)
index 0000000..f4c02fc
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+
+
+#ifndef __TIZEN_CONTENT_MIME_TYPE_DOC_H__
+#define __TIZEN_CONTENT_MIME_TYPE_DOC_H__
+
+/**
+ * @ingroup CAPI_CONTENT_FRAMEWORK
+ * @defgroup CAPI_CONTENT_MIME_TYPE_MODULE MIME Type
+ * @brief The @ref CAPI_CONTENT_MIME_TYPE_MODULE API provides functions to map MIME types to file extensions and vice versa.
+ *
+ * @section CAPI_CONTENT_MIME_TYPE_MODULE_HEADER Required Header
+ *   \#include <mime_type.h>
+ *
+ * @section CAPI_CONTENT_MIME_TYPE_MODULE_OVERVIEW Overview
+ * The MIME Type API provides functions to map MIME types to file extensions and vice versa.
+ * Conversions are provided from file extensions to MIME types and from MIME types to file extensions. \n
+ * Note that some MIME types have multiple file extensions or no extension,
+ * and the MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats
+ */
+
+#endif /* __TIZEN_CONTENT_MIME_TYPE_DOC_H__ */
+
index a1f4328..2004d41 100755 (executable)
@@ -25,13 +25,19 @@ extern "C"
 #endif
 
 /**
+ * @file mime_type.h
+ */
+
+/**
  * @addtogroup CAPI_CONTENT_MIME_TYPE_MODULE
  * @{
  */
 
 
 /**
- * @brief Enumeration of error code
+ * @brief Enumeration for error.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 typedef enum
 {
@@ -45,11 +51,14 @@ typedef enum
 /**
  * @brief Gets the MIME type for the given file extension.
  *
- * @remarks The @a mime_type must be released with free() by you.
- * @param [in] file_extension The file extension without the leading dot ('.')
- * @param [out] mime_type The MIME type for the given file extension \n
- * The MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release @a mime_type using free().
+ * @param[in] file_extension The file extension without the leading dot ('.')
+ * @param[out] mime_type The MIME type for the given file extension \n
+ *                       The MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats
+ * @return @c 0 on success,
+ *         otherwise a negative error value.
  * @retval #MIME_TYPE_ERROR_NONE Successful
  * @retval #MIME_TYPE_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #MIME_TYPE_ERROR_OUT_OF_MEMORY Out of memory
@@ -60,13 +69,17 @@ int mime_type_get_mime_type(const char *file_extension, char **mime_type);
 
 
 /**
- * @brief Gets the file extensions for the given MIME type.
+ * @brief Gets file extensions for the given MIME type.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
- * @remarks The @a file_extension must be released with free() by you.
- * @param [in] mime_type The MIME type
- * @param [out] file_extension The array of file extension without the leading dot ('.')
- * @param [out] length The length of the array of file extension or zero if there is none
- * @return 0 on success, otherwise a negative error value.
+ * @remarks You must release @a file_extension using free().
+ * @param[in] mime_type The MIME type
+ * @param[out] file_extension The array of file extensions without the leading dot ('.')
+ * @param[out] length The length of the array of file extensions
+ *                    otherwise zero if there none are present
+ * @return @c 0 on success,
+ *         otherwise a negative error value.
  * @retval #MIME_TYPE_ERROR_NONE Successful
  * @retval #MIME_TYPE_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #MIME_TYPE_ERROR_OUT_OF_MEMORY Out of memory
index 9d92804..5a51390 100755 (executable)
@@ -1,9 +1,9 @@
 Name:       capi-content-mime-type
 Summary:    A MIME type library in Tizen C API
-Version:    0.0.1
-Release:    1
+Version:    0.0.3
+Release:    3
 Group:      TO_BE/FILLED_IN
-License:    TO BE FILLED IN
+License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
@@ -24,12 +24,16 @@ Requires:  pkgconfig(capi-base-common)
 %description devel
 
 
-
 %prep
 %setup -q
 
 
 %build
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`  
 cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} 
 
@@ -39,6 +43,8 @@ make %{?jobs:-j%jobs}
 %install
 rm -rf %{buildroot}
 %make_install
+mkdir -p %{buildroot}/usr/share/license
+install LICENSE %{buildroot}/usr/share/license/%{name}
 
 %post -p /sbin/ldconfig
 
@@ -47,6 +53,8 @@ rm -rf %{buildroot}
 
 %files
 %{_libdir}/lib*.so.*
+%manifest capi-content-mime-type.manifest
+/usr/share/license/%{name}
 
 %files devel
 %{_includedir}/content/*.h
index d5f22c3..7a0dbdd 100755 (executable)
@@ -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>
@@ -56,11 +56,11 @@ static int mime_type_error(mime_type_error_e error, const char* function, const
 {
        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;
@@ -91,29 +91,24 @@ int mime_type_get_mime_type(const char *file_extension, char **mime_type)
 
        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");
        }
 
-       if (xdg_mime_type != NULL)
-       {
-               char * mime_type_dup = NULL;
+       char * mime_type_dup = NULL;
 
-               mime_type_dup = strdup(xdg_mime_type);
+       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;
-       }
-       else
+       if (mime_type_dup == NULL)
        {
-               *mime_type = NULL;
+               return mime_type_error(MIME_TYPE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
        }
 
+       *mime_type = mime_type_dup;
+
+
        return MIME_TYPE_ERROR_NONE;
 }
 
@@ -147,7 +142,7 @@ int mime_type_get_file_extension(const char *mime_type, char *** file_extension,
        }
 
        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);
@@ -156,7 +151,7 @@ int mime_type_get_file_extension(const char *mime_type, char *** file_extension,
        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)