Index: src/OFConcreteNumber.h ================================================================== --- src/OFConcreteNumber.h +++ src/OFConcreteNumber.h @@ -22,10 +22,10 @@ union { double float_; long long signed_; unsigned long long unsigned_; } _value; - const char *_typeEncoding; + char _typeEncoding; } @end OF_ASSUME_NONNULL_END Index: src/OFConcreteNumber.m ================================================================== --- src/OFConcreteNumber.m +++ src/OFConcreteNumber.m @@ -96,101 +96,101 @@ - (instancetype)initWithBool: (bool)value { self = [super initWithBytes: &value objCType: @encode(bool)]; _value.unsigned_ = value; - _typeEncoding = @encode(bool); + _typeEncoding = *@encode(bool); return self; } - (instancetype)initWithChar: (signed char)value { self = [super initWithBytes: &value objCType: @encode(signed char)]; _value.signed_ = value; - _typeEncoding = @encode(signed char); + _typeEncoding = *@encode(signed char); return self; } - (instancetype)initWithShort: (short)value { self = [super initWithBytes: &value objCType: @encode(short)]; _value.signed_ = value; - _typeEncoding = @encode(short); + _typeEncoding = *@encode(short); return self; } - (instancetype)initWithInt: (int)value { self = [super initWithBytes: &value objCType: @encode(int)]; _value.signed_ = value; - _typeEncoding = @encode(int); + _typeEncoding = *@encode(int); return self; } - (instancetype)initWithLong: (long)value { self = [super initWithBytes: &value objCType: @encode(long)]; _value.signed_ = value; - _typeEncoding = @encode(long); + _typeEncoding = *@encode(long); return self; } - (instancetype)initWithLongLong: (long long)value { self = [super initWithBytes: &value objCType: @encode(long long)]; _value.signed_ = value; - _typeEncoding = @encode(long long); + _typeEncoding = *@encode(long long); return self; } - (instancetype)initWithUnsignedChar: (unsigned char)value { self = [super initWithBytes: &value objCType: @encode(unsigned char)]; _value.unsigned_ = value; - _typeEncoding = @encode(unsigned long); + _typeEncoding = *@encode(unsigned long); return self; } - (instancetype)initWithUnsignedShort: (unsigned short)value { self = [super initWithBytes: &value objCType: @encode(unsigned short)]; _value.unsigned_ = value; - _typeEncoding = @encode(unsigned short); + _typeEncoding = *@encode(unsigned short); return self; } - (instancetype)initWithUnsignedInt: (unsigned int)value { self = [super initWithBytes: &value objCType: @encode(unsigned int)]; _value.unsigned_ = value; - _typeEncoding = @encode(unsigned int); + _typeEncoding = *@encode(unsigned int); return self; } - (instancetype)initWithUnsignedLong: (unsigned long)value { self = [super initWithBytes: &value objCType: @encode(unsigned long)]; _value.unsigned_ = value; - _typeEncoding = @encode(unsigned long); + _typeEncoding = *@encode(unsigned long); return self; } - (instancetype)initWithUnsignedLongLong: (unsigned long long)value @@ -197,38 +197,38 @@ { self = [super initWithBytes: &value objCType: @encode(unsigned long long)]; _value.unsigned_ = value; - _typeEncoding = @encode(unsigned long long); + _typeEncoding = *@encode(unsigned long long); return self; } - (instancetype)initWithFloat: (float)value { self = [super initWithBytes: &value objCType: @encode(float)]; _value.float_ = value; - _typeEncoding = @encode(float); + _typeEncoding = *@encode(float); return self; } - (instancetype)initWithDouble: (double)value { self = [super initWithBytes: &value objCType: @encode(double)]; _value.float_ = value; - _typeEncoding = @encode(double); + _typeEncoding = *@encode(double); return self; } - (const char *)objCType { - return _typeEncoding; + return &_typeEncoding; } - (long long)longLongValue { if (isFloat(self)) Index: src/OFConcreteValue.h ================================================================== --- src/OFConcreteValue.h +++ src/OFConcreteValue.h @@ -19,10 +19,10 @@ @interface OFConcreteValue: OFValue { size_t _size; void *_bytes; - const char *_objCType; + char *_objCType; } @end OF_ASSUME_NONNULL_END Index: src/OFConcreteValue.m ================================================================== --- src/OFConcreteValue.m +++ src/OFConcreteValue.m @@ -13,10 +13,11 @@ * file. */ #import "OFConcreteValue.h" #import "OFMethodSignature.h" +#import "OFString.h" #import "OFOutOfRangeException.h" @implementation OFConcreteValue @synthesize objCType = _objCType; @@ -26,13 +27,12 @@ { self = [super initWithBytes: bytes objCType: objCType]; @try { _size = OFSizeOfTypeEncoding(objCType); - _objCType = objCType; + _objCType = OFStrDup(objCType); _bytes = OFAllocMemory(1, _size); - memcpy(_bytes, bytes, _size); } @catch (id e) { [self release]; @throw e; } @@ -41,10 +41,11 @@ } - (void)dealloc { OFFreeMemory(_bytes); + OFFreeMemory(_objCType); [super dealloc]; } - (void)getValue: (void *)value size: (size_t)size