([BinaryCStream -encodeValueOfCType:at:withName:]): [_C_CHARPTR]:

Don't autorelease the malloc'ed pointer here; thus the behavior is
analogous to decoding an object: it gives you a reference, it is the
callers responsibility to free it.
([BinaryCStream -decodeValueOfCType:at:withName:]): [_C_DBL]: Fix
typo.  Use mantissa1, not mantissa2 twice.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1289 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1996-03-29 17:53:05 +00:00
parent fca9bcfe2f
commit 5e439ccd99

View file

@ -324,8 +324,9 @@ static BOOL debug_binary_coder;
length: length]; length: length];
assert (read_count == length); assert (read_count == length);
(*(char**)d)[length] = '\0'; (*(char**)d)[length] = '\0';
/* Autorelease the newly malloc'ed pointer. */ /* Autorelease the newly malloc'ed pointer? Grep for (*objc_free)
[MallocAddress autoreleaseMallocAddress: *(char**)d]; to see the places the may have to be changed
[MallocAddress autoreleaseMallocAddress: *(char**)d]; */
break; break;
} }
@ -373,13 +374,13 @@ static BOOL debug_binary_coder;
case _C_DBL: case _C_DBL:
{ {
int exp, mantissa1, mantissa2; int exp, mantissa1, mantissa2;
double value; volatile double value;
/* Decode the exponent and the two pieces of the mantissa. */ /* Decode the exponent and the two pieces of the mantissa. */
READ_SIGNED_TYPE (&exp, int, ntohl); READ_SIGNED_TYPE (&exp, int, ntohl);
READ_SIGNED_TYPE (&mantissa1, int, ntohl); READ_SIGNED_TYPE (&mantissa1, int, ntohl);
READ_SIGNED_TYPE (&mantissa2, int, ntohl); READ_SIGNED_TYPE (&mantissa2, int, ntohl);
/* Assemble them into a double */ /* Assemble them into a double */
value = ((mantissa2 / FLOAT_FACTOR) + mantissa2) / FLOAT_FACTOR; value = ((mantissa2 / FLOAT_FACTOR) + mantissa1) / FLOAT_FACTOR;
value = ldexp (value, exp); value = ldexp (value, exp);
/* Put the double into the requested memory location. */ /* Put the double into the requested memory location. */
*(double*)d = value; *(double*)d = value;