lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [33/50] [abbrv] git commit: refs/heads/master - Use int32_t for remaining Unicode code points
Date Fri, 11 Oct 2013 13:32:11 GMT
Use int32_t for remaining Unicode code points


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

Branch: refs/heads/master
Commit: a49e0d427add06505863a25cc1848fde678af47b
Parents: 9355ca3
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Mon Sep 23 15:13:43 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Fri Oct 11 15:28:18 2013 +0200

----------------------------------------------------------------------
 clownfish/runtime/core/Clownfish/CharBuf.c                   | 2 +-
 clownfish/runtime/core/Clownfish/CharBuf.cfh                 | 2 +-
 clownfish/runtime/core/Clownfish/String.c                    | 6 +++---
 clownfish/runtime/core/Clownfish/String.cfh                  | 6 +++---
 clownfish/runtime/core/Clownfish/Test/TestString.c           | 8 ++++----
 .../runtime/core/Clownfish/Test/Util/TestStringHelper.c      | 2 +-
 clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c     | 4 ++--
 clownfish/runtime/core/Clownfish/Util/StringHelper.c         | 8 ++++----
 clownfish/runtime/core/Clownfish/Util/StringHelper.cfh       | 6 +++---
 core/Lucy/Highlight/Highlighter.c                            | 2 +-
 core/Lucy/Store/FSFolder.c                                   | 2 +-
 core/Lucy/Test/Search/TestSortSpec.c                         | 2 +-
 core/Lucy/Util/Json.c                                        | 2 +-
 13 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index bfbae45..ea056b8 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -312,7 +312,7 @@ CB_Yield_String_IMP(CharBuf *self) {
 }
 
 void
