Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -321,18 +321,23 @@ { self = [super init]; @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + union { + double d; + uint64_t u; + } d; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; - seconds = [element doubleValue]; + d.u = (uint64_t)[element hexadecimalValue]; + seconds = of_bswap_double_if_le(d.d); [pool release]; } @catch (id e) { [self release]; @throw e; @@ -408,14 +413,21 @@ - (OFXMLElement*)XMLElementBySerializing { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFXMLElement *element; + union { + double d; + uint64_t u; + } d; element = [OFXMLElement elementWithName: [self className] namespace: OF_SERIALIZATION_NS]; - [element setStringValue: [OFString stringWithFormat: @"%la", seconds]]; + + d.d = of_bswap_double_if_le(seconds); + [element setStringValue: + [OFString stringWithFormat: @"%016" PRIx64, d.u]]; [element retain]; [pool release]; [element autorelease]; Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -750,15 +750,29 @@ value.uintmax = [element decimalValue]; } else if ([typeString isEqual: @"signed"]) { type = OF_NUMBER_INTMAX; value.intmax = [element decimalValue]; } else if ([typeString isEqual: @"float"]) { + union { + float f; + uint32_t u; + } f; + + f.u = (uint32_t)[element hexadecimalValue]; + type = OF_NUMBER_FLOAT; - value.float_ = [element floatValue]; + value.float_ = of_bswap_float_if_le(f.f); } else if ([typeString isEqual: @"double"]) { + union { + double d; + uint64_t u; + } d; + + d.u = (uint64_t)[element hexadecimalValue]; + type = OF_NUMBER_DOUBLE; - value.double_ = [element doubleValue]; + value.double_ = of_bswap_double_if_le(d.d); } else @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; @@ -1237,21 +1251,35 @@ case OF_NUMBER_INTPTR:; [element addAttributeWithName: @"type" stringValue: @"signed"]; break; case OF_NUMBER_FLOAT:; + union { + float f; + uint32_t u; + } f; + + f.f = of_bswap_float_if_le(value.float_); + [element addAttributeWithName: @"type" stringValue: @"float"]; [element setStringValue: - [OFString stringWithFormat: @"%a", value.float_]]; + [OFString stringWithFormat: @"%08" PRIx32, f.u]]; break; case OF_NUMBER_DOUBLE:; + union { + double d; + uint64_t u; + } d; + + d.d = of_bswap_double_if_le(value.double_); + [element addAttributeWithName: @"type" stringValue: @"double"]; [element setStringValue: - [OFString stringWithFormat: @"%la", value.double_]]; + [OFString stringWithFormat: @"%016" PRIx64, d.u]]; break; default: @throw [OFInvalidFormatException exceptionWithClass: [self class]]; Index: src/OFObject+Serialization.m ================================================================== --- src/OFObject+Serialization.m +++ src/OFObject+Serialization.m @@ -44,11 +44,11 @@ element = [(id)self XMLElementBySerializing]; root = [OFXMLElement elementWithName: @"serialization" namespace: OF_SERIALIZATION_NS]; [root addAttributeWithName: @"version" - stringValue: @"0"]; + stringValue: @"1"]; [root addChild: element]; ret = [@"\n" stringByAppendingString: [root XMLStringWithIndentation: 2]]; Index: src/OFString+Serialization.m ================================================================== --- src/OFString+Serialization.m +++ src/OFString+Serialization.m @@ -55,11 +55,11 @@ if (version == nil) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; - if ([version decimalValue] > 0) + if ([version decimalValue] != 1) @throw [OFUnsupportedVersionException exceptionWithClass: [self class] version: version]; elements = [root elementsForNamespace: OF_SERIALIZATION_NS]; Index: src/asprintf.m ================================================================== --- src/asprintf.m +++ src/asprintf.m @@ -18,14 +18,10 @@ #include #include #include -#ifdef __MINGW32__ -# define vsnprintf _vsnprintf -#endif - int vasprintf(char **cString, const char *format, va_list arguments) { int length; Index: tests/serialization.xml ================================================================== --- tests/serialization.xml +++ tests/serialization.xml @@ -1,16 +1,16 @@ - + Qu"xbar test 1234 - 0x1.34a456d5cfaadp+10 + adfa5c6d454a9340 asd - 0x1.34a456d5cfaadp+10 + adfa5c6d454a9340 Hello