[svn:parrot] r46316 - trunk/src/string
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Wed May 5 16:53:19 UTC 2010
Author: NotFound
Date: Wed May 5 16:53:18 2010
New Revision: 46316
URL: https://trac.parrot.org/parrot/changeset/46316
Log:
Don't leave a string without charset, add some sanity checks
Modified:
trunk/src/string/api.c
Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c Wed May 5 16:44:43 2010 (r46315)
+++ trunk/src/string/api.c Wed May 5 16:53:18 2010 (r46316)
@@ -395,7 +395,7 @@
{
ASSERT_ARGS(Parrot_str_concat)
const CHARSET *cs;
- const ENCODING *enc;
+ const ENCODING *enc = NULL;
STRING *dest;
UINTVAL total_length;
@@ -417,6 +417,7 @@
if (!cs) {
/* upgrade strings for concatenation */
+ cs = Parrot_unicode_charset_ptr;
enc = (a->encoding == Parrot_utf16_encoding_ptr
|| b->encoding == Parrot_utf16_encoding_ptr
|| a->encoding == Parrot_ucs2_encoding_ptr
@@ -432,11 +433,12 @@
if (b->encoding != enc)
b = enc->to_encoding(interp, b);
}
-
/* calc usable and total bytes */
total_length = a->bufused + b->bufused;
dest = Parrot_str_new_noinit(interp, enum_stringrep_one, total_length);
+ PARROT_ASSERT(enc);
+ PARROT_ASSERT(cs);
dest->encoding = enc;
dest->charset = cs;
More information about the parrot-commits
mailing list