--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+/usr/include/*
+/usr/include/*/*
+/usr/lib/pkgconfig/*.pc
+
--- /dev/null
+/usr/lib/lib*.so*
--- /dev/null
+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
+
+
--- /dev/null
+
+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)
+
--- /dev/null
+#!/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
+
--- /dev/null
+/*
+ * 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__ */
+
#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
{
/**
* @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
/**
- * @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
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)
%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}
%install
rm -rf %{buildroot}
%make_install
+mkdir -p %{buildroot}/usr/share/license
+install LICENSE %{buildroot}/usr/share/license/%{name}
%post -p /sbin/ldconfig
%files
%{_libdir}/lib*.so.*
+%manifest capi-content-mime-type.manifest
+/usr/share/license/%{name}
%files devel
%{_includedir}/content/*.h
* 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>
{
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;
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;
}
}
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++)
{
char *entry = NULL;
-
+
entry = strrchr(xdg_file_extension[xdg_file_extension_length], FILE_EXTENSION_DELIMITER);
if (entry != NULL)