[Base-utils][Measure format] Replace icu api with base-utils api 38/137038/1
authorHyunjee Kim <hj0426.kim@samsung.com>
Tue, 4 Jul 2017 07:50:17 +0000 (16:50 +0900)
committerHyunjee Kim <hj0426.kim@samsung.com>
Tue, 4 Jul 2017 07:52:10 +0000 (16:52 +0900)
Change-Id: I63fdac66d6eabf7864ad4133ec5bf0af022db7ba
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
src/utils_i18n_measure_format.cpp

index f8c71d4..e67a662 100644 (file)
  */
 
 #include <utils_i18n_measure_format.h>
+#include <utils_i18n_ustring.h>
 #include <utils_i18n_private.h>
 
 #include <malloc.h>
 #include <vector>
 #include <unicode/measfmt.h>
 #include <unicode/measure.h>
-#include <unicode/ustring.h>
 
 int i18n_measure_format_create(const char *language,
                                                           const char *country,
@@ -77,10 +77,10 @@ int i18n_measure_format_format(i18n_measure_format_h measure_format,
                                                                                                   unicode_append_to,
                                                                                                   *((FieldPosition *) field_position),
                                                                                                   status);
-       const UChar *uchar_result = result.getTerminatedBuffer();
+       const i18n_uchar *uchar_result = (i18n_uchar *)result.getTerminatedBuffer();
 
        retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
-       int32_t ulen = u_strlen(uchar_result);
+       int32_t ulen = i18n_ustring_get_length(uchar_result);
 
        retv_if(ulen <= 0, I18N_ERROR_INVALID_PARAMETER);
        free(*append_to);
@@ -88,7 +88,7 @@ int i18n_measure_format_format(i18n_measure_format_h measure_format,
 
        retv_if(*append_to == NULL, I18N_ERROR_OUT_OF_MEMORY);
 
-       u_austrcpy(*append_to, uchar_result);
+       i18n_ustring_copy_au(*append_to, uchar_result);
 
        return _i18n_error_mapping(status);
 }
@@ -166,13 +166,13 @@ int i18n_measure_format_format_buff(const i18n_measure_format_h measure_format,
                                                                                                   unicode_append_to,
                                                                                                   *((FieldPosition *) field_position),
                                                                                                   status);
-       const UChar *uchar_result = result.getTerminatedBuffer();
+       const i18n_uchar *uchar_result = (i18n_uchar *)result.getTerminatedBuffer();
        retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
-       *output_length = u_strlen(uchar_result);
+       *output_length = i18n_ustring_get_length(uchar_result);
        retv_if(append_to_size < *output_length, I18N_ERROR_BUFFER_OVERFLOW);
 
        if (*output_length > 0)
-               u_strncpy(append_to, uchar_result, append_to_size);
+               i18n_ustring_copy_n(append_to, uchar_result, append_to_size);
 
        return _i18n_error_mapping(status);
 }
@@ -214,14 +214,14 @@ int i18n_measure_format_format_measures(const i18n_measure_format_h measure_form
                                                                                                                   *((FieldPosition *) field_position),
                                                                                                                   status);
 
-       const UChar *uchar_result = result.getTerminatedBuffer();
+       const i18n_uchar *uchar_result = (i18n_uchar *)result.getTerminatedBuffer();
 
        retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
-       *output_length = u_strlen(uchar_result);
+       *output_length = i18n_ustring_get_length(uchar_result);
        retv_if(append_to_size < *output_length, I18N_ERROR_BUFFER_OVERFLOW);
 
        if (*output_length > 0)
-               u_strncpy(append_to, uchar_result, append_to_size);
+               i18n_ustring_copy_n(append_to, uchar_result, append_to_size);
 
        return _i18n_error_mapping(status);
 }
@@ -254,13 +254,13 @@ int i18n_measure_format_format_measure_per_unit(const i18n_measure_format_h meas
                                                                                                                                 *((FieldPosition *) field_position),
                                                                                                                                 status);
 
-       const UChar *uchar_result = result.getTerminatedBuffer();
+       const i18n_uchar *uchar_result = (i18n_uchar *)result.getTerminatedBuffer();
        retv_if(uchar_result == NULL, I18N_ERROR_INVALID_PARAMETER);
-       *output_length = u_strlen(uchar_result);
+       *output_length = i18n_ustring_get_length(uchar_result);
        retv_if(append_to_size < *output_length, I18N_ERROR_BUFFER_OVERFLOW);
 
        if (*output_length > 0)
-               u_strncpy(append_to, uchar_result, append_to_size);
+               i18n_ustring_copy_n(append_to, uchar_result, append_to_size);
 
        return _i18n_error_mapping(status);
 }