You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2016/08/06 14:29:38 UTC

[2/6] lucy-clownfish git commit: Remove StrHelp_decode_utf8_char

Remove StrHelp_decode_utf8_char


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/20d28202
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/20d28202
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/20d28202

Branch: refs/heads/master
Commit: 20d282023873c5c7ca1ab87ef5bb84b858f934af
Parents: ca3809d
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Aug 2 18:07:56 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Aug 2 18:07:56 2016 +0200

----------------------------------------------------------------------
 runtime/core/Clownfish/Util/StringHelper.c      | 35 --------------------
 runtime/core/Clownfish/Util/StringHelper.cfh    |  5 ---
 .../test/Clownfish/Test/Util/TestStringHelper.c |  5 ---
 3 files changed, 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/20d28202/runtime/core/Clownfish/Util/StringHelper.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Util/StringHelper.c b/runtime/core/Clownfish/Util/StringHelper.c
index 2f33e37..4af9d84 100644
--- a/runtime/core/Clownfish/Util/StringHelper.c
+++ b/runtime/core/Clownfish/Util/StringHelper.c
@@ -250,41 +250,6 @@ StrHelp_encode_utf8_char(int32_t code_point, void *buffer) {
     }
 }
 
-int32_t
-StrHelp_decode_utf8_char(const char *ptr) {
-    const uint8_t *const string = (const uint8_t*)ptr;
-    int32_t retval = *string;
-    int bytes = StrHelp_UTF8_COUNT[retval];
-
-    switch (bytes & 0x7) {
-        case 1:
-            break;
-
-        case 2:
-            retval = ((retval     & 0x1F) << 6)
-                     | (string[1] & 0x3F);
-            break;
-
-        case 3:
-            retval = ((retval      & 0x0F) << 12)
-                     | ((string[1] & 0x3F) << 6)
-                     | (string[2]  & 0x3F);
-            break;
-
-        case 4:
-            retval = ((retval      & 0x07) << 18)
-                     | ((string[1] & 0x3F) << 12)
-                     | ((string[2] & 0x3F) << 6)
-                     | (string[3]  & 0x3F);
-            break;
-
-        default:
-            THROW(ERR, "Invalid UTF-8 header byte: %x32", retval);
-    }
-
-    return retval;
-}
-
 const char*
 StrHelp_back_utf8_char(const char *ptr, const char *start) {
     while (--ptr >= start) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/20d28202/runtime/core/Clownfish/Util/StringHelper.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Util/StringHelper.cfh b/runtime/core/Clownfish/Util/StringHelper.cfh
index 796aa2d..1264bea 100644
--- a/runtime/core/Clownfish/Util/StringHelper.cfh
+++ b/runtime/core/Clownfish/Util/StringHelper.cfh
@@ -68,11 +68,6 @@ inert class Clownfish::Util::StringHelper nickname StrHelp {
     inert uint32_t
     encode_utf8_char(int32_t code_point, void *buffer);
 
-    /** Decode a UTF-8 sequence to a Unicode code point.  Assumes valid UTF-8.
-     */
-    inert int32_t
-    decode_utf8_char(const char *utf8);
-
     /** Return the first non-continuation byte before the supplied pointer.
      * If backtracking progresses beyond the supplied start, return NULL.
      */

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/20d28202/runtime/test/Clownfish/Test/Util/TestStringHelper.c
----------------------------------------------------------------------
diff --git a/runtime/test/Clownfish/Test/Util/TestStringHelper.c b/runtime/test/Clownfish/Test/Util/TestStringHelper.c
index 2a873fd..d009a58 100644
--- a/runtime/test/Clownfish/Test/Util/TestStringHelper.c
+++ b/runtime/test/Clownfish/Test/Util/TestStringHelper.c
@@ -180,11 +180,6 @@ test_utf8_round_trip(TestBatchRunner *runner) {
         if (StrHelp_back_utf8_char(end, start) != start) {
             break;
         }
-
-        // Verify round trip of encode/decode.
-        if (StrHelp_decode_utf8_char(buffer) != code_point) {
-            break;
-        }
     }
     if (code_point == 0x110000) {
         PASS(runner, "Successfully round tripped 0 - 0x10FFFF");