Made strcmp() results more consistent for testing
git-svn-id: http://picoc.googlecode.com/svn/trunk@376 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
d2718f62c5
commit
aea16db269
|
@ -450,12 +450,14 @@ void LibStrncpy(struct ParseState *Parser, struct Value *ReturnValue, struct Val
|
|||
|
||||
void LibStrcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||
{
|
||||
ReturnValue->Val->Integer = strcmp(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
||||
int Result = strcmp(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer);
|
||||
ReturnValue->Val->Integer = (Result > 0) ? 1 : ((Result < 0) ? -1 : 0);
|
||||
}
|
||||
|
||||
void LibStrncmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||
{
|
||||
ReturnValue->Val->Integer = strncmp(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
||||
int Result = strncmp(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
||||
ReturnValue->Val->Integer = (Result > 0) ? 1 : ((Result < 0) ? -1 : 0);
|
||||
}
|
||||
|
||||
void LibStrcat(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||
|
@ -490,7 +492,8 @@ void LibMemcpy(struct ParseState *Parser, struct Value *ReturnValue, struct Valu
|
|||
|
||||
void LibMemcmp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
|
||||
{
|
||||
ReturnValue->Val->Integer = memcmp(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
||||
int Result = memcmp(Param[0]->Val->NativePointer, Param[1]->Val->NativePointer, Param[2]->Val->Integer);
|
||||
ReturnValue->Val->Integer = (Result > 0) ? 1 : ((Result < 0) ? -1 : 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ gollo
|
|||
-1
|
||||
5
|
||||
gollo!
|
||||
6
|
||||
1
|
||||
0
|
||||
0
|
||||
-19
|
||||
-1
|
||||
ollo!
|
||||
lo!
|
||||
NULL
|
||||
|
|
Loading…
Reference in a new issue