lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [08/24] Rename CharBuf to String (cnick Str)
Date Sun, 01 Sep 2013 20:16:56 GMT
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/PolySearcher.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolySearcher.cfh b/core/Lucy/Search/PolySearcher.cfh
index 73d8dfd..18bc489 100644
--- a/core/Lucy/Search/PolySearcher.cfh
+++ b/core/Lucy/Search/PolySearcher.cfh
@@ -46,7 +46,7 @@ public class Lucy::Search::PolySearcher
     Doc_Max(PolySearcher *self);
 
     public uint32_t
-    Doc_Freq(PolySearcher *self, const CharBuf *field, Obj *term);
+    Doc_Freq(PolySearcher *self, const String *field, Obj *term);
 
     public void
     Collect(PolySearcher *self, Query *query, Collector *collector);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/Query.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Query.c b/core/Lucy/Search/Query.c
index 3cd2df7..d3215fb 100644
--- a/core/Lucy/Search/Query.c
+++ b/core/Lucy/Search/Query.c
@@ -56,9 +56,9 @@ Query_Dump_IMP(Query *self) {
     QueryIVARS *ivars = Query_IVARS(self);
     Hash *dump = Hash_new(0);
     Hash_Store_Str(dump, "_class", 6,
-                   (Obj*)CB_Clone(Obj_Get_Class_Name((Obj*)self)));
+                   (Obj*)Str_Clone(Obj_Get_Class_Name((Obj*)self)));
     Hash_Store_Str(dump, "boost", 5,
-                   (Obj*)CB_newf("%f64", (double)ivars->boost));
+                   (Obj*)Str_newf("%f64", (double)ivars->boost));
     return (Obj*)dump;
 }
 
@@ -66,8 +66,8 @@ Obj*
 Query_Load_IMP(Query *self, Obj *dump) {
     CHY_UNUSED_VAR(self);
     Hash *source = (Hash*)CERTIFY(dump, HASH);
-    CharBuf *class_name
-        = (CharBuf*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), CHARBUF);
+    String *class_name
+        = (String*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), STRING);
     VTable *vtable = VTable_singleton(class_name, NULL);
     Query *loaded = (Query*)VTable_Make_Obj(vtable);
     Obj *boost = CERTIFY(Hash_Fetch_Str(source, "boost", 5), OBJ);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/QueryParser.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.c b/core/Lucy/Search/QueryParser.c
index f9dfefa..2a753f0 100644
--- a/core/Lucy/Search/QueryParser.c
+++ b/core/Lucy/Search/QueryParser.c
@@ -52,7 +52,7 @@
 
 // Helper function for Tree().
 static Query*
-S_parse_subquery(QueryParser *self, VArray *elems, CharBuf *default_field,
+S_parse_subquery(QueryParser *self, VArray *elems, String *default_field,
                  bool enclosed);
 
 // Drop unmatched right parens and add matching right parens at end to
@@ -67,7 +67,7 @@ S_parse_subqueries(QueryParser *self, VArray *elems);
 
 static void
 S_compose_inner_queries(QueryParser *self, VArray *elems,
-                        CharBuf *default_field);
+                        String *default_field);
 
 // Apply +, -, NOT.
 static void
@@ -95,7 +95,7 @@ static Query*
 S_compose_subquery(QueryParser *self, VArray *elems, bool enclosed);
 
 QueryParser*
