fix compare, reported by Cameron Patrick
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7023 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
19613c8909
commit
e69c547289
1 changed files with 4 additions and 4 deletions
|
|
@ -129,11 +129,11 @@ PySwigObject_compare(PySwigObject *v, PySwigObject *w)
|
|||
{
|
||||
int c = strcmp(v->desc, w->desc);
|
||||
if (c) {
|
||||
return c;
|
||||
return (c > 0) ? 1 : -1;
|
||||
} else {
|
||||
void *i = v->ptr;
|
||||
void *j = w->ptr;
|
||||
return (i < j) ? -1 : (i > j) ? 1 : 0;
|
||||
return (i < j) ? -1 : ((i > j) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -310,11 +310,11 @@ PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
|
|||
{
|
||||
int c = strcmp(v->desc, w->desc);
|
||||
if (c) {
|
||||
return c;
|
||||
return (c > 0) ? 1 : -1;
|
||||
} else {
|
||||
size_t i = v->size;
|
||||
size_t j = w->size;
|
||||
int s = (i < j) ? -1 : (i > j) ? 1 : 0;
|
||||
int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
|
||||
return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue