[svn:parrot] r48100 - in branches/gsoc_nfg/src: gc string string/encoding
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Fri Jul 16 17:46:16 UTC 2010
Author: darbelo
Date: Fri Jul 16 17:46:16 2010
New Revision: 48100
URL: https://trac.parrot.org/parrot/changeset/48100
Log:
Warning police.
Modified:
branches/gsoc_nfg/src/gc/api.c
branches/gsoc_nfg/src/string/api.c
branches/gsoc_nfg/src/string/encoding/nfg.c
Modified: branches/gsoc_nfg/src/gc/api.c
==============================================================================
--- branches/gsoc_nfg/src/gc/api.c Fri Jul 16 13:43:27 2010 (r48099)
+++ branches/gsoc_nfg/src/gc/api.c Fri Jul 16 17:46:16 2010 (r48100)
@@ -403,7 +403,7 @@
ASSERT_ARGS(Parrot_gc_free_string_header)
#if PARROT_HAS_ICU
if (s->encoding == Parrot_nfg_encoding_ptr && s->extra != NULL)
- destroy_grapheme_table(interp, s->extra);
+ destroy_grapheme_table(interp, (grapheme_table *) s->extra);
#endif /* PARROT_HAS_ICU */
interp->gc_sys->free_string_header(interp, s);
}
Modified: branches/gsoc_nfg/src/string/api.c
==============================================================================
--- branches/gsoc_nfg/src/string/api.c Fri Jul 16 13:43:27 2010 (r48099)
+++ branches/gsoc_nfg/src/string/api.c Fri Jul 16 17:46:16 2010 (r48100)
@@ -366,7 +366,7 @@
#if PARROT_HAS_ICU
if (s->encoding == Parrot_nfg_encoding_ptr)
- result->extra = clone_grapheme_table(interp, s->extra);
+ result->extra = clone_grapheme_table(interp, (grapheme_table *) s->extra);
#endif /* PARROT_HAS_ICU */
return result;
@@ -503,15 +503,16 @@
#if PARROT_HAS_ICU
if (enc == Parrot_nfg_encoding_ptr) {
if (a->extra != NULL) {
- dest->extra = clone_grapheme_table(interp, a->extra);
+ dest->extra = clone_grapheme_table(interp, (grapheme_table *) a->extra);
if (b->extra != NULL) {
- dest->extra = grow_grapheme_table(interp, a->extra,
+ dest->extra = grow_grapheme_table(interp, (grapheme_table *) a->extra,
((grapheme_table *)b->extra)->used);
- merge_tables_and_fixup_substring(interp, dest, b->extra, a->strlen, b->strlen);
+ merge_tables_and_fixup_substring(interp, dest, (grapheme_table *) b->extra,
+ a->strlen, b->strlen);
}
}
else {
- dest->extra = clone_grapheme_table(interp, b->extra);
+ dest->extra = clone_grapheme_table(interp, (grapheme_table *) b->extra);
}
}
#endif /* PARROT_HAS_ICU */
@@ -1235,7 +1236,7 @@
#if PARROT_HAS_ICU
/* Clone grapheme table, if appropiate */
if (dest->encoding == Parrot_nfg_encoding_ptr)
- dest->extra = clone_grapheme_table(interp, src->extra);
+ dest->extra = clone_grapheme_table(interp, (grapheme_table *) src->extra);
#endif /* PARROT_HAS_ICU */
/* Clear COW flag. We own buffer */
@@ -1259,9 +1260,9 @@
#if PARROT_HAS_ICU
if (dest->encoding == Parrot_nfg_encoding_ptr && rep->extra != NULL) {
- dest->extra = grow_grapheme_table(interp, dest->extra,
+ dest->extra = grow_grapheme_table(interp, (grapheme_table *) dest->extra,
((grapheme_table *)rep->extra)->used);
- merge_tables_and_fixup_substring(interp, dest, rep->extra,
+ merge_tables_and_fixup_substring(interp, dest, (grapheme_table *) rep->extra,
start_byte / sizeof (UChar32), rep->strlen);
}
#endif /* PARROT_HAS_ICU */
Modified: branches/gsoc_nfg/src/string/encoding/nfg.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding/nfg.c Fri Jul 16 13:43:27 2010 (r48099)
+++ branches/gsoc_nfg/src/string/encoding/nfg.c Fri Jul 16 17:46:16 2010 (r48100)
@@ -232,7 +232,8 @@
if (hash != 0xffff) {
nfg_encode(interp, dest, index, src, offs, len, graphemes + 1);
- buf[--index] = add_grapheme_from_substr(interp, dest->extra, src, aux, offs-aux, hash);
+ buf[--index] = add_grapheme_from_substr(interp, (grapheme_table *)dest->extra,
+ src, aux, offs-aux, hash);
return;
}
offs++;
@@ -507,13 +508,14 @@
grapheme_table *table = (grapheme_table *) i->str->extra;
const int offs = cpos - i->bytepos / sizeof (UChar32);
const int idx = -1 - c;
- if (offs < table->graphemes[idx].len) {
- if (offs == table->graphemes[idx].len - 1)
- i->bytepos += sizeof (int32_t);
- /* Make sure we move off this grapheme if we've
- * traversed all of it's codepoints */
- return (UINTVAL) table->graphemes[-1 - c].codepoints[offs];
- }
+
+ PARROT_ASSERT(offs < table->graphemes[idx].len);
+
+ if (offs == table->graphemes[idx].len - 1)
+ i->bytepos += sizeof (int32_t);
+ /* Make sure we move off this grapheme if we've
+ * traversed all of it's codepoints */
+ return (UINTVAL) table->graphemes[-1 - c].codepoints[offs];
}
#else
UNUSED(i);
More information about the parrot-commits
mailing list