-QParser_new(Schema *schema, Analyzer *analyzer, const CharBuf *default_boolop,
+QParser_new(Schema *schema, Analyzer *analyzer, const String *default_boolop,
             VArray *fields) {
     QueryParser *self = (QueryParser*)VTable_Make_Obj(QUERYPARSER);
     return QParser_init(self, schema, analyzer, default_boolop, fields);
@@ -103,7 +103,7 @@ QParser_new(Schema *schema, Analyzer *analyzer, const CharBuf *default_boolop,
 
 QueryParser*
 QParser_init(QueryParser *self, Schema *schema, Analyzer *analyzer,
-             const CharBuf *default_boolop, VArray *fields) {
+             const String *default_boolop, VArray *fields) {
     QueryParserIVARS *const ivars = QParser_IVARS(self);
     // Init.
     ivars->heed_colons = false;
@@ -113,13 +113,13 @@ QParser_init(QueryParser *self, Schema *schema, Analyzer *analyzer,
     ivars->schema         = (Schema*)INCREF(schema);
     ivars->analyzer       = (Analyzer*)INCREF(analyzer);
     ivars->default_boolop = default_boolop
-                           ? CB_Clone(default_boolop)
-                           : CB_new_from_trusted_utf8("OR", 2);
+                           ? Str_Clone(default_boolop)
+                           : Str_new_from_trusted_utf8("OR", 2);
 
     if (fields) {
         ivars->fields = VA_Shallow_Copy(fields);
         for (uint32_t i = 0, max = VA_Get_Size(fields); i < max; i++) {
-            CERTIFY(VA_Fetch(fields, i), CHARBUF);
+            CERTIFY(VA_Fetch(fields, i), STRING);
         }
         VA_Sort(ivars->fields, NULL, NULL);
     }
@@ -128,7 +128,7 @@ QParser_init(QueryParser *self, Schema *schema, Analyzer *analyzer,
         uint32_t num_fields = VA_Get_Size(all_fields);
         ivars->fields = VA_new(num_fields);
         for (uint32_t i = 0; i < num_fields; i++) {
-            CharBuf *field = (CharBuf*)VA_Fetch(all_fields, i);
+            String *field = (String*)VA_Fetch(all_fields, i);
             FieldType *type = Schema_Fetch_Type(schema, field);
             if (type && FType_Indexed(type)) {
                 VA_Push(ivars->fields, INCREF(field));
@@ -139,10 +139,10 @@ QParser_init(QueryParser *self, Schema *schema, Analyzer *analyzer,
     VA_Sort(ivars->fields, NULL, NULL);
 
     // Derive default "occur" from default boolean operator.
-    if (CB_Equals_Str(ivars->default_boolop, "OR", 2)) {
+    if (Str_Equals_Str(ivars->default_boolop, "OR", 2)) {
         ivars->default_occur = SHOULD;
     }
-    else if (CB_Equals_Str(ivars->default_boolop, "AND", 3)) {
+    else if (Str_Equals_Str(ivars->default_boolop, "AND", 3)) {
         ivars->default_occur = MUST;
     }
     else {
@@ -173,7 +173,7 @@ QParser_Get_Schema_IMP(QueryParser *self) {
     return QParser_IVARS(self)->schema;
 }
 
-CharBuf*
+String*
 QParser_Get_Default_BoolOp_IMP(QueryParser *self) {
     return QParser_IVARS(self)->default_boolop;
 }
@@ -197,10 +197,10 @@ QParser_Set_Heed_Colons_IMP(QueryParser *self, bool heed_colons) {
 
 
 Query*
-QParser_Parse_IMP(QueryParser *self, const CharBuf *query_string) {
-    CharBuf *qstring = query_string
-                       ? CB_Clone(query_string)
-                       : CB_new_from_trusted_utf8("", 0);
+QParser_Parse_IMP(QueryParser *self, const String *query_string) {
+    String *qstring = query_string
+                       ? Str_Clone(query_string)
+                       : Str_new_from_trusted_utf8("", 0);
     Query *tree     = QParser_Tree(self, qstring);
     Query *expanded = QParser_Expand(self, tree);
     Query *pruned   = QParser_Prune(self, expanded);
@@ -211,7 +211,7 @@ QParser_Parse_IMP(QueryParser *self, const CharBuf *query_string) {
 }
 
 Query*
-QParser_Tree_IMP(QueryParser *self, const CharBuf *query_string) {
+QParser_Tree_IMP(QueryParser *self, const String *query_string) {
     QueryParserIVARS *const ivars = QParser_IVARS(self);
     VArray *elems = QueryLexer_Tokenize(ivars->lexer, query_string);
     S_balance_parens(self, elems);
@@ -229,7 +229,7 @@ S_parse_subqueries(QueryParser *self, VArray *elems) {
         // paren group.
         size_t left = SIZE_MAX;
         size_t right = SIZE_MAX;
-        CharBuf *field = NULL;
+        String *field = NULL;
         for (size_t i = 0, max = VA_Get_Size(elems); i < max; i++) {
             ParserElem *elem = (ParserElem*)VA_Fetch(elems, i);
             uint32_t type = ParserElem_Get_Type(elem);
@@ -245,7 +245,7 @@ S_parse_subqueries(QueryParser *self, VArray *elems) {
                 ParserElem *next_elem = (ParserElem*)VA_Fetch(elems, i + 1);
                 uint32_t next_type = ParserElem_Get_Type(next_elem);
                 if (next_type == TOKEN_OPEN_PAREN) {
-                    field = (CharBuf*)ParserElem_As(elem, CHARBUF);
+                    field = (String*)ParserElem_As(elem, STRING);
                 }
             }
         }
@@ -287,7 +287,7 @@ S_discard_elems(VArray *elems, uint32_t type) {
 }
 
 static Query*
-S_parse_subquery(QueryParser *self, VArray *elems, CharBuf *default_field,
+S_parse_subquery(QueryParser *self, VArray *elems, String *default_field,
                  bool enclosed) {
     if (VA_Get_Size(elems)) {
         ParserElem *first = (ParserElem*)VA_Fetch(elems, 0);
@@ -355,12 +355,12 @@ S_balance_parens(QueryParser *self, VArray *elems) {
 
 static void
 S_compose_inner_queries(QueryParser *self, VArray *elems,
-                        CharBuf *default_field) {
+                        String *default_field) {
     const int32_t default_occur = QParser_IVARS(self)->default_occur;
 
     // Generate all queries.  Apply any fields.
     for (uint32_t i = VA_Get_Size(elems); i--;) {
-        CharBuf *field = default_field;
+        String *field = default_field;
         ParserElem *elem = (ParserElem*)VA_Fetch(elems, i);
 
         // Apply field.
@@ -369,12 +369,12 @@ S_compose_inner_queries(QueryParser *self, VArray *elems,
             ParserElem* maybe_field_elem
                 = (ParserElem*)VA_Fetch(elems, i - 1);
             if (ParserElem_Get_Type(maybe_field_elem) == TOKEN_FIELD) {
-                field = (CharBuf*)ParserElem_As(maybe_field_elem, CHARBUF);
+                field = (String*)ParserElem_As(maybe_field_elem, STRING);
             }
         }
 
         if (ParserElem_Get_Type(elem) == TOKEN_STRING) {
-            const CharBuf *text = (CharBuf*)ParserElem_As(elem, CHARBUF);
+            const String *text = (String*)ParserElem_As(elem, STRING);
             LeafQuery *query = LeafQuery_new(field, text);
             ParserElem *new_elem
                 = ParserElem_new(TOKEN_QUERY, (Obj*)query);
@@ -822,14 +822,14 @@ QParser_Expand_IMP(QueryParser *self, Query *query) {
     return retval;
 }
 
-static CharBuf*
-S_unescape(QueryParser *self, CharBuf *orig, CharBuf *target) {
+static String*
+S_unescape(QueryParser *self, String *orig, String *target) {
     StackString *source = SSTR_WRAP(orig);
     uint32_t code_point;
     UNUSED_VAR(self);
 
-    CB_Set_Size(target, 0);
-    CB_Grow(target, CB_Get_Size(orig) + 4);
+    Str_Set_Size(target, 0);
+    Str_Grow(target, Str_Get_Size(orig) + 4);
 
     while (0 != (code_point = SStr_Nibble(source))) {
         if (code_point == '\\') {
@@ -838,15 +838,15 @@ S_unescape(QueryParser *self, CharBuf *orig, CharBuf *target) {
                 || next_code_point == '"'
                 || next_code_point == '\\'
                ) {
-                CB_Cat_Char(target, next_code_point);
+                Str_Cat_Char(target, next_code_point);
             }
             else {
-                CB_Cat_Char(target, code_point);
-                if (next_code_point) { CB_Cat_Char(target, next_code_point); }
+                Str_Cat_Char(target, code_point);
+                if (next_code_point) { Str_Cat_Char(target, next_code_point); }
             }
         }
         else {
-            CB_Cat_Char(target, code_point);
+            Str_Cat_Char(target, code_point);
         }
     }
 
@@ -864,7 +864,7 @@ QParser_Expand_Leaf_IMP(QueryParser *self, Query *query) {
 
     // Determine whether we can actually process the input.
     if (!Query_Is_A(query, LEAFQUERY))                { return NULL; }
-    if (!CB_Get_Size(LeafQuery_Get_Text(leaf_query))) { return NULL; }
+    if (!Str_Get_Size(LeafQuery_Get_Text(leaf_query))) { return NULL; }
     SStr_Assign(source_text, LeafQuery_Get_Text(leaf_query));
 
     // If quoted, always generate PhraseQuery.
@@ -889,10 +889,10 @@ QParser_Expand_Leaf_IMP(QueryParser *self, Query *query) {
         fields = (VArray*)INCREF(ivars->fields);
     }
 
-    CharBuf *unescaped = CB_new(SStr_Get_Size(source_text));
+    String *unescaped = Str_new(SStr_Get_Size(source_text));
     VArray  *queries   = VA_new(VA_Get_Size(fields));
     for (uint32_t i = 0, max = VA_Get_Size(fields); i < max; i++) {
-        CharBuf  *field    = (CharBuf*)VA_Fetch(fields, i);
+        String   *field    = (String*)VA_Fetch(fields, i);
         Analyzer *analyzer = ivars->analyzer
                              ? ivars->analyzer
                              : Schema_Fetch_Analyzer(schema, field);
@@ -904,16 +904,16 @@ QParser_Expand_Leaf_IMP(QueryParser *self, Query *query) {
         }
         else {
             // Extract token texts.
-            CharBuf *split_source
-                = S_unescape(self, (CharBuf*)source_text, unescaped);
+            String *split_source
+                = S_unescape(self, (String*)source_text, unescaped);
             VArray *maybe_texts = Analyzer_Split(analyzer, split_source);
             uint32_t num_maybe_texts = VA_Get_Size(maybe_texts);
             VArray *token_texts = VA_new(num_maybe_texts);
 
             // Filter out zero-length token texts.
             for (uint32_t j = 0; j < num_maybe_texts; j++) {
-                CharBuf *token_text = (CharBuf*)VA_Fetch(maybe_texts, j);
-                if (CB_Get_Size(token_text)) {
+                String *token_text = (String*)VA_Fetch(maybe_texts, j);
+                if (Str_Get_Size(token_text)) {
                     VA_Push(token_texts, INCREF(token_text));
                 }
             }
@@ -961,14 +961,14 @@ QParser_Expand_Leaf_IMP(QueryParser *self, Query *query) {
 }
 
 Query*
-QParser_Make_Term_Query_IMP(QueryParser *self, const CharBuf *field,
+QParser_Make_Term_Query_IMP(QueryParser *self, const String *field,
                             Obj *term) {
     UNUSED_VAR(self);
     return (Query*)TermQuery_new(field, term);
 }
 
 Query*
-QParser_Make_Phrase_Query_IMP(QueryParser *self, const CharBuf *field,
+QParser_Make_Phrase_Query_IMP(QueryParser *self, const String *field,
                               VArray *terms) {
     UNUSED_VAR(self);
     return (Query*)PhraseQuery_new(field, terms);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/QueryParser.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser.cfh b/core/Lucy/Search/QueryParser.cfh
index f98caa7..d89c44f 100644
--- a/core/Lucy/Search/QueryParser.cfh
+++ b/core/Lucy/Search/QueryParser.cfh
@@ -45,7 +45,7 @@ public class Lucy::Search::QueryParser cnick QParser
 
     Schema     *schema;
     Analyzer   *analyzer;
-    CharBuf    *default_boolop;
+    String     *default_boolop;
     VArray     *fields;
     QueryLexer *lexer;
     bool        heed_colons;
@@ -53,7 +53,7 @@ public class Lucy::Search::QueryParser cnick QParser
 
     inert incremented QueryParser*
     new(Schema *schema, Analyzer *analyzer = NULL,
-        const CharBuf *default_boolop = NULL, VArray *fields = NULL);
+        const String *default_boolop = NULL, VArray *fields = NULL);
 
     /** Constructor.
      *
@@ -73,7 +73,7 @@ public class Lucy::Search::QueryParser cnick QParser
      */
     public inert QueryParser*
     init(QueryParser *self, Schema *schema, Analyzer *analyzer = NULL,
-        const CharBuf *default_boolop = NULL, VArray *fields = NULL);
+        const String *default_boolop = NULL, VArray *fields = NULL);
 
     /** Build a Query object from the contents of a query string.  At present,
      * implemented internally by calling Tree(), Expand(), and Prune().
@@ -82,7 +82,7 @@ public class Lucy::Search::QueryParser cnick QParser
      * @return a Query.
      */
     public incremented Query*
-    Parse(QueryParser *self, const CharBuf *query_string = NULL);
+    Parse(QueryParser *self, const String *query_string = NULL);
 
     /** Parse the logical structure of a query string, building a tree
      * comprised of Query objects.  Leaf nodes in the tree will most often be
@@ -97,7 +97,7 @@ public class Lucy::Search::QueryParser cnick QParser
      * @return a Query.
      */
     public incremented Query*
-    Tree(QueryParser *self, const CharBuf *query_string);
+    Tree(QueryParser *self, const String *query_string);
 
     /** Walk the hierarchy of a Query tree, descending through all PolyQuery
      * nodes and calling Expand_Leaf() on any LeafQuery nodes encountered.
@@ -157,7 +157,7 @@ public class Lucy::Search::QueryParser cnick QParser
      * @return A Query.
      */
     public incremented Query*
-    Make_Term_Query(QueryParser *self, const CharBuf *field, Obj *term);
+    Make_Term_Query(QueryParser *self, const String *field, Obj *term);
 
     /** Factory method creating a PhraseQuery.
      *
@@ -166,7 +166,7 @@ public class Lucy::Search::QueryParser cnick QParser
      * @return A Query.
      */
     public incremented Query*
-    Make_Phrase_Query(QueryParser *self, const CharBuf *field, VArray *terms);
+    Make_Phrase_Query(QueryParser *self, const String *field, VArray *terms);
 
     /** Factory method creating an ORQuery.
      *
@@ -208,7 +208,7 @@ public class Lucy::Search::QueryParser cnick QParser
     Schema*
     Get_Schema(QueryParser *self);
 
-    CharBuf*
+    String*
     Get_Default_BoolOp(QueryParser *self);
 
     VArray*

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/QueryParser/QueryLexer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/QueryLexer.c b/core/Lucy/Search/QueryParser/QueryLexer.c
index 435d43e..4c49c06 100644
--- a/core/Lucy/Search/QueryParser/QueryLexer.c
+++ b/core/Lucy/Search/QueryParser/QueryLexer.c
@@ -71,12 +71,12 @@ QueryLexer_Set_Heed_Colons_IMP(QueryLexer *self, bool heed_colons) {
 }
 
 VArray*
-QueryLexer_Tokenize_IMP(QueryLexer *self, const CharBuf *query_string) {
+QueryLexer_Tokenize_IMP(QueryLexer *self, const String *query_string) {
     QueryLexerIVARS *const ivars = QueryLexer_IVARS(self);
-    CharBuf *copy = query_string
-                    ? CB_Clone(query_string)
-                    : CB_new_from_trusted_utf8("", 0);
-    StackString *qstring = SSTR_WRAP((CharBuf*)copy);
+    String *copy = query_string
+                    ? Str_Clone(query_string)
+                    : Str_new_from_trusted_utf8("", 0);
+    StackString *qstring = SSTR_WRAP((String*)copy);
     VArray *elems = VA_new(0);
     SStr_Trim(qstring);
 
@@ -112,7 +112,7 @@ QueryLexer_Tokenize_IMP(QueryLexer *self, const CharBuf *query_string) {
                     elem = ParserElem_new(TOKEN_PLUS, NULL);
                 }
                 else {
-                    elem = ParserElem_new(TOKEN_STRING, (Obj*)CB_newf("+"));
+                    elem = ParserElem_new(TOKEN_STRING, (Obj*)Str_newf("+"));
                 }
                 SStr_Nip(qstring, 1);
                 break;
@@ -123,7 +123,7 @@ QueryLexer_Tokenize_IMP(QueryLexer *self, const CharBuf *query_string) {
                     elem = ParserElem_new(TOKEN_MINUS, NULL);
                 }
                 else {
-                    elem = ParserElem_new(TOKEN_STRING, (Obj*)CB_newf("-"));
+                    elem = ParserElem_new(TOKEN_STRING, (Obj*)Str_newf("-"));
                 }
                 SStr_Nip(qstring, 1);
                 break;
@@ -224,7 +224,7 @@ S_consume_field(StackString *qstring) {
     }
 
     // Consume string data.
-    StackString *field = SSTR_WRAP((CharBuf*)qstring);
+    StackString *field = SSTR_WRAP((String*)qstring);
     SStr_Truncate(field, tick - 1);
     SStr_Nip(qstring, tick);
     return ParserElem_new(TOKEN_FIELD, (Obj*)SStr_Clone(field));
@@ -232,7 +232,7 @@ S_consume_field(StackString *qstring) {
 
 static ParserElem*
 S_consume_text(StackString *qstring) {
-    StackString *text  = SSTR_WRAP((CharBuf*)qstring);
+    StackString *text  = SSTR_WRAP((String*)qstring);
     size_t tick = 0;
     while (1) {
         uint32_t code_point = SStr_Nibble(qstring);
@@ -260,7 +260,7 @@ S_consume_text(StackString *qstring) {
 
 static ParserElem*
 S_consume_quoted_string(StackString *qstring) {
-    StackString *text = SSTR_WRAP((CharBuf*)qstring);
+    StackString *text = SSTR_WRAP((String*)qstring);
     if (SStr_Nibble(qstring) != '"') {
         THROW(ERR, "Internal error: expected a quote");
     }

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/QueryParser/QueryLexer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/QueryParser/QueryLexer.cfh b/core/Lucy/Search/QueryParser/QueryLexer.cfh
index 5555ed0..5069cd4 100644
--- a/core/Lucy/Search/QueryParser/QueryLexer.cfh
+++ b/core/Lucy/Search/QueryParser/QueryLexer.cfh
@@ -32,7 +32,7 @@ class Lucy::Search::QueryParser::QueryLexer inherits Clownfish::Obj {
      * @return an array of ParserElems.
      */
     incremented VArray*
-    Tokenize(QueryLexer *self, const CharBuf *query_string = NULL);
+    Tokenize(QueryLexer *self, const String *query_string = NULL);
 
     bool
     Heed_Colons(QueryLexer *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/RangeQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.c b/core/Lucy/Search/RangeQuery.c
index 5d792bc..a0fe266 100644
--- a/core/Lucy/Search/RangeQuery.c
+++ b/core/Lucy/Search/RangeQuery.c
@@ -41,7 +41,7 @@ static int32_t
 S_find_upper_bound(RangeCompiler *self, SortCache *sort_cache);
 
 RangeQuery*
-RangeQuery_new(const CharBuf *field, Obj *lower_term, Obj *upper_term,
+RangeQuery_new(const String *field, Obj *lower_term, Obj *upper_term,
                bool include_lower, bool include_upper) {
     RangeQuery *self = (RangeQuery*)VTable_Make_Obj(RANGEQUERY);
     return RangeQuery_init(self, field, lower_term, upper_term,
@@ -49,11 +49,11 @@ RangeQuery_new(const CharBuf *field, Obj *lower_term, Obj *upper_term,
 }
 
 RangeQuery*
-RangeQuery_init(RangeQuery *self, const CharBuf *field, Obj *lower_term,
+RangeQuery_init(RangeQuery *self, const String *field, Obj *lower_term,
                 Obj *upper_term, bool include_lower, bool include_upper) {
     Query_init((Query*)self, 0.0f);
     RangeQueryIVARS *const ivars = RangeQuery_IVARS(self);
-    ivars->field          = CB_Clone(field);
+    ivars->field          = Str_Clone(field);
     ivars->lower_term     = lower_term ? Obj_Clone(lower_term) : NULL;
     ivars->upper_term     = upper_term ? Obj_Clone(upper_term) : NULL;
     ivars->include_lower  = include_lower;
@@ -82,7 +82,7 @@ RangeQuery_Equals_IMP(RangeQuery *self, Obj *other) {
     RangeQueryIVARS *const ivars = RangeQuery_IVARS(self);
     RangeQueryIVARS *const ovars = RangeQuery_IVARS((RangeQuery*)other);
     if (ivars->boost != ovars->boost)                 { return false; }
-    if (!CB_Equals(ivars->field, (Obj*)ovars->field)) { return false; }
+    if (!Str_Equals(ivars->field, (Obj*)ovars->field)) { return false; }
     if (ivars->lower_term && !ovars->lower_term)      { return false; }
     if (ivars->upper_term && !ovars->upper_term)      { return false; }
     if (!ivars->lower_term && ovars->lower_term)      { return false; }
@@ -96,16 +96,16 @@ RangeQuery_Equals_IMP(RangeQuery *self, Obj *other) {
     return true;
 }
 
-CharBuf*
+String*
 RangeQuery_To_String_IMP(RangeQuery *self) {
     RangeQueryIVARS *const ivars = RangeQuery_IVARS(self);
-    CharBuf *lower_term_str = ivars->lower_term
+    String *lower_term_str = ivars->lower_term
                               ? Obj_To_String(ivars->lower_term)
-                              : CB_new_from_trusted_utf8("*", 1);
-    CharBuf *upper_term_str = ivars->upper_term
+                              : Str_new_from_trusted_utf8("*", 1);
+    String *upper_term_str = ivars->upper_term
                               ? Obj_To_String(ivars->upper_term)
-                              : CB_new_from_trusted_utf8("*", 1);
-    CharBuf *retval = CB_newf("%o:%s%o TO %o%s", ivars->field,
+                              : Str_new_from_trusted_utf8("*", 1);
+    String *retval = Str_newf("%o:%s%o TO %o%s", ivars->field,
                               ivars->include_lower ? "[" : "{",
                               lower_term_str,
                               upper_term_str,
@@ -143,7 +143,7 @@ RangeQuery*
 RangeQuery_Deserialize_IMP(RangeQuery *self, InStream *instream) {
     // Deserialize components.
     float boost = InStream_Read_F32(instream);
-    CharBuf *field = Freezer_read_charbuf(instream);
+    String *field = Freezer_read_charbuf(instream);
     Obj *lower_term = InStream_Read_U8(instream) ? THAW(instream) : NULL;
     Obj *upper_term = InStream_Read_U8(instream) ? THAW(instream) : NULL;
     bool include_lower = InStream_Read_U8(instream);
@@ -190,7 +190,7 @@ RangeQuery_Load_IMP(RangeQuery *self, Obj *dump) {
     RangeQuery *loaded = (RangeQuery*)super_load(self, dump);
     RangeQueryIVARS *loaded_ivars = RangeQuery_IVARS(loaded);
     Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
-    loaded_ivars->field = (CharBuf*)CERTIFY(Freezer_load(field), CHARBUF);
+    loaded_ivars->field = (String*)CERTIFY(Freezer_load(field), STRING);
     Obj *lower_term = Hash_Fetch_Str(source, "lower_term", 10);
     if (lower_term) {
         loaded_ivars->lower_term
@@ -240,7 +240,7 @@ Matcher*
 RangeCompiler_Make_Matcher_IMP(RangeCompiler *self, SegReader *reader,
                                bool need_score) {
     RangeQuery *parent = (RangeQuery*)RangeCompiler_IVARS(self)->parent;
-    const CharBuf *field = RangeQuery_IVARS(parent)->field;
+    const String *field = RangeQuery_IVARS(parent)->field;
     SortReader *sort_reader
         = (SortReader*)SegReader_Fetch(reader, VTable_Get_Name(SORTREADER));
     SortCache *sort_cache = sort_reader

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/RangeQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.cfh b/core/Lucy/Search/RangeQuery.cfh
index fcbd2e3..a013905 100644
--- a/core/Lucy/Search/RangeQuery.cfh
+++ b/core/Lucy/Search/RangeQuery.cfh
@@ -24,14 +24,14 @@ parcel Lucy;
 
 public class Lucy::Search::RangeQuery inherits Lucy::Search::Query {
 
-    CharBuf  *field;
+    String   *field;
     Obj      *lower_term;
     Obj      *upper_term;
     bool      include_lower;
     bool      include_upper;
 
     inert incremented RangeQuery*
-    new(const CharBuf *field, Obj *lower_term = NULL, Obj *upper_term = NULL,
+    new(const String *field, Obj *lower_term = NULL, Obj *upper_term = NULL,
         bool include_lower = true, bool include_upper = true);
 
     /** Takes 5 parameters; <code>field</code> is required, as
@@ -49,14 +49,14 @@ public class Lucy::Search::RangeQuery inherits Lucy::Search::Query {
      * <code>upper_term</code> should be included in the results.
      */
     public inert RangeQuery*
-    init(RangeQuery *self, const CharBuf *field,
+    init(RangeQuery *self, const String *field,
          Obj *lower_term = NULL, Obj *upper_term = NULL,
          bool include_lower = true, bool include_upper = true);
 
     public bool
     Equals(RangeQuery *self, Obj *other);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(RangeQuery *self);
 
     public incremented RangeCompiler*

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/RequiredOptionalQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RequiredOptionalQuery.c b/core/Lucy/Search/RequiredOptionalQuery.c
index 5e1659d..f4ad1ef 100644
--- a/core/Lucy/Search/RequiredOptionalQuery.c
+++ b/core/Lucy/Search/RequiredOptionalQuery.c
@@ -68,12 +68,12 @@ ReqOptQuery_Set_Optional_Query_IMP(RequiredOptionalQuery *self,
     VA_Store(ivars->children, 1, INCREF(optional_query));
 }
 
-CharBuf*
+String*
 ReqOptQuery_To_String_IMP(RequiredOptionalQuery *self) {
     RequiredOptionalQueryIVARS *const ivars = ReqOptQuery_IVARS(self);
-    CharBuf *req_string = Obj_To_String(VA_Fetch(ivars->children, 0));
-    CharBuf *opt_string = Obj_To_String(VA_Fetch(ivars->children, 1));
-    CharBuf *retval = CB_newf("(+%o %o)", req_string, opt_string);
+    String *req_string = Obj_To_String(VA_Fetch(ivars->children, 0));
+    String *opt_string = Obj_To_String(VA_Fetch(ivars->children, 1));
+    String *retval = Str_newf("(+%o %o)", req_string, opt_string);
     DECREF(opt_string);
     DECREF(req_string);
     return retval;

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/RequiredOptionalQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RequiredOptionalQuery.cfh b/core/Lucy/Search/RequiredOptionalQuery.cfh
index 92dcab9..d136b68 100644
--- a/core/Lucy/Search/RequiredOptionalQuery.cfh
+++ b/core/Lucy/Search/RequiredOptionalQuery.cfh
@@ -57,7 +57,7 @@ public class Lucy::Search::RequiredOptionalQuery cnick ReqOptQuery
     Make_Compiler(RequiredOptionalQuery *self, Searcher *searcher,
                   float boost, bool subordinate = false);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(RequiredOptionalQuery *self);
 
     public bool

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/Searcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Searcher.c b/core/Lucy/Search/Searcher.c
index b583e2f..7b6cd25 100644
--- a/core/Lucy/Search/Searcher.c
+++ b/core/Lucy/Search/Searcher.c
@@ -74,11 +74,11 @@ Searcher_Glean_Query_IMP(Searcher *self, Obj *query) {
     else if (Obj_Is_A(query, QUERY)) {
         real_query = (Query*)INCREF(query);
     }
-    else if (Obj_Is_A(query, CHARBUF)) {
+    else if (Obj_Is_A(query, STRING)) {
         if (!ivars->qparser) {
             ivars->qparser = QParser_new(ivars->schema, NULL, NULL, NULL);
         }
-        real_query = QParser_Parse(ivars->qparser, (CharBuf*)query);
+        real_query = QParser_Parse(ivars->qparser, (String*)query);
     }
     else {
         THROW(ERR, "Invalid type for 'query' param: %o",

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/Searcher.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Searcher.cfh b/core/Lucy/Search/Searcher.cfh
index 073eb7d..d81ed54 100644
--- a/core/Lucy/Search/Searcher.cfh
+++ b/core/Lucy/Search/Searcher.cfh
@@ -53,7 +53,7 @@ public class Lucy::Search::Searcher inherits Clownfish::Obj {
      * @param term The term to look up.
      */
     public abstract uint32_t
-    Doc_Freq(Searcher *self, const CharBuf *field, Obj *term);
+    Doc_Freq(Searcher *self, const String *field, Obj *term);
 
     /** If the supplied object is a Query, return it; if it's a query string,
      * create a QueryParser and parse it to produce a query against all

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/SortRule.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/SortRule.c b/core/Lucy/Search/SortRule.c
index da20b67..81af469 100644
--- a/core/Lucy/Search/SortRule.c
+++ b/core/Lucy/Search/SortRule.c
@@ -27,16 +27,16 @@ int32_t SortRule_SCORE  = 1;
 int32_t SortRule_DOC_ID = 2;
 
 SortRule*
-SortRule_new(int32_t type, const CharBuf *field, bool reverse) {
+SortRule_new(int32_t type, const String *field, bool reverse) {
     SortRule *self = (SortRule*)VTable_Make_Obj(SORTRULE);
     return SortRule_init(self, type, field, reverse);
 }
 
 SortRule*
-SortRule_init(SortRule *self, int32_t type, const CharBuf *field,
+SortRule_init(SortRule *self, int32_t type, const String *field,
               bool reverse) {
     SortRuleIVARS *ivars = SortRule_IVARS(self);
-    ivars->field    = field ? CB_Clone(field) : NULL;
+    ivars->field    = field ? Str_Clone(field) : NULL;
     ivars->type     = type;
     ivars->reverse  = reverse;
 
@@ -81,7 +81,7 @@ SortRule_Serialize_IMP(SortRule *self, OutStream *target) {
     OutStream_Write_C32(target, !!ivars->reverse);
 }
 
-CharBuf*
+String*
 SortRule_Get_Field_IMP(SortRule *self) {
     return SortRule_IVARS(self)->field;
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/SortRule.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/SortRule.cfh b/core/Lucy/Search/SortRule.cfh
index cae7537..01c119e 100644
--- a/core/Lucy/Search/SortRule.cfh
+++ b/core/Lucy/Search/SortRule.cfh
@@ -26,7 +26,7 @@ parcel Lucy;
 public class Lucy::Search::SortRule inherits Clownfish::Obj {
 
     int32_t   type;
-    CharBuf  *field;
+    String   *field;
     bool      reverse;
 
     inert int32_t FIELD;
@@ -34,7 +34,7 @@ public class Lucy::Search::SortRule inherits Clownfish::Obj {
     inert int32_t DOC_ID;
 
     public inert incremented SortRule*
-    new(int32_t type = 0, const CharBuf *field = NULL,
+    new(int32_t type = 0, const String *field = NULL,
         bool reverse = false);
 
     /**
@@ -44,12 +44,12 @@ public class Lucy::Search::SortRule inherits Clownfish::Obj {
      * @param reverse If true, reverse the order of the sort for this rule.
      */
     public inert incremented SortRule*
-    init(SortRule *self, int32_t type = 0, const CharBuf *field = NULL,
+    init(SortRule *self, int32_t type = 0, const String *field = NULL,
          bool reverse = false);
 
     /** Accessor for "field" member.
      */
-    public nullable CharBuf*
+    public nullable String*
     Get_Field(SortRule *self);
 
     /** Accessor for "type" member.

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/TermQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.c b/core/Lucy/Search/TermQuery.c
index 0454be8..4167a54 100644
--- a/core/Lucy/Search/TermQuery.c
+++ b/core/Lucy/Search/TermQuery.c
@@ -35,16 +35,16 @@
 #include "Lucy/Util/Freezer.h"
 
 TermQuery*
-TermQuery_new(const CharBuf *field, const Obj *term) {
+TermQuery_new(const String *field, const Obj *term) {
     TermQuery *self = (TermQuery*)VTable_Make_Obj(TERMQUERY);
     return TermQuery_init(self, field, term);
 }
 
 TermQuery*
-TermQuery_init(TermQuery *self, const CharBuf *field, const Obj *term) {
+TermQuery_init(TermQuery *self, const String *field, const Obj *term) {
     Query_init((Query*)self, 1.0f);
     TermQueryIVARS *const ivars = TermQuery_IVARS(self);
-    ivars->field  = CB_Clone(field);
+    ivars->field  = Str_Clone(field);
     ivars->term   = Obj_Clone(term);
     return self;
 }
@@ -93,13 +93,13 @@ TermQuery_Load_IMP(TermQuery *self, Obj *dump) {
     TermQuery *loaded = (TermQuery*)super_load(self, dump);
     TermQueryIVARS *loaded_ivars = TermQuery_IVARS(loaded);
     Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
-    loaded_ivars->field = (CharBuf*)CERTIFY(Freezer_load(field), CHARBUF);
+    loaded_ivars->field = (String*)CERTIFY(Freezer_load(field), STRING);
     Obj *term = CERTIFY(Hash_Fetch_Str(source, "term", 4), OBJ);
     loaded_ivars->term = (Obj*)CERTIFY(Freezer_load(term), OBJ);
     return (Obj*)loaded;
 }
 
-CharBuf*
+String*
 TermQuery_Get_Field_IMP(TermQuery *self) {
     return TermQuery_IVARS(self)->field;
 }
@@ -116,16 +116,16 @@ TermQuery_Equals_IMP(TermQuery *self, Obj *other) {
     TermQueryIVARS *const ivars = TermQuery_IVARS(self);
     TermQueryIVARS *const ovars = TermQuery_IVARS((TermQuery*)other);
     if (ivars->boost != ovars->boost)                 { return false; }
-    if (!CB_Equals(ivars->field, (Obj*)ovars->field)) { return false; }
+    if (!Str_Equals(ivars->field, (Obj*)ovars->field)) { return false; }
     if (!Obj_Equals(ivars->term, ovars->term))        { return false; }
     return true;
 }
 
-CharBuf*
+String*
 TermQuery_To_String_IMP(TermQuery *self) {
     TermQueryIVARS *const ivars = TermQuery_IVARS(self);
-    CharBuf *term_str = Obj_To_String(ivars->term);
-    CharBuf *retval = CB_newf("%o:%o", ivars->field, term_str);
+    String *term_str = Obj_To_String(ivars->term);
+    String *retval = Str_newf("%o:%o", ivars->field, term_str);
     DECREF(term_str);
     return retval;
 }
@@ -284,7 +284,7 @@ TermCompiler_Make_Matcher_IMP(TermCompiler *self, SegReader *reader,
 
 VArray*
 TermCompiler_Highlight_Spans_IMP(TermCompiler *self, Searcher *searcher,
-                                 DocVector *doc_vec, const CharBuf *field) {
+                                 DocVector *doc_vec, const String *field) {
 
     TermCompilerIVARS *const ivars = TermCompiler_IVARS(self);
     TermQueryIVARS *const parent_ivars
@@ -294,11 +294,11 @@ TermCompiler_Highlight_Spans_IMP(TermCompiler *self, Searcher *searcher,
     I32Array *starts, *ends;
     UNUSED_VAR(searcher);
 
-    if (!CB_Equals(parent_ivars->field, (Obj*)field)) { return spans; }
+    if (!Str_Equals(parent_ivars->field, (Obj*)field)) { return spans; }
 
     // Add all starts and ends.
     term_vector
-        = DocVec_Term_Vector(doc_vec, field, (CharBuf*)parent_ivars->term);
+        = DocVec_Term_Vector(doc_vec, field, (String*)parent_ivars->term);
     if (!term_vector) { return spans; }
 
     starts = TV_Get_Start_Offsets(term_vector);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Search/TermQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.cfh b/core/Lucy/Search/TermQuery.cfh
index cf6b293..5ec210d 100644
--- a/core/Lucy/Search/TermQuery.cfh
+++ b/core/Lucy/Search/TermQuery.cfh
@@ -25,22 +25,22 @@ parcel Lucy;
 
 public class Lucy::Search::TermQuery inherits Lucy::Search::Query {
 
-    CharBuf *field;
+    String *field;
     Obj     *term;
 
     inert incremented TermQuery*
-    new(const CharBuf *field, const Obj *term);
+    new(const String *field, const Obj *term);
 
     /**
      * @param field Field name.
      * @param term Term text.
      */
     public inert TermQuery*
-    init(TermQuery *self, const CharBuf *field, const Obj *term);
+    init(TermQuery *self, const String *field, const Obj *term);
 
     /** Accessor for object's <code>field</code> member.
      */
-    public CharBuf*
+    public String*
     Get_Field(TermQuery *self);
 
     /** Accessor for object's <code>term</code> member.
@@ -52,7 +52,7 @@ public class Lucy::Search::TermQuery inherits Lucy::Search::Query {
     Make_Compiler(TermQuery *self, Searcher *searcher, float boost,
                   bool subordinate = false);
 
-    public incremented CharBuf*
+    public incremented String*
     To_String(TermQuery *self);
 
     public void
@@ -101,7 +101,7 @@ class Lucy::Search::TermCompiler inherits Lucy::Search::Compiler {
 
     public incremented VArray*
     Highlight_Spans(TermCompiler *self, Searcher *searcher,
-                    DocVector *doc_vec, const CharBuf *field);
+                    DocVector *doc_vec, const String *field);
 
     public bool
     Equals(TermCompiler *self, Obj *other);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/CompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c
index ccf1c02..21a292e 100644
--- a/core/Lucy/Store/CompoundFileReader.c
+++ b/core/Lucy/Store/CompoundFileReader.c
@@ -36,7 +36,7 @@ CFReader_open(Folder *folder) {
 CompoundFileReader*
 CFReader_do_open(CompoundFileReader *self, Folder *folder) {
     CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
-    CharBuf *cfmeta_file = (CharBuf*)SSTR_WRAP_STR("cfmeta.json", 11);
+    String *cfmeta_file = (String*)SSTR_WRAP_STR("cfmeta.json", 11);
     Hash *metadata = (Hash*)Json_slurp_json((Folder*)folder, cfmeta_file);
     Err *error = NULL;
 
@@ -44,7 +44,7 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) {
 
     // Parse metadata file.
     if (!metadata || !Hash_Is_A(metadata, HASH)) {
-        error = Err_new(CB_newf("Can't read '%o' in '%o'", cfmeta_file,
+        error = Err_new(Str_newf("Can't read '%o' in '%o'", cfmeta_file,
                                 Folder_Get_Path(folder)));
     }
     else {
@@ -52,16 +52,16 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) {
         ivars->format = format ? (int32_t)Obj_To_I64(format) : 0;
         ivars->records = (Hash*)INCREF(Hash_Fetch_Str(metadata, "files", 5));
         if (ivars->format < 1) {
-            error = Err_new(CB_newf("Corrupt %o file: Missing or invalid 'format'",
+            error = Err_new(Str_newf("Corrupt %o file: Missing or invalid 'format'",
                                     cfmeta_file));
         }
         else if (ivars->format > CFWriter_current_file_format) {
-            error = Err_new(CB_newf("Unsupported compound file format: %i32 "
+            error = Err_new(Str_newf("Unsupported compound file format: %i32 "
                                     "(current = %i32", ivars->format,
                                     CFWriter_current_file_format));
         }
         else if (!ivars->records) {
-            error = Err_new(CB_newf("Corrupt %o file: missing 'files' key",
+            error = Err_new(Str_newf("Corrupt %o file: missing 'files' key",
                                     cfmeta_file));
         }
     }
@@ -73,7 +73,7 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) {
     }
 
     // Open an instream which we'll clone over and over.
-    CharBuf *cf_file = (CharBuf*)SSTR_WRAP_STR("cf.dat", 6);
+    String *cf_file = (String*)SSTR_WRAP_STR("cf.dat", 6);
     ivars->instream = Folder_Open_In(folder, cf_file);
     if (!ivars->instream) {
         ERR_ADD_FRAME(Err_get_error());
@@ -93,8 +93,8 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) {
         size_t folder_name_len = SStr_Length(folder_name);
 
         for (uint32_t i = 0, max = VA_Get_Size(files); i < max; i++) {
-            CharBuf *orig = (CharBuf*)VA_Fetch(files, i);
-            if (CB_Starts_With(orig, (CharBuf*)folder_name)) {
+            String *orig = (String*)VA_Fetch(files, i);
+            if (Str_Starts_With(orig, (String*)folder_name)) {
                 Obj *record = Hash_Delete(ivars->records, (Obj*)orig);
                 SStr_Assign(filename, orig);
                 SStr_Nip(filename, folder_name_len + sizeof(DIR_SEP) - 1);
@@ -123,7 +123,7 @@ CFReader_Get_Real_Folder_IMP(CompoundFileReader *self) {
 }
 
 void
-CFReader_Set_Path_IMP(CompoundFileReader *self, const CharBuf *path) {
+CFReader_Set_Path_IMP(CompoundFileReader *self, const String *path) {
     CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
     Folder_Set_Path(ivars->real_folder, path);
     CFReader_Set_Path_t super_set_path
@@ -134,13 +134,13 @@ CFReader_Set_Path_IMP(CompoundFileReader *self, const CharBuf *path) {
 
 FileHandle*
 CFReader_Local_Open_FileHandle_IMP(CompoundFileReader *self,
-                                   const CharBuf *name, uint32_t flags) {
+                                   const String *name, uint32_t flags) {
     CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
     Hash *entry = (Hash*)Hash_Fetch(ivars->records, (Obj*)name);
     FileHandle *fh = NULL;
 
     if (entry) {
-        Err_set_error(Err_new(CB_newf("Can't open FileHandle for virtual file %o in '%o'",
+        Err_set_error(Err_new(Str_newf("Can't open FileHandle for virtual file %o in '%o'",
                                       name, ivars->path)));
     }
     else {
@@ -154,7 +154,7 @@ CFReader_Local_Open_FileHandle_IMP(CompoundFileReader *self,
 }
 
 bool
-CFReader_Local_Delete_IMP(CompoundFileReader *self, const CharBuf *name) {
+CFReader_Local_Delete_IMP(CompoundFileReader *self, const String *name) {
     CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
     Hash *record = (Hash*)Hash_Delete(ivars->records, (Obj*)name);
     DECREF(record);
@@ -166,11 +166,11 @@ CFReader_Local_Delete_IMP(CompoundFileReader *self, const CharBuf *name) {
         // Once the number of virtual files falls to 0, remove the compound
         // files.
         if (Hash_Get_Size(ivars->records) == 0) {
-            CharBuf *cf_file = (CharBuf*)SSTR_WRAP_STR("cf.dat", 6);
+            String *cf_file = (String*)SSTR_WRAP_STR("cf.dat", 6);
             if (!Folder_Delete(ivars->real_folder, cf_file)) {
                 return false;
             }
-            CharBuf *cfmeta_file = (CharBuf*)SSTR_WRAP_STR("cfmeta.json", 11);
+            String *cfmeta_file = (String*)SSTR_WRAP_STR("cfmeta.json", 11);
             if (!Folder_Delete(ivars->real_folder, cfmeta_file)) {
                 return false;
 
@@ -181,7 +181,7 @@ CFReader_Local_Delete_IMP(CompoundFileReader *self, const CharBuf *name) {
 }
 
 InStream*
-CFReader_Local_Open_In_IMP(CompoundFileReader *self, const CharBuf *name) {
+CFReader_Local_Open_In_IMP(CompoundFileReader *self, const String *name) {
     CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
     Hash *entry = (Hash*)Hash_Fetch(ivars->records, (Obj*)name);
 
@@ -196,12 +196,12 @@ CFReader_Local_Open_In_IMP(CompoundFileReader *self, const CharBuf *name) {
         Obj *len    = Hash_Fetch_Str(entry, "length", 6);
         Obj *offset = Hash_Fetch_Str(entry, "offset", 6);
         if (!len || !offset) {
-            Err_set_error(Err_new(CB_newf("Malformed entry for '%o' in '%o'",
+            Err_set_error(Err_new(Str_newf("Malformed entry for '%o' in '%o'",
                                           name, Folder_Get_Path(ivars->real_folder))));
             return NULL;
         }
-        else if (CB_Get_Size(ivars->path)) {
-            CharBuf *fullpath = CB_newf("%o/%o", ivars->path, name);
+        else if (Str_Get_Size(ivars->path)) {
+            String *fullpath = Str_newf("%o/%o", ivars->path, name);
             InStream *instream = InStream_Reopen(ivars->instream, fullpath,
                                                  Obj_To_I64(offset), Obj_To_I64(len));
             DECREF(fullpath);
@@ -215,7 +215,7 @@ CFReader_Local_Open_In_IMP(CompoundFileReader *self, const CharBuf *name) {
 }
 
 bool
-CFReader_Local_Exists_IMP(CompoundFileReader *self, const CharBuf *name) {
+CFReader_Local_Exists_IMP(CompoundFileReader *self, const String *name) {
     CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
     if (Hash_Fetch(ivars->records, (Obj*)name))        { return true; }
     if (Folder_Local_Exists(ivars->real_folder, name)) { return true; }
@@ -224,7 +224,7 @@ CFReader_Local_Exists_IMP(CompoundFileReader *self, const CharBuf *name) {
 
 bool
 CFReader_Local_Is_Directory_IMP(CompoundFileReader *self,
-                                const CharBuf *name) {
+                                const String *name) {
     CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
     if (Hash_Fetch(ivars->records, (Obj*)name))              { return false; }
     if (Folder_Local_Is_Directory(ivars->real_folder, name)) { return true; }
@@ -238,10 +238,10 @@ CFReader_Close_IMP(CompoundFileReader *self) {
 }
 
 bool
-CFReader_Local_MkDir_IMP(CompoundFileReader *self, const CharBuf *name) {
+CFReader_Local_MkDir_IMP(CompoundFileReader *self, const String *name) {
     CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
     if (Hash_Fetch(ivars->records, (Obj*)name)) {
-        Err_set_error(Err_new(CB_newf("Can't MkDir: '%o' exists", name)));
+        Err_set_error(Err_new(Str_newf("Can't MkDir: '%o' exists", name)));
         return false;
     }
     else {
@@ -253,7 +253,7 @@ CFReader_Local_MkDir_IMP(CompoundFileReader *self, const CharBuf *name) {
 
 Folder*
 CFReader_Local_Find_Folder_IMP(CompoundFileReader *self,
-                               const CharBuf *name) {
+                               const String *name) {
     CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
     if (Hash_Fetch(ivars->records, (Obj*)name)) { return false; }
     return Folder_Local_Find_Folder(ivars->real_folder, name);
@@ -286,8 +286,8 @@ CFReaderDH_init(CFReaderDirHandle *self, CompoundFileReader *cf_reader) {
     Folder *real_folder = CFReader_Get_Real_Folder(ivars->cf_reader);
     DirHandle *dh = Folder_Local_Open_Dir(real_folder);
     while (DH_Next(dh)) {
-        CharBuf *entry = DH_Get_Entry(dh);
-        VA_Push(ivars->elems, (Obj*)CB_Clone(entry));
+        String *entry = DH_Get_Entry(dh);
+        VA_Push(ivars->elems, (Obj*)Str_Clone(entry));
         DECREF(entry);
     }
     DECREF(dh);
@@ -314,10 +314,10 @@ CFReaderDH_Next_IMP(CFReaderDirHandle *self) {
     if (ivars->elems) {
         ivars->tick++;
         if (ivars->tick < (int32_t)VA_Get_Size(ivars->elems)) {
-            CharBuf *path = (CharBuf*)CERTIFY(
-                                VA_Fetch(ivars->elems, ivars->tick), CHARBUF);
+            String *path = (String*)CERTIFY(
+                                VA_Fetch(ivars->elems, ivars->tick), STRING);
             DECREF(ivars->entry);
-            ivars->entry = (CharBuf*)INCREF(path);
+            ivars->entry = (String*)INCREF(path);
             return true;
         }
         else {
@@ -332,7 +332,7 @@ bool
 CFReaderDH_Entry_Is_Dir_IMP(CFReaderDirHandle *self) {
     CFReaderDirHandleIVARS *const ivars = CFReaderDH_IVARS(self);
     if (ivars->elems) {
-        CharBuf *name = (CharBuf*)VA_Fetch(ivars->elems, ivars->tick);
+        String *name = (String*)VA_Fetch(ivars->elems, ivars->tick);
         if (name) {
             return CFReader_Local_Is_Directory(ivars->cf_reader, name);
         }

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/CompoundFileReader.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.cfh b/core/Lucy/Store/CompoundFileReader.cfh
index a977680..0876856 100644
--- a/core/Lucy/Store/CompoundFileReader.cfh
+++ b/core/Lucy/Store/CompoundFileReader.cfh
@@ -52,7 +52,7 @@ class Lucy::Store::CompoundFileReader cnick CFReader
     Get_Real_Folder(CompoundFileReader *self);
 
     void
-    Set_Path(CompoundFileReader *self, const CharBuf *path);
+    Set_Path(CompoundFileReader *self, const String *path);
 
     public void
     Close(CompoundFileReader *self);
@@ -61,26 +61,26 @@ class Lucy::Store::CompoundFileReader cnick CFReader
     Destroy(CompoundFileReader *self);
 
     bool
-    Local_Delete(CompoundFileReader *self, const CharBuf *name);
+    Local_Delete(CompoundFileReader *self, const String *name);
 
     bool
-    Local_Exists(CompoundFileReader *self, const CharBuf *name);
+    Local_Exists(CompoundFileReader *self, const String *name);
 
     bool
-    Local_Is_Directory(CompoundFileReader *self, const CharBuf *name);
+    Local_Is_Directory(CompoundFileReader *self, const String *name);
 
     incremented nullable FileHandle*
-    Local_Open_FileHandle(CompoundFileReader *self, const CharBuf *name,
+    Local_Open_FileHandle(CompoundFileReader *self, const String *name,
                           uint32_t flags);
 
     incremented nullable InStream*
-    Local_Open_In(CompoundFileReader *self, const CharBuf *name);
+    Local_Open_In(CompoundFileReader *self, const String *name);
 
     bool
-    Local_MkDir(CompoundFileReader *self, const CharBuf *name);
+    Local_MkDir(CompoundFileReader *self, const String *name);
 
     nullable Folder*
-    Local_Find_Folder(CompoundFileReader *self, const CharBuf *name);
+    Local_Find_Folder(CompoundFileReader *self, const String *name);
 
     incremented nullable DirHandle*
     Local_Open_Dir(CompoundFileReader *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/CompoundFileWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileWriter.c b/core/Lucy/Store/CompoundFileWriter.c
index 4516ecb..e86868c 100644
--- a/core/Lucy/Store/CompoundFileWriter.c
+++ b/core/Lucy/Store/CompoundFileWriter.c
@@ -59,7 +59,7 @@ CFWriter_Destroy_IMP(CompoundFileWriter *self) {
 void
 CFWriter_Consolidate_IMP(CompoundFileWriter *self) {
     CompoundFileWriterIVARS *const ivars = CFWriter_IVARS(self);
-    CharBuf *cfmeta_file = (CharBuf*)SSTR_WRAP_STR("cfmeta.json", 11);
+    String *cfmeta_file = (String*)SSTR_WRAP_STR("cfmeta.json", 11);
     if (Folder_Exists(ivars->folder, cfmeta_file)) {
         THROW(ERR, "Merge already performed for %o",
               Folder_Get_Path(ivars->folder));
@@ -75,8 +75,8 @@ S_clean_up_old_temp_files(CompoundFileWriter *self,
                           CompoundFileWriterIVARS *ivars) {
     UNUSED_VAR(self);
     Folder  *folder      = ivars->folder;
-    CharBuf *cfmeta_temp = (CharBuf*)SSTR_WRAP_STR("cfmeta.json.temp", 16);
-    CharBuf *cf_file     = (CharBuf*)SSTR_WRAP_STR("cf.dat", 6);
+    String *cfmeta_temp = (String*)SSTR_WRAP_STR("cfmeta.json.temp", 16);
+    String *cf_file     = (String*)SSTR_WRAP_STR("cf.dat", 6);
 
     if (Folder_Exists(folder, cf_file)) {
         if (!Folder_Delete(folder, cf_file)) {
@@ -98,8 +98,8 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
     Hash      *sub_files    = Hash_new(0);
     VArray    *files        = Folder_List(folder, NULL);
     VArray    *merged       = VA_new(VA_Get_Size(files));
-    CharBuf   *cf_file      = (CharBuf*)SSTR_WRAP_STR("cf.dat", 6);
-    OutStream *outstream    = Folder_Open_Out(folder, (CharBuf*)cf_file);
+    String    *cf_file      = (String*)SSTR_WRAP_STR("cf.dat", 6);
+    OutStream *outstream    = Folder_Open_Out(folder, (String*)cf_file);
     bool       rename_success;
 
     if (!outstream) { RETHROW(INCREF(Err_get_error())); }
@@ -107,13 +107,13 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
     // Start metadata.
     Hash_Store_Str(metadata, "files", 5, INCREF(sub_files));
     Hash_Store_Str(metadata, "format", 6,
-                   (Obj*)CB_newf("%i32", CFWriter_current_file_format));
+                   (Obj*)Str_newf("%i32", CFWriter_current_file_format));
 
     VA_Sort(files, NULL, NULL);
     for (uint32_t i = 0, max = VA_Get_Size(files); i < max; i++) {
-        CharBuf *infilename = (CharBuf*)VA_Fetch(files, i);
+        String *infilename = (String*)VA_Fetch(files, i);
 
-        if (!CB_Ends_With_Str(infilename, ".json", 5)) {
+        if (!Str_Ends_With_Str(infilename, ".json", 5)) {
             InStream *instream   = Folder_Open_In(folder, infilename);
             Hash     *file_data  = Hash_new(2);
             int64_t   offset, len;
@@ -127,9 +127,9 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
 
             // Record offset and length.
             Hash_Store_Str(file_data, "offset", 6,
-                           (Obj*)CB_newf("%i64", offset));
+                           (Obj*)Str_newf("%i64", offset));
             Hash_Store_Str(file_data, "length", 6,
-                           (Obj*)CB_newf("%i64", len));
+                           (Obj*)Str_newf("%i64", len));
             Hash_Store(sub_files, (Obj*)infilename, (Obj*)file_data);
             VA_Push(merged, INCREF(infilename));
 
@@ -143,8 +143,8 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
     }
 
     // Write metadata to cfmeta file.
-    CharBuf *cfmeta_temp = (CharBuf*)SSTR_WRAP_STR("cfmeta.json.temp", 16);
-    CharBuf *cfmeta_file = (CharBuf*)SSTR_WRAP_STR("cfmeta.json", 11);
+    String *cfmeta_temp = (String*)SSTR_WRAP_STR("cfmeta.json.temp", 16);
+    String *cfmeta_file = (String*)SSTR_WRAP_STR("cfmeta.json", 11);
     Json_spew_json((Obj*)metadata, (Folder*)ivars->folder, cfmeta_temp);
     rename_success = Folder_Rename(ivars->folder, cfmeta_temp, cfmeta_file);
     if (!rename_success) { RETHROW(INCREF(Err_get_error())); }
@@ -155,12 +155,12 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
     DECREF(files);
     DECREF(metadata);
     /*
-    CharBuf *merged_file;
+    String *merged_file;
     Obj     *ignore;
     Hash_Iterate(sub_files);
     while (Hash_Next(sub_files, (Obj**)&merged_file, &ignore)) {
         if (!Folder_Delete(folder, merged_file)) {
-            CharBuf *mess = MAKE_MESS("Can't delete '%o'", merged_file);
+            String *mess = MAKE_MESS("Can't delete '%o'", merged_file);
             DECREF(sub_files);
             Err_throw_mess(ERR, mess);
         }
@@ -168,9 +168,9 @@ S_do_consolidate(CompoundFileWriter *self, CompoundFileWriterIVARS *ivars) {
     */
     DECREF(sub_files);
     for (uint32_t i = 0, max = VA_Get_Size(merged); i < max; i++) {
-        CharBuf *merged_file = (CharBuf*)VA_Fetch(merged, i);
+        String *merged_file = (String*)VA_Fetch(merged, i);
         if (!Folder_Delete(folder, merged_file)) {
-            CharBuf *mess = MAKE_MESS("Can't delete '%o'", merged_file);
+            String *mess = MAKE_MESS("Can't delete '%o'", merged_file);
             DECREF(merged);
             Err_throw_mess(ERR, mess);
         }

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/DirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/DirHandle.c b/core/Lucy/Store/DirHandle.c
index 9d5f3a4..3a47e34 100644
--- a/core/Lucy/Store/DirHandle.c
+++ b/core/Lucy/Store/DirHandle.c
@@ -19,9 +19,9 @@
 #include "Lucy/Store/DirHandle.h"
 
 DirHandle*
-DH_init(DirHandle *self, const CharBuf *dir) {
+DH_init(DirHandle *self, const String *dir) {
     DirHandleIVARS *const ivars = DH_IVARS(self);
-    ivars->dir   = CB_Clone(dir);
+    ivars->dir   = Str_Clone(dir);
     ivars->entry = NULL;
     ABSTRACT_CLASS_CHECK(self, DIRHANDLE);
     return self;
@@ -36,15 +36,15 @@ DH_Destroy_IMP(DirHandle *self) {
     SUPER_DESTROY(self, DIRHANDLE);
 }
 
-CharBuf*
+String*
 DH_Get_Dir_IMP(DirHandle *self) {
     return DH_IVARS(self)->dir;
 }
 
-CharBuf*
+String*
 DH_Get_Entry_IMP(DirHandle *self) {
-    CharBuf *entry = DH_IVARS(self)->entry;
-    return (CharBuf*)INCREF(entry);
+    String *entry = DH_IVARS(self)->entry;
+    return (String*)INCREF(entry);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/DirHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/DirHandle.cfh b/core/Lucy/Store/DirHandle.cfh
index f776b93..341c0aa 100644
--- a/core/Lucy/Store/DirHandle.cfh
+++ b/core/Lucy/Store/DirHandle.cfh
@@ -21,15 +21,15 @@ parcel Lucy;
 abstract class Lucy::Store::DirHandle cnick DH
     inherits Clownfish::Obj {
 
-    CharBuf  *dir;
-    CharBuf  *entry;
+    String   *dir;
+    String   *entry;
 
     /** Abstract constructor.
      *
      * @param dir The path to the directory.
      */
     inert DirHandle*
-    init(DirHandle *self, const CharBuf *dir);
+    init(DirHandle *self, const String *dir);
 
     /** Proceed to the next entry in the directory.
      *
@@ -46,13 +46,13 @@ abstract class Lucy::Store::DirHandle cnick DH
 
     /** Return the object's <code>dir</code> attribute.
      */
-    CharBuf*
+    String*
     Get_Dir(DirHandle *self);
 
     /** Return the path of the current entry.  The value is only valid when
      * Next() has returned successfully.
      */
-    incremented CharBuf*
+    incremented String*
     Get_Entry(DirHandle *self);
 
     /** Returns true if the current entry is a directory, false otherwise.

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/FSDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSDirHandle.c b/core/Lucy/Store/FSDirHandle.c
index abc92cc..c477dc4 100644
--- a/core/Lucy/Store/FSDirHandle.c
+++ b/core/Lucy/Store/FSDirHandle.c
@@ -31,7 +31,7 @@
 #endif
 
 FSDirHandle*
-FSDH_open(const CharBuf *dir) {
+FSDH_open(const String *dir) {
     FSDirHandle *self = (FSDirHandle*)VTable_Make_Obj(FSDIRHANDLE);
     return FSDH_do_open(self, dir);
 }
@@ -64,9 +64,9 @@ SI_is_updir(const char *name, size_t len) {
 #include <windows.h>
 
 FSDirHandle*
-FSDH_do_open(FSDirHandle *self, const CharBuf *dir) {
-    size_t  dir_path_size = CB_Get_Size(dir);
-    char   *dir_path_ptr  = (char*)CB_Get_Ptr8(dir);
+FSDH_do_open(FSDirHandle *self, const String *dir) {
+    size_t  dir_path_size = Str_Get_Size(dir);
+    char   *dir_path_ptr  = (char*)Str_Get_Ptr8(dir);
     char    search_string[MAX_PATH + 1];
     char   *path_ptr = search_string;
 
@@ -78,7 +78,7 @@ FSDH_do_open(FSDirHandle *self, const CharBuf *dir) {
 
     if (dir_path_size >= MAX_PATH - 2) {
         // Deal with Windows ceiling on file path lengths.
-        Err_set_error(Err_new(CB_newf("Directory path is too long: %o",
+        Err_set_error(Err_new(Str_newf("Directory path is too long: %o",
                                       dir)));
         CFISH_DECREF(self);
         return NULL;
@@ -93,7 +93,7 @@ FSDH_do_open(FSDirHandle *self, const CharBuf *dir) {
         = FindFirstFile(search_string, (WIN32_FIND_DATA*)ivars->sys_dir_entry);
     if (INVALID_HANDLE_VALUE == ivars->sys_dirhandle) {
         // Directory inaccessible or doesn't exist.
-        Err_set_error(Err_new(CB_newf("Failed to open dir '%o'", dir)));
+        Err_set_error(Err_new(Str_newf("Failed to open dir '%o'", dir)));
         CFISH_DECREF(self);
         return NULL;
     }
@@ -141,7 +141,7 @@ FSDH_Close_IMP(FSDirHandle *self) {
             if (!ivars->saved_error) {
                 char *win_error = Err_win_error();
                 ivars->saved_error
-                    = Err_new(CB_newf("Error while closing directory: %s",
+                    = Err_new(Str_newf("Error while closing directory: %s",
                                       win_error));
                 FREEMEM(win_error);
             }
@@ -182,7 +182,7 @@ FSDH_Next_IMP(FSDirHandle *self) {
         if (GetLastError() != ERROR_NO_MORE_FILES) {
             char *win_error = Err_win_error();
             ivars->saved_error
-                = Err_new(CB_newf("Error while traversing directory: %s",
+                = Err_new(Str_newf("Error while traversing directory: %s",
                                   win_error));
             FREEMEM(win_error);
         }
@@ -196,7 +196,7 @@ FSDH_Next_IMP(FSDirHandle *self) {
     }
     else {
         DECREF(ivars->entry);
-        ivars->entry = CB_new_from_utf8(find_data->cFileName, len);
+        ivars->entry = Str_new_from_utf8(find_data->cFileName, len);
         return true;
     }
 }
@@ -207,8 +207,8 @@ FSDH_Next_IMP(FSDirHandle *self) {
 #include <dirent.h>
 
 FSDirHandle*
-FSDH_do_open(FSDirHandle *self, const CharBuf *dir) {
-    char *dir_path_ptr = (char*)CB_Get_Ptr8(dir);
+FSDH_do_open(FSDirHandle *self, const String *dir) {
+    char *dir_path_ptr = (char*)Str_Get_Ptr8(dir);
 
     DH_init((DirHandle*)self, dir);
     FSDirHandleIVARS *const ivars = FSDH_IVARS(self);
@@ -216,7 +216,7 @@ FSDH_do_open(FSDirHandle *self, const CharBuf *dir) {
 
     ivars->sys_dirhandle = opendir(dir_path_ptr);
     if (!ivars->sys_dirhandle) {
-        Err_set_error(Err_new(CB_newf("Failed to opendir '%o'", dir)));
+        Err_set_error(Err_new(Str_newf("Failed to opendir '%o'", dir)));
         DECREF(self);
         return NULL;
     }
@@ -245,7 +245,7 @@ FSDH_Next_IMP(FSDirHandle *self) {
         }
         else {
             DECREF(ivars->entry);
-            ivars->entry = CB_new_from_utf8(sys_dir_entry->d_name, len);
+            ivars->entry = Str_new_from_utf8(sys_dir_entry->d_name, len);
             return true;
         }
     }
@@ -270,9 +270,9 @@ FSDH_Entry_Is_Dir_IMP(FSDirHandle *self) {
 
     bool retval = false;
     struct stat stat_buf;
-    CharBuf *fullpath = CB_newf("%o%s%o", ivars->dir, CHY_DIR_SEP,
+    String *fullpath = Str_newf("%o%s%o", ivars->dir, CHY_DIR_SEP,
                                 ivars->entry);
-    if (stat((char*)CB_Get_Ptr8(fullpath), &stat_buf) != -1) {
+    if (stat((char*)Str_Get_Ptr8(fullpath), &stat_buf) != -1) {
         if (stat_buf.st_mode & S_IFDIR) { retval = true; }
     }
     DECREF(fullpath);
@@ -291,9 +291,9 @@ FSDH_Entry_Is_Symlink_IMP(FSDirHandle *self) {
     {
         bool retval = false;
         struct stat stat_buf;
-        CharBuf *fullpath = CB_newf("%o%s%o", ivars->dir, CHY_DIR_SEP,
+        String *fullpath = Str_newf("%o%s%o", ivars->dir, CHY_DIR_SEP,
                                     ivars->entry);
-        if (stat((char*)CB_Get_Ptr8(fullpath), &stat_buf) != -1) {
+        if (stat((char*)Str_Get_Ptr8(fullpath), &stat_buf) != -1) {
             if (stat_buf.st_mode & S_IFLNK) { retval = true; }
         }
         DECREF(fullpath);
@@ -309,7 +309,7 @@ FSDH_Close_IMP(FSDirHandle *self) {
         DIR *sys_dirhandle = (DIR*)ivars->sys_dirhandle;
         ivars->sys_dirhandle = NULL;
         if (closedir(sys_dirhandle) == -1) {
-            Err_set_error(Err_new(CB_newf("Error closing dirhandle: %s",
+            Err_set_error(Err_new(Str_newf("Error closing dirhandle: %s",
                                           strerror(errno))));
             return false;
         }

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/FSDirHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSDirHandle.cfh b/core/Lucy/Store/FSDirHandle.cfh
index 0d39341..dc4a640 100644
--- a/core/Lucy/Store/FSDirHandle.cfh
+++ b/core/Lucy/Store/FSDirHandle.cfh
@@ -27,10 +27,10 @@ class Lucy::Store::FSDirHandle cnick FSDH
     bool     delayed_iter;
 
     inert incremented nullable FSDirHandle*
-    open(const CharBuf *path);
+    open(const String *path);
 
     inert nullable FSDirHandle*
-    do_open(FSDirHandle *self, const CharBuf *path);
+    do_open(FSDirHandle *self, const String *path);
 
     bool
     Next(FSDirHandle *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/FSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFileHandle.c b/core/Lucy/Store/FSFileHandle.c
index f5b11a5..132ef80 100644
--- a/core/Lucy/Store/FSFileHandle.c
+++ b/core/Lucy/Store/FSFileHandle.c
@@ -83,27 +83,27 @@ SI_close_win_handles(FSFileHandle *self);
 #endif
 
 FSFileHandle*
-FSFH_open(const CharBuf *path, uint32_t flags) {
+FSFH_open(const String *path, uint32_t flags) {
     FSFileHandle *self = (FSFileHandle*)VTable_Make_Obj(FSFILEHANDLE);
     return FSFH_do_open(self, path, flags);
 }
 
 FSFileHandle*
-FSFH_do_open(FSFileHandle *self, const CharBuf *path, uint32_t flags) {
+FSFH_do_open(FSFileHandle *self, const String *path, uint32_t flags) {
     FH_do_open((FileHandle*)self, path, flags);
     FSFileHandleIVARS *const ivars = FSFH_IVARS(self);
-    if (!path || !CB_Get_Size(path)) {
-        Err_set_error(Err_new(CB_newf("Missing required param 'path'")));
+    if (!path || !Str_Get_Size(path)) {
+        Err_set_error(Err_new(Str_newf("Missing required param 'path'")));
         CFISH_DECREF(self);
         return NULL;
     }
 
     // Attempt to open file.
     if (flags & FH_WRITE_ONLY) {
-        ivars->fd = open((char*)CB_Get_Ptr8(path), SI_posix_flags(flags), 0666);
+        ivars->fd = open((char*)Str_Get_Ptr8(path), SI_posix_flags(flags), 0666);
         if (ivars->fd == -1) {
             ivars->fd = 0;
-            Err_set_error(Err_new(CB_newf("Attempt to open '%o' failed: %s",
+            Err_set_error(Err_new(Str_newf("Attempt to open '%o' failed: %s",
                                           path, strerror(errno))));
             CFISH_DECREF(self);
             return NULL;
@@ -115,7 +115,7 @@ FSFH_do_open(FSFileHandle *self, const CharBuf *path, uint32_t flags) {
             // Derive length.
             ivars->len = lseek64(ivars->fd, INT64_C(0), SEEK_END);
             if (ivars->len == -1) {
-                Err_set_error(Err_new(CB_newf("lseek64 on %o failed: %s",
+                Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s",
                                               ivars->path, strerror(errno))));
                 CFISH_DECREF(self);
                 return NULL;
@@ -123,7 +123,7 @@ FSFH_do_open(FSFileHandle *self, const CharBuf *path, uint32_t flags) {
             else {
                 int64_t check_val = lseek64(ivars->fd, INT64_C(0), SEEK_SET);
                 if (check_val == -1) {
-                    Err_set_error(Err_new(CB_newf("lseek64 on %o failed: %s",
+                    Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s",
                                                   ivars->path, strerror(errno))));
                     CFISH_DECREF(self);
                     return NULL;
@@ -150,7 +150,7 @@ FSFH_do_open(FSFileHandle *self, const CharBuf *path, uint32_t flags) {
         }
     }
     else {
-        Err_set_error(Err_new(CB_newf("Must specify FH_READ_ONLY or FH_WRITE_ONLY to open '%o'",
+        Err_set_error(Err_new(Str_newf("Must specify FH_READ_ONLY or FH_WRITE_ONLY to open '%o'",
                                       path)));
         CFISH_DECREF(self);
         return NULL;
@@ -172,7 +172,7 @@ FSFH_Close_IMP(FSFileHandle *self) {
     // Close system-specific handles.
     if (ivars->fd) {
         if (close(ivars->fd)) {
-            Err_set_error(Err_new(CB_newf("Failed to close file: %s",
+            Err_set_error(Err_new(Str_newf("Failed to close file: %s",
                                           strerror(errno))));
             return false;
         }
@@ -197,11 +197,11 @@ FSFH_Write_IMP(FSFileHandle *self, const void *data, size_t len) {
         ivars->len += check_val;
         if ((size_t)check_val != len) {
             if (check_val == -1) {
-                Err_set_error(Err_new(CB_newf("Error when writing %u64 bytes: %s",
+                Err_set_error(Err_new(Str_newf("Error when writing %u64 bytes: %s",
                                               (uint64_t)len, strerror(errno))));
             }
             else {
-                Err_set_error(Err_new(CB_newf("Attempted to write %u64 bytes, but wrote %i64",
+                Err_set_error(Err_new(Str_newf("Attempted to write %u64 bytes, but wrote %i64",
                                               (uint64_t)len, check_val)));
             }
             return false;
@@ -222,16 +222,16 @@ FSFH_Window_IMP(FSFileHandle *self, FileWindow *window, int64_t offset,
     FSFileHandleIVARS *const ivars = FSFH_IVARS(self);
     const int64_t end = offset + len;
     if (!(ivars->flags & FH_READ_ONLY)) {
-        Err_set_error(Err_new(CB_newf("Can't read from write-only handle")));
+        Err_set_error(Err_new(Str_newf("Can't read from write-only handle")));
         return false;
     }
     else if (offset < 0) {
-        Err_set_error(Err_new(CB_newf("Can't read from negative offset %i64",
+        Err_set_error(Err_new(Str_newf("Can't read from negative offset %i64",
                                       offset)));
         return false;
     }
     else if (end > ivars->len) {
-        Err_set_error(Err_new(CB_newf("Tried to read past EOF: offset %i64 + request %i64 > len %i64",
+        Err_set_error(Err_new(Str_newf("Tried to read past EOF: offset %i64 + request %i64 > len %i64",
                                       offset, len, ivars->len)));
         return false;
     }
@@ -265,16 +265,16 @@ FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
     const int64_t end = offset + len;
 
     if (ivars->flags & FH_WRITE_ONLY) {
-        Err_set_error(Err_new(CB_newf("Can't read from write-only filehandle")));
+        Err_set_error(Err_new(Str_newf("Can't read from write-only filehandle")));
         return false;
     }
     if (offset < 0) {
-        Err_set_error(Err_new(CB_newf("Can't read from an offset less than 0 (%i64)",
+        Err_set_error(Err_new(Str_newf("Can't read from an offset less than 0 (%i64)",
                                       offset)));
         return false;
     }
     else if (end > ivars->len) {
-        Err_set_error(Err_new(CB_newf("Tried to read past EOF: offset %i64 + request %u64 > len %i64",
+        Err_set_error(Err_new(Str_newf("Tried to read past EOF: offset %i64 + request %u64 > len %i64",
                                       offset, (uint64_t)len, ivars->len)));
         return false;
     }
@@ -330,11 +330,11 @@ SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
     UNUSED_VAR(self);
 
     // Open.
-    ivars->fd = open((char*)CB_Get_Ptr8(ivars->path),
+    ivars->fd = open((char*)Str_Get_Ptr8(ivars->path),
                     SI_posix_flags(ivars->flags), 0666);
     if (ivars->fd == -1) {
         ivars->fd = 0;
-        Err_set_error(Err_new(CB_newf("Can't open '%o': %s", ivars->path,
+        Err_set_error(Err_new(Str_newf("Can't open '%o': %s", ivars->path,
                                       strerror(errno))));
         return false;
     }
@@ -342,14 +342,14 @@ SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
     // Derive len.
     ivars->len = lseek64(ivars->fd, INT64_C(0), SEEK_END);
     if (ivars->len == -1) {
-        Err_set_error(Err_new(CB_newf("lseek64 on %o failed: %s", ivars->path,
+        Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s", ivars->path,
                                       strerror(errno))));
         return false;
     }
     else {
         int64_t check_val = lseek64(ivars->fd, INT64_C(0), SEEK_SET);
         if (check_val == -1) {
-            Err_set_error(Err_new(CB_newf("lseek64 on %o failed: %s",
+            Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s",
                                           ivars->path, strerror(errno))));
             return false;
         }
@@ -377,7 +377,7 @@ SI_map(FSFileHandle *self, FSFileHandleIVARS *ivars, int64_t offset,
         // Read-only memory mapping.
         buf = mmap(NULL, len, PROT_READ, MAP_SHARED, ivars->fd, offset);
         if (buf == (void*)(-1)) {
-            Err_set_error(Err_new(CB_newf("mmap of offset %i64 and length %i64 (page size %i64) "
+            Err_set_error(Err_new(Str_newf("mmap of offset %i64 and length %i64 (page size %i64) "
                                           "against '%o' failed: %s",
                                           offset, len, ivars->page_size,
                                           ivars->path, strerror(errno))));
@@ -392,7 +392,7 @@ static CFISH_INLINE bool
 SI_unmap(FSFileHandle *self, char *buf, int64_t len) {
     if (buf != NULL) {
         if (munmap(buf, len)) {
-            Err_set_error(Err_new(CB_newf("Failed to munmap '%o': %s",
+            Err_set_error(Err_new(Str_newf("Failed to munmap '%o': %s",
                                           FSFH_IVARS(self)->path,
                                           strerror(errno))));
             return false;
@@ -409,7 +409,7 @@ FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
 
     // Sanity check.
     if (offset < 0) {
-        Err_set_error(Err_new(CB_newf("Can't read from an offset less than 0 (%i64)",
+        Err_set_error(Err_new(Str_newf("Can't read from an offset less than 0 (%i64)",
                                       offset)));
         return false;
     }
@@ -418,11 +418,11 @@ FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
     check_val = pread64(ivars->fd, dest, len, offset);
     if (check_val != (int64_t)len) {
         if (check_val == -1) {
-            Err_set_error(Err_new(CB_newf("Tried to read %u64 bytes, got %i64: %s",
+            Err_set_error(Err_new(Str_newf("Tried to read %u64 bytes, got %i64: %s",
                                           (uint64_t)len, check_val, strerror(errno))));
         }
         else {
-            Err_set_error(Err_new(CB_newf("Tried to read %u64 bytes, got %i64",
+            Err_set_error(Err_new(Str_newf("Tried to read %u64 bytes, got %i64",
                                           (uint64_t)len, check_val)));
         }
         return false;
@@ -438,7 +438,7 @@ FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
 
 static CFISH_INLINE bool
 SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
-    char *filepath = (char*)CB_Get_Ptr8(ivars->path);
+    char *filepath = (char*)Str_Get_Ptr8(ivars->path);
     SYSTEM_INFO sys_info;
 
     // Get system page size.
@@ -457,7 +457,7 @@ SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
                         );
     if (ivars->win_fhandle == INVALID_HANDLE_VALUE) {
         char *win_error = Err_win_error();
-        Err_set_error(Err_new(CB_newf("CreateFile for %o failed: %s",
+        Err_set_error(Err_new(Str_newf("CreateFile for %o failed: %s",
                                       ivars->path, win_error)));
         FREEMEM(win_error);
         return false;
@@ -467,7 +467,7 @@ SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
     DWORD file_size_hi;
     DWORD file_size_lo = GetFileSize(ivars->win_fhandle, &file_size_hi);
     if (file_size_lo == INVALID_FILE_SIZE && GetLastError() != NO_ERROR) {
-        Err_set_error(Err_new(CB_newf("GetFileSize for %o failed",
+        Err_set_error(Err_new(Str_newf("GetFileSize for %o failed",
                                       ivars->path)));
         return false;
     }
@@ -480,7 +480,7 @@ SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
                                                  PAGE_READONLY, 0, 0, NULL);
         if (ivars->win_maphandle == NULL) {
             char *win_error = Err_win_error();
-            Err_set_error(Err_new(CB_newf("CreateFileMapping for %o failed: %s",
+            Err_set_error(Err_new(Str_newf("CreateFileMapping for %o failed: %s",
                                           ivars->path, win_error)));
             FREEMEM(win_error);
             return false;
@@ -505,7 +505,7 @@ SI_map(FSFileHandle *self, FSFileHandleIVARS *ivars, int64_t offset,
                             file_offset_hi, file_offset_lo, amount);
         if (buf == NULL) {
             char *win_error = Err_win_error();
-            Err_set_error(Err_new(CB_newf("MapViewOfFile for %o failed: %s",
+            Err_set_error(Err_new(Str_newf("MapViewOfFile for %o failed: %s",
                                           ivars->path, win_error)));
             FREEMEM(win_error);
         }
@@ -519,7 +519,7 @@ SI_unmap(FSFileHandle *self, char *ptr, int64_t len) {
     if (buf != NULL) {
         if (!UnmapViewOfFile(buf)) {
             char *win_error = Err_win_error();
-            Err_set_error(Err_new(CB_newf("Failed to unmap '%o': %s",
+            Err_set_error(Err_new(Str_newf("Failed to unmap '%o': %s",
                                           FSFH_IVARS(self)->path,
                                           win_error)));
             FREEMEM(win_error);
@@ -536,7 +536,7 @@ SI_close_win_handles(FSFileHandle *self) {
     if (ivars->win_maphandle) {
         if (!CloseHandle(ivars->win_maphandle)) {
             char *win_error = Err_win_error();
-            Err_set_error(Err_new(CB_newf("Failed to close file mapping handle: %s",
+            Err_set_error(Err_new(Str_newf("Failed to close file mapping handle: %s",
                                           win_error)));
             FREEMEM(win_error);
             return false;
@@ -546,7 +546,7 @@ SI_close_win_handles(FSFileHandle *self) {
     if (ivars->win_fhandle) {
         if (!CloseHandle(ivars->win_fhandle)) {
             char *win_error = Err_win_error();
-            Err_set_error(Err_new(CB_newf("Failed to close file handle: %s",
+            Err_set_error(Err_new(Str_newf("Failed to close file handle: %s",
                                           win_error)));
             FREEMEM(win_error);
             return false;
@@ -572,7 +572,7 @@ FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
 
     // Sanity check.
     if (offset < 0) {
-        Err_set_error(Err_new(CB_newf("Can't read from an offset less than 0 (%i64)",
+        Err_set_error(Err_new(Str_newf("Can't read from an offset less than 0 (%i64)",
                                       offset)));
         return false;
     }
@@ -580,7 +580,7 @@ FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
     // ReadFile() takes a DWORD (unsigned 32-bit integer) as a length
     // argument, so throw a sensible error rather than wrap around.
     if (len > UINT32_MAX) {
-        Err_set_error(Err_new(CB_newf("Can't read more than 4 GB (%u64)",
+        Err_set_error(Err_new(Str_newf("Can't read more than 4 GB (%u64)",
                                       (uint64_t)len)));
         return false;
     }
@@ -598,7 +598,7 @@ FSFH_Read_IMP(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
     // Verify that the read has succeeded by now.
     if (!check_val) {
         char *win_error = Err_win_error();
-        Err_set_error(Err_new(CB_newf("Failed to read %u64 bytes: %s",
+        Err_set_error(Err_new(Str_newf("Failed to read %u64 bytes: %s",
                                       (uint64_t)len, win_error)));
         FREEMEM(win_error);
         return false;

http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/core/Lucy/Store/FSFileHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFileHandle.cfh b/core/Lucy/Store/FSFileHandle.cfh
index ddcdb3f..1507fff 100644
--- a/core/Lucy/Store/FSFileHandle.cfh
+++ b/core/Lucy/Store/FSFileHandle.cfh
@@ -35,10 +35,10 @@ class Lucy::Store::FSFileHandle cnick FSFH
      * @param flags FileHandle constructor flags.
      */
     inert incremented nullable FSFileHandle*
-    open(const CharBuf *path = NULL, uint32_t flags);
+    open(const String *path = NULL, uint32_t flags);
 
     inert nullable FSFileHandle*
-    do_open(FSFileHandle *self, const CharBuf *path = NULL, uint32_t flags);
+    do_open(FSFileHandle *self, const String *path = NULL, uint32_t flags);
 
     bool
     Window(FSFileHandle *self, FileWindow *window, int64_t offset, int64_t len);


Mime
View raw message