#include <media_content.h>
#include <app_media.h>
+#include <utils_i18n.h>
bool util_check_movie_type(const char *str);
bool util_launch_request(const char *appid, const char *key, const char *value);
void util_time_string(char *str, int size, unsigned int ms, bool full);
void util_up_string(char *str);
+i18n_uchar* util_convert_to_UTF16_string(const char *source_string);
+char* util_convert_to_UTF8_string(i18n_uchar *sourct_string);
int util_get_media_index(Eina_List *list, void *info);
int util_get_media_index_from_id(Eina_List *list, const char *id);
#include <utils_i18n.h>
#include "data/datamgr.h"
+#include "util/util.h"
struct albumdata;
int32_t result = -1;
i18n_uchar *converted_group_name = NULL;
- i18n_uchar *converted_album_name = NULL;
+ i18n_uchar *converted_album_title = NULL;
- converted_group_name = _convert_to_UTF16_string(gi->data);
- converted_album_name = _convert_to_UTF16_string(ai->name);
+ converted_group_name = util_convert_to_UTF16_string(gi->data);
+ converted_album_title = util_convert_to_UTF16_string(ai->name);
- if (converted_group_name && converted_album_name) {
- result = i18n_ustring_case_compare_n(converted_group_name, converted_album_name, 1, I18N_USTRING_U_FOLD_CASE_DEFAULT);
+ if (converted_group_name && converted_album_title) {
+ result = i18n_ustring_case_compare_n(converted_group_name, converted_album_title, 1, I18N_USTRING_U_FOLD_CASE_DEFAULT);
}
if (converted_group_name) {
free(converted_group_name);
}
- if (converted_album_name) {
- free(converted_album_name);
+ if (converted_album_title) {
+ free(converted_album_title);
}
return result;
i18n_uchar *converted_string = NULL;
i18n_uchar sub_string[10] = { 0, };
- converted_string = _convert_to_UTF16_string(ai->name);
+ converted_string = util_convert_to_UTF16_string(ai->name);
if (converted_string == NULL) {
- _ERR("_convert_to_UTF16_string failed");
+ _ERR("util_convert_to_UTF16_string failed");
goto OUT;
}
/* Get a character (not a byte) from left */
i18n_ustring_copy_n(sub_string, converted_string, 1);
- result_str = _convert_to_UTF8_string(sub_string);
+ result_str = util_convert_to_UTF8_string(sub_string);
OUT:
int32_t result = -1;
i18n_uchar *converted_group_name = NULL;
- i18n_uchar *converted_artist_name = NULL;
+ i18n_uchar *converted_artist = NULL;
- converted_group_name = _convert_to_UTF16_string(gi->data);
- converted_artist_name = _convert_to_UTF16_string(ai->artist);
+ converted_group_name = util_convert_to_UTF16_string(gi->data);
+ converted_artist = util_convert_to_UTF16_string(ai->artist);
- if (converted_group_name && converted_artist_name) {
- result = i18n_ustring_case_compare_n(converted_group_name, converted_artist_name, 1, I18N_USTRING_U_FOLD_CASE_DEFAULT);
+ if (converted_group_name && converted_artist) {
+ result = i18n_ustring_case_compare_n(converted_group_name, converted_artist, 1, I18N_USTRING_U_FOLD_CASE_DEFAULT);
}
if (converted_group_name) {
free(converted_group_name);
}
- if (converted_artist_name) {
- free(converted_artist_name);
+ if (converted_artist) {
+ free(converted_artist);
}
return result;
i18n_uchar *converted_string = NULL;
i18n_uchar sub_string[10] = { 0, };
- converted_string = _convert_to_UTF16_string(ai->artist);
+ converted_string = util_convert_to_UTF16_string(ai->artist);
if (converted_string == NULL) {
- _ERR("_convert_to_UTF16_string failed");
+ _ERR("util_convert_to_UTF16_string failed");
goto OUT;
}
/* Get a character (not a byte) from left */
i18n_ustring_copy_n(sub_string, converted_string, 1);
- result_str = _convert_to_UTF8_string(sub_string);
+ result_str = util_convert_to_UTF8_string(sub_string);
OUT:
#include <media_content.h>
#include <app_debug.h>
#include <app_media.h>
-#include <utils_i18n.h>
#include "data/datamgr.h"
+#include "util/util.h"
#define STR_IMAGE_NAME "Photo"
#define STR_VIDEO_NAME "Video"
return strdup(buf);
}
-static i18n_uchar* _convert_to_UTF16_string(const char *source_string)
-{
- int buffer_length = 0;
- i18n_error_code_e error_from_i18n;
- i18n_uchar *converted_string = NULL;
-
- /* Calc buffer size for converted UTF16 string */
- i18n_ustring_from_UTF8(NULL, 0, &buffer_length, source_string, -1, &error_from_i18n);
-
- converted_string = malloc((buffer_length + 2) * sizeof(i18n_uchar));
- if (converted_string == NULL) {
- _ERR("malloc failed");
- goto OUT;
- }
-
- /* Convert to i18n(UTF16) string */
- i18n_ustring_from_UTF8(converted_string, buffer_length + 1, &buffer_length, source_string, -1, &error_from_i18n);
- if (error_from_i18n != I18N_ERROR_NONE) {
- _ERR("i18n_ustring_from_UTF8 returns [%d]", error_from_i18n);
- free(converted_string);
- goto OUT;
- }
- converted_string[buffer_length] = (i18n_uchar)0;
-
-OUT:
-
- return converted_string;
-}
-
-static char* _convert_to_UTF8_string(i18n_uchar *sourct_string)
-{
- int buffer_length = 0;
- i18n_error_code_e error_from_i18n;
- char *converted_string = NULL;
-
- i18n_ustring_to_UTF8(NULL, 0, &buffer_length, sourct_string, -1, &error_from_i18n);
-
- converted_string = malloc((buffer_length + 2) * sizeof(char));
- if (converted_string == NULL) {
- _ERR("malloc failed");
- goto OUT;
- }
-
- /* Convert to UTF8 */
- i18n_ustring_to_UTF8(converted_string, buffer_length + 1, &buffer_length, sourct_string, -1, &error_from_i18n);
- if (error_from_i18n != I18N_ERROR_NONE) {
- _ERR("i18n_ustring_to_UTF8 returns [%d]", error_from_i18n);
- free(converted_string);
- converted_string = NULL;
- goto OUT;
- }
- converted_string[buffer_length] = '\0';
-
-OUT:
-
- return converted_string;
-}
-
static int _compare_title(struct group_info *gi, app_media_info *info)
{
if (!gi->data || !info->title)
i18n_uchar *converted_group_name = NULL;
i18n_uchar *converted_media_title = NULL;
- converted_group_name = _convert_to_UTF16_string(gi->data);
- converted_media_title = _convert_to_UTF16_string(info->title);
+ converted_group_name = util_convert_to_UTF16_string(gi->data);
+ converted_media_title = util_convert_to_UTF16_string(info->title);
if (converted_group_name && converted_media_title) {
result = i18n_ustring_case_compare_n(converted_group_name, converted_media_title, 1, I18N_USTRING_U_FOLD_CASE_DEFAULT);
char *result_str = NULL;
i18n_uchar *converted_string = NULL;
- converted_string = _convert_to_UTF16_string(info->title);
+ converted_string = util_convert_to_UTF16_string(info->title);
if (converted_string == NULL) {
_ERR("_convert_to_UTF16_string failed");
goto OUT;
}
- result_str = _convert_to_UTF8_string(converted_string);
+ result_str = util_convert_to_UTF8_string(converted_string);
OUT:
if (converted_string)
i18n_uchar *converted_string = NULL;
i18n_uchar sub_string[10] = { 0, };
- converted_string = _convert_to_UTF16_string(info->title);
+ converted_string = util_convert_to_UTF16_string(info->title);
if (converted_string == NULL) {
- _ERR("_convert_to_UTF16_string failed");
+ _ERR("util_convert_to_UTF16_string failed");
goto OUT;
}
/* Get a character (not a byte) from left */
i18n_ustring_copy_n(sub_string, converted_string, 1);
- result_str = _convert_to_UTF8_string(sub_string);
+ result_str = util_convert_to_UTF8_string(sub_string);
OUT:
return o;
}
+
+i18n_uchar* util_convert_to_UTF16_string(const char *source_string)
+{
+ int buffer_length = 0;
+ i18n_error_code_e error_from_i18n;
+ i18n_uchar *converted_string = NULL;
+
+ /* Calc buffer size for converted UTF16 string */
+ i18n_ustring_from_UTF8(NULL, 0, &buffer_length, source_string, -1, &error_from_i18n);
+
+ converted_string = malloc((buffer_length + 2) * sizeof(i18n_uchar));
+ if (converted_string == NULL) {
+ _ERR("malloc failed");
+ goto OUT;
+ }
+
+ /* Convert to i18n(UTF16) string */
+ i18n_ustring_from_UTF8(converted_string, buffer_length + 1, &buffer_length, source_string, -1, &error_from_i18n);
+ if (error_from_i18n != I18N_ERROR_NONE) {
+ _ERR("i18n_ustring_from_UTF8 returns [%d]", error_from_i18n);
+ free(converted_string);
+ goto OUT;
+ }
+ converted_string[buffer_length] = (i18n_uchar)0;
+
+OUT:
+
+ return converted_string;
+}
+
+char* util_convert_to_UTF8_string(i18n_uchar *sourct_string)
+{
+ int buffer_length = 0;
+ i18n_error_code_e error_from_i18n;
+ char *converted_string = NULL;
+
+ i18n_ustring_to_UTF8(NULL, 0, &buffer_length, sourct_string, -1, &error_from_i18n);
+
+ converted_string = malloc((buffer_length + 2) * sizeof(char));
+ if (converted_string == NULL) {
+ _ERR("malloc failed");
+ goto OUT;
+ }
+
+ /* Convert to UTF8 */
+ i18n_ustring_to_UTF8(converted_string, buffer_length + 1, &buffer_length, sourct_string, -1, &error_from_i18n);
+ if (error_from_i18n != I18N_ERROR_NONE) {
+ _ERR("i18n_ustring_to_UTF8 returns [%d]", error_from_i18n);
+ free(converted_string);
+ converted_string = NULL;
+ goto OUT;
+ }
+ converted_string[buffer_length] = '\0';
+
+OUT:
+
+ return converted_string;
+}