summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2009-06-10 14:44:29 (GMT)
committerdgp <dgp@users.sourceforge.net>2009-06-10 14:44:29 (GMT)
commit2a3653593e13fea9eee1652863db7b373b0b3fa7 (patch)
tree615d5bdbba079825e29d64713a15356e6f4259dc
parent77651df52750776dce287030cc8a1d2c0bf61385 (diff)
downloadtcl-2a3653593e13fea9eee1652863db7b373b0b3fa7.zip
tcl-2a3653593e13fea9eee1652863db7b373b0b3fa7.tar.gz
tcl-2a3653593e13fea9eee1652863db7b373b0b3fa7.tar.bz2
* generic/tclStringObj.c: Corrected failures to deal with the
"pure unicode" representation of an empty string. Thanks to Julian Noble for reporting the problem. [Bug 2803109]
-rw-r--r--ChangeLog8
-rw-r--r--generic/tclStringObj.c32
2 files changed, 17 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index a2df5de..d645d55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-10 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclStringObj.c: Corrected failures to deal with the
+ "pure unicode" representation of an empty string. Thanks to Julian
+ Noble for reporting the problem. [Bug 2803109]
+
2006-06-09 Kevin B. Kenny <kennykb@acm.org>
* generic/tclGetDate.y: Fixed a thread safety bug in the generated
@@ -13,7 +19,7 @@
* library/tzdata/Asia/Dhaka: New DST rule for Bangladesh.
(Olson's tzdata2009i.)
-
+
2009-06-08 Donal K. Fellows <dkf@users.sf.net>
* doc/copy.n: Fix error in example spotted by Venkat Iyer.
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 7bd7526..ded77e9 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -33,7 +33,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStringObj.c,v 1.122 2009/04/07 18:45:54 dgp Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.123 2009/06/10 14:44:29 dgp Exp $ */
#include "tclInt.h"
#include "tommath.h"
@@ -855,11 +855,6 @@ Tcl_SetObjLength(
* Can only get here when objPtr->bytes == NULL.
* No need to invalidate the string rep.
*/
-
- if (length == 0) {
- /* For the empty string case, set the string rep. */
- TclInitStringRep(objPtr, tclEmptyStringRep, 0);
- }
}
}
@@ -970,11 +965,6 @@ Tcl_AttemptSetObjLength(
* Can only get here when objPtr->bytes == NULL.
* No need to invalidate the string rep.
*/
-
- if (length == 0) {
- /* For the empty string case, set the string rep. */
- TclInitStringRep(objPtr, tclEmptyStringRep, 0);
- }
}
return 1;
}
@@ -1056,11 +1046,6 @@ SetUnicodeObj(
TclInvalidateStringRep(objPtr);
stringPtr->allocated = 0;
-
- if (numChars == 0) {
- /* For the empty string case, set the string rep. */
- TclInitStringRep(objPtr, tclEmptyStringRep, 0);
- }
}
/*
@@ -1533,6 +1518,9 @@ AppendUtfToUtfRep(
* trailing null.
*/
+ if (objPtr->bytes == NULL) {
+ objPtr->length = 0;
+ }
oldLength = objPtr->length;
newLength = numBytes + oldLength;
if (newLength < 0) {
@@ -2653,10 +2641,6 @@ ExtendUnicodeRepWithString(
bytes += TclUtfToUniChar(bytes, dst);
}
*dst = 0;
- if (needed == 0) {
- /* For the empty string case, set the string rep. */
- TclInitStringRep(objPtr, tclEmptyStringRep, 0);
- }
}
/*
@@ -2828,8 +2812,12 @@ UpdateStringOfString(
Tcl_Obj *objPtr) /* Object with string rep to update. */
{
String *stringPtr = GET_STRING(objPtr);
- (void) ExtendStringRepWithUnicode(objPtr, stringPtr->unicode,
- stringPtr->numChars);
+ if (stringPtr->numChars == 0) {
+ TclInitStringRep(objPtr, tclEmptyStringRep, 0);
+ } else {
+ (void) ExtendStringRepWithUnicode(objPtr, stringPtr->unicode,
+ stringPtr->numChars);
+ }
}
static int