mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
* Source/GSPrivate.h (GSCharPtr): New union type to handle
alignment issues. (GSString): Use it. * Source/GSString.m ([-initWithBytesNoCopy:length:encoding:freeWhenDone:]): Use GSCharPtr instead of casts to avoid alignment issues. Fix typo's. * Source/NSString.m ([-initWithBytesNoCopy:length:encoding:freeWhenDone:]): Correct grammar in comment. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23009 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7a07d80acc
commit
b3c9994d61
4 changed files with 51 additions and 25 deletions
|
@ -111,6 +111,15 @@ GS_EXPORT NSString *GSEncodingName(NSStringEncoding encoding);
|
|||
*/
|
||||
GS_EXPORT BOOL GSIsByteEncoding(NSStringEncoding encoding);
|
||||
|
||||
/*
|
||||
* Type to hold either UTF-16 (unichar) or 8-bit encodings,
|
||||
* while satisfying alignment constraints.
|
||||
*/
|
||||
typedef union {
|
||||
unichar *u; // 16-bit unicode characters.
|
||||
unsigned char *c; // 8-bit characters.
|
||||
} GSCharPtr;
|
||||
|
||||
/*
|
||||
* Private concrete string classes.
|
||||
* NB. All these concrete string classes MUST have the same initial ivar
|
||||
|
@ -121,10 +130,7 @@ GS_EXPORT BOOL GSIsByteEncoding(NSStringEncoding encoding);
|
|||
*/
|
||||
@interface GSString : NSString
|
||||
{
|
||||
union {
|
||||
unichar *u; // 16-bit unicode characters.
|
||||
unsigned char *c; // 8-bit characters.
|
||||
} _contents;
|
||||
GSCharPtr _contents;
|
||||
unsigned int _count;
|
||||
struct {
|
||||
unsigned int wide: 1; // 16-bit characters in string?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue