Rmove a duplicate code 35/188435/1 accepted/tizen_5.0_unified tizen_5.0 accepted/tizen/5.0/unified/20181102.021213 accepted/tizen/unified/20180910.172037 submit/tizen/20180907.083718 submit/tizen_5.0/20181101.000004
authorsinikang <sinikang@samsung.com>
Wed, 5 Sep 2018 05:54:38 +0000 (14:54 +0900)
committersinikang <sinikang@samsung.com>
Wed, 5 Sep 2018 05:54:38 +0000 (14:54 +0900)
Change-Id: Ib299114671029c8fb2616f0bbe35ecf08f63131e

packaging/libtcore.spec
src/util.c

index f3a9443..9fcac00 100644 (file)
@@ -1,6 +1,6 @@
 %define major 0
 %define minor 3
-%define patchlevel 27
+%define patchlevel 28
 
 Name:           libtcore
 Version:        %{major}.%{minor}.%{patchlevel}
index d033126..9b772af 100644 (file)
@@ -1635,55 +1635,10 @@ unsigned char *tcore_util_unpack_gsm7bit_ex(const unsigned char *src, unsigned i
 unsigned char *tcore_util_unpack_gsm7bit(const unsigned char *src, unsigned int src_len)
 {
        unsigned char *dest;
-       int i = 0, j = 0;
-       unsigned int pos = 0;
-       unsigned char shift = 0;
-       int outlen = 0;
-
-       if (!src || src_len == 0)
-               return NULL;
-
-       outlen = (src_len * 8) / 7;
-
-       dest = calloc(1, outlen + 1);
-       if (!dest)
-               return NULL;
-
-       for (i = 0; pos < src_len; i++, pos++) {
-               dest[i] = (src[pos] << shift) & 0x7F;
-
-               if (pos != 0) {
-                       /*
-                        * except the first byte, a character contains some bits
-                        * from the previous byte.
-                        */
-                       dest[i] |= src[pos - 1] >> (8 - shift);
-               }
-
-               shift++;
-
-               if (shift == 7) {
-                       shift = 0;
-
-                       /* a possible extra complete character is available */
-                       i++;
-                       dest[i] = src[pos] >> 1;
-               }
-       }
-
-       /* If a character is '\r'(13), change it to space(32) */
-       for (i = 0, j = 0; i < outlen; i++, j++) {
-               if (dest[i] == '\r')
-                       dest[j] = ' ';
-               else if (dest[i] == 0x1B)  /* If a charater is 0x1B (escape), next charater is changed on gsm 7bit extension table */
-                       dest[j] = _convert_gsm7bit_extension(dest[++i]);
-               else
-                       dest[j] = dest[i];
-       }
-
-       outlen -= (i - j);
+       unsigned int outlen = 0;
 
-       dest[outlen] = '\0';
+       dest = tcore_util_unpack_gsm7bit_ex(src, src_len, &outlen);
+       info("length of unpacked data = %d", outlen);
 
        return dest;
 }