-CB_Cat_Char_IMP(CharBuf *self, uint32_t code_point) {
+CB_Cat_Char_IMP(CharBuf *self, int32_t code_point) {
     const size_t MAX_UTF8_BYTES = 4;
     if (self->size + MAX_UTF8_BYTES >= self->cap) {
         S_grow(self, Memory_oversize(self->size + MAX_UTF8_BYTES,

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/CharBuf.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.cfh b/clownfish/runtime/core/Clownfish/CharBuf.cfh
index 64d38da..34c23c3 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.cfh
+++ b/clownfish/runtime/core/Clownfish/CharBuf.cfh
@@ -106,7 +106,7 @@ class Clownfish::CharBuf cnick CB
     /** Concatenate one Unicode character onto the end of the CharBuf.
      */
     void
-    Cat_Char(CharBuf *self, uint32_t code_point);
+    Cat_Char(CharBuf *self, int32_t code_point);
 
     /** Assign more memory to the CharBuf, if it doesn't already have enough
      * room to hold a string of <code>size</code> bytes.  Cannot shrink the

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 28f27e6..b2c2c97 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -130,7 +130,7 @@ Str_init_wrap_trusted_utf8(String *self, const char *ptr, size_t size)
{
 }
 
 String*
-Str_new_from_char(uint32_t code_point) {
+Str_new_from_char(int32_t code_point) {
     const size_t MAX_UTF8_BYTES = 4;
     char   *ptr  = (char*)MALLOCATE(MAX_UTF8_BYTES + 1);
     size_t  size = StrHelp_encode_utf8_char(code_point, (uint8_t*)ptr);
@@ -451,7 +451,7 @@ Str_Length_IMP(String *self) {
     return SStrIter_Advance(iter, SIZE_MAX);
 }
 
-uint32_t
+int32_t
 Str_Code_Point_At_IMP(String *self, size_t tick) {
     StackStringIterator *iter = STR_STACKTOP(self);
     SStrIter_Advance(iter, tick);
@@ -459,7 +459,7 @@ Str_Code_Point_At_IMP(String *self, size_t tick) {
     return code_point == STRITER_DONE ? 0 : code_point;
 }
 
-uint32_t
+int32_t
 Str_Code_Point_From_IMP(String *self, size_t tick) {
     if (tick == 0) { return 0; }
     StackStringIterator *iter = STR_STACKTAIL(self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index 1151589..c4ea6d5 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -86,7 +86,7 @@ class Clownfish::String cnick Str
     /** Return a String which holds a single character.
      */
     inert incremented String*
-    new_from_char(uint32_t code_point);
+    new_from_char(int32_t code_point);
 
     /** Return a pointer to a new String which contains formatted data
      * expanded according to CB_VCatF.
@@ -241,14 +241,14 @@ class Clownfish::String cnick Str
      * better to throw an exception, but that's not practical with UTF-8 and
      * no cached length.)
      */
-    uint32_t
+    int32_t
     Code_Point_At(String *self, size_t tick);
 
     /** Return the Unicode code point at the specified number of code points
      * counted backwards from the end of the string.  Return 0 if outside the
      * string.
      */
-    uint32_t
+    int32_t
     Code_Point_From(String *self, size_t tick);
 
     /** Return a newly allocated String containing a copy of the indicated

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/Test/TestString.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestString.c b/clownfish/runtime/core/Clownfish/Test/TestString.c
index 652c8e9..a59ff4c 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestString.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestString.c
@@ -52,7 +52,7 @@ S_get_str(const char *string) {
 // Surround a smiley with lots of whitespace.
 static String*
 S_smiley_with_whitespace(int *num_spaces_ptr) {
-    uint32_t spaces[] = {
+    int32_t spaces[] = {
         ' ',    '\t',   '\r',   '\n',   0x000B, 0x000C, 0x000D, 0x0085,
         0x00A0, 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004,
         0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029,
@@ -141,10 +141,10 @@ test_Find(TestBatchRunner *runner) {
 
 static void
 test_Code_Point_At_and_From(TestBatchRunner *runner) {
-    uint32_t code_points[] = {
+    int32_t code_points[] = {
         'a', smiley_cp, smiley_cp, 'b', smiley_cp, 'c'
     };
-    uint32_t num_code_points = sizeof(code_points) / sizeof(uint32_t);
+    uint32_t num_code_points = sizeof(code_points) / sizeof(int32_t);
     String *string = Str_newf("a%s%sb%sc", smiley, smiley, smiley);
     uint32_t i;
 
@@ -316,7 +316,7 @@ test_Swap_Chars(TestBatchRunner *runner) {
 
 static void
 test_iterator(TestBatchRunner *runner) {
-    static const uint32_t code_points[] = {
+    static const int32_t code_points[] = {
         0x41,
         0x7F,
         0x80,

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c b/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
index 2ecb528..339de02 100644
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
+++ b/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
@@ -156,7 +156,7 @@ test_to_base36(TestBatchRunner *runner) {
 
 static void
 test_utf8_round_trip(TestBatchRunner *runner) {
-    uint32_t code_point;
+    int32_t code_point;
     for (code_point = 0; code_point <= 0x10FFFF; code_point++) {
         char buffer[4];
         uint32_t size = StrHelp_encode_utf8_char(code_point, buffer);

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
index 31195ed..a987d5c 100644
--- a/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
+++ b/clownfish/runtime/core/Clownfish/TestHarness/TestUtils.c
@@ -70,9 +70,9 @@ TestUtils_random_f64s(double *buf, size_t count) {
     return f64s;
 }
 
-static uint32_t
+static int32_t
 S_random_code_point(void) {
-    uint32_t code_point = 0;
+    int32_t code_point = 0;
     while (1) {
         uint8_t chance = (rand() % 9) + 1;
         switch (chance) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/Util/StringHelper.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/StringHelper.c b/clownfish/runtime/core/Clownfish/Util/StringHelper.c
index 98e7f11..ba117c5 100644
--- a/clownfish/runtime/core/Clownfish/Util/StringHelper.c
+++ b/clownfish/runtime/core/Clownfish/Util/StringHelper.c
@@ -130,7 +130,7 @@ StrHelp_utf8_valid(const char *ptr, size_t size) {
 }
 
 bool
-StrHelp_is_whitespace(uint32_t code_point) {
+StrHelp_is_whitespace(int32_t code_point) {
     switch (code_point) {
             // <control-0009>..<control-000D>
         case 0x0009: case 0x000A: case 0x000B: case 0x000C: case 0x000D:
@@ -156,7 +156,7 @@ StrHelp_is_whitespace(uint32_t code_point) {
 }
 
 uint32_t
-StrHelp_encode_utf8_char(uint32_t code_point, void *buffer) {
+StrHelp_encode_utf8_char(int32_t code_point, void *buffer) {
     uint8_t *buf = (uint8_t*)buffer;
     if (code_point <= 0x7F) { // ASCII
         buf[0] = (uint8_t)code_point;
@@ -186,10 +186,10 @@ StrHelp_encode_utf8_char(uint32_t code_point, void *buffer) {
     }
 }
 
-uint32_t
+int32_t
 StrHelp_decode_utf8_char(const char *ptr) {
     const uint8_t *const string = (const uint8_t*)ptr;
-    uint32_t retval = *string;
+    int32_t retval = *string;
     int bytes = StrHelp_UTF8_COUNT[retval];
 
     switch (bytes & 0x7) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh b/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
index 905613d..1cbb46a 100644
--- a/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
+++ b/clownfish/runtime/core/Clownfish/Util/StringHelper.cfh
@@ -47,7 +47,7 @@ inert class Clownfish::Util::StringHelper cnick StrHelp {
     /** Returns true if the code point qualifies as Unicode whitespace.
      */
     inert bool
-    is_whitespace(uint32_t code_point);
+    is_whitespace(int32_t code_point);
 
     /** Encode a Unicode code point to a UTF-8 sequence.
      *
@@ -56,11 +56,11 @@ inert class Clownfish::Util::StringHelper cnick StrHelp {
      * maximum legal length for a UTF-8 char).
      */
     inert uint32_t
-    encode_utf8_char(uint32_t code_point, void *buffer);
+    encode_utf8_char(int32_t code_point, void *buffer);
 
     /** Decode a UTF-8 sequence to a Unicode code point.  Assumes valid UTF-8.
      */
-    inert uint32_t
+    inert int32_t
     decode_utf8_char(const char *utf8);
 
     /** Return the first non-continuation byte before the supplied pointer.

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index b181115..c384b46 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -28,7 +28,7 @@
 #include "Lucy/Search/Span.h"
 #include "Lucy/Index/DocVector.h"
 
-const uint32_t ELLIPSIS_CODE_POINT = 0x2026;
+const int32_t ELLIPSIS_CODE_POINT = 0x2026;
 
 /* If Highlighter_Encode has been overridden, return its output.  If not,
  * increment the refcount of the supplied encode_buf and call encode_entities.

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index cb4d09e..1550d73 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -350,7 +350,7 @@ S_is_local_entry(const String *path) {
 
 static bool
 S_is_absolute(const String *path) {
-    uint32_t code_point = Str_Code_Point_At(path, 0);
+    int32_t code_point = Str_Code_Point_At(path, 0);
 
     if (isalpha(code_point)) {
         code_point = Str_Code_Point_At(path, 1);

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c
index 6401f27..81effa3 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -272,7 +272,7 @@ S_random_string() {
     size_t length = 1 + rand() % 10;
     CharBuf *buf = CB_new(length);
     while (length--) {
-        uint32_t code_point = 'a' + rand() % ('z' - 'a' + 1);
+        int32_t code_point = 'a' + rand() % ('z' - 'a' + 1);
         CB_Cat_Char(buf, code_point);
     }
     String *string = CB_Yield_String(buf);

http://git-wip-us.apache.org/repos/asf/lucy/blob/a49e0d42/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index 9b751ad..cdb01fb 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -634,7 +634,7 @@ S_unescape_text(const char *top, const char *end) {
                                       text - 5, end);
                             return NULL;
                         }
-                        target_size += StrHelp_encode_utf8_char((uint32_t)code_point,
+                        target_size += StrHelp_encode_utf8_char((int32_t)code_point,
                                                                 target_buf + target_size);
                     }
                     break;


Mime
View raw message