Fixed a bug in pointer coercion which was breaking string functions.
git-svn-id: http://picoc.googlecode.com/svn/trunk@350 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
1239d6d8a8
commit
b0c74d8c00
|
@ -246,7 +246,7 @@ void GenericPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct
|
|||
NextArg = (struct Value *)((char *)NextArg + sizeof(struct Value) + TypeStackSizeValue(NextArg));
|
||||
if (NextArg->Typ != FormatType &&
|
||||
!((FormatType == &IntType || *FPos == 'f') && IS_NUMERIC_COERCIBLE(NextArg)) &&
|
||||
!(FormatType == CharPtrType && ( (NextArg->Typ->Base == TypePointer && NextArg->Typ->FromType->Base == TypeArray && NextArg->Typ->FromType->FromType->Base == TypeChar) ||
|
||||
!(FormatType == CharPtrType && (NextArg->Typ->Base == TypePointer ||
|
||||
(NextArg->Typ->Base == TypeArray && NextArg->Typ->FromType->Base == TypeChar) ) ) )
|
||||
PrintStr("XXX", Stream); /* bad type for format */
|
||||
else
|
||||
|
@ -257,7 +257,7 @@ void GenericPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct
|
|||
{
|
||||
char *Str;
|
||||
|
||||
if (NextArg->Typ == CharPtrType || (NextArg->Typ->Base == TypePointer && NextArg->Typ->FromType->Base == TypeArray && NextArg->Typ->FromType->FromType->Base == TypeChar) )
|
||||
if (NextArg->Typ->Base == TypePointer)
|
||||
{
|
||||
#ifndef NATIVE_POINTERS
|
||||
struct Value *CharArray = NextArg->Val->Pointer.Segment;
|
||||
|
|
|
@ -312,7 +312,7 @@ void ExpressionAssignToPointer(struct ParseState *Parser, struct Value *ToValue,
|
|||
ToValue->Val->Pointer.Offset = 0;
|
||||
DerefVal = FromValue;
|
||||
#else
|
||||
ToValue->Val->NativePointer = FromValue;
|
||||
ToValue->Val->NativePointer = FromValue->Val->Array.Data;
|
||||
#endif
|
||||
}
|
||||
else if (FromValue->Typ->Base == TypePointer && FromValue->Typ->FromType->Base == TypeArray && PointedToType == FromValue->Typ->FromType->FromType)
|
||||
|
|
Loading…
Reference in a new issue