Security Update 2005-006 and -[NSString length]
Security Update 2005-006 and -[NSString length]
- Subject: Security Update 2005-006 and -[NSString length]
- From: Christian Schneider <email@hidden>
- Date: Fri, 17 Jun 2005 14:46:42 +0200
Hi all,
we have the following code where the three dots should actually be one
Unicode character (alt-.). The code shortens a string by replacing the
last two characters with "..." as long as the width needed to draw the
string exceeds some reference width.
while( tmpSize.width > myWidth )
{
[tmpString replaceCharactersInRange:NSMakeRange([tmpString
length]-2,2) withString:@"..."];
tmpSize = [tmpString sizeWithAttributes:attributes];
}
Now, this code worked perfectly well until we installed Security
Update 2005-006. Since then, when a string that is too large to fit
comes in, it will actually be enlarged, the above code resulting in an
infinite loop.
When I replace "alt-." with a simple space the code continues to work.
The definition of -[NSString length] clearly states "Returns the
number of Unicode characters in the receiver." so I guess our usage of
it should be correct.
Does anyone know what actually changed with the update (there's
nothing in the release notes) and if there's an equivalent way to get
what we want?
Thanks
chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden