Skip to content

Fix for issue #455 #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extras/win32vc2005/freeglut-2.2.0/src/freeglut_structure.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,9 @@ void fgListRemove(SFG_List *list, SFG_Node *node)
{
SFG_Node *ln;

if( ln = (SFG_Node *)node->Next )
if( (ln = (SFG_Node *)node->Next) )
ln->Prev = node->Prev;
if( ln = (SFG_Node *)node->Prev )
if( (ln = (SFG_Node *)node->Prev) )
ln->Next = node->Next;
if( (ln = (SFG_Node *)list->First) == node )
list->First = node->Next;
Expand Down
45 changes: 23 additions & 22 deletions libs/basekit/source/UArray.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ license: See _BSDLicense.txt.
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdbool.h>
#include <limits.h>

size_t CTYPE_size(CTYPE type) {
Expand Down Expand Up @@ -919,9 +920,9 @@ void UArray_at_putAll_(UArray *self, size_t pos, const UArray *other) {
TYPE1 v1 = ((TYPE1 *)self->data)[i]; \
TYPE2 v2 = ((TYPE2 *)other->data)[i]; \
if (v1 != v2) \
return 0; \
return false; \
} \
return 1; \
return true; \
}

#define UARRAY_GT_TYPES(OP2, TYPE1, self, TYPE2, other) \
Expand All @@ -932,9 +933,9 @@ void UArray_at_putAll_(UArray *self, size_t pos, const UArray *other) {
TYPE1 v1 = ((TYPE1 *)self->data)[i]; \
TYPE2 v2 = ((TYPE2 *)other->data)[i]; \
if (v1 < v2) \
return 0; \
return false; \
} \
return 1; \
return true; \
}

#define UARRAY_LT_TYPES(OP2, TYPE1, self, TYPE2, other) \
Expand All @@ -945,9 +946,9 @@ void UArray_at_putAll_(UArray *self, size_t pos, const UArray *other) {
TYPE1 v1 = ((TYPE1 *)self->data)[i]; \
TYPE2 v2 = ((TYPE2 *)other->data)[i]; \
if (v1 > v2) \
return 0; \
return false; \
} \
return 1; \
return true; \
}

int UArray_compare_(const UArray *self, const UArray *other) {
Expand All @@ -971,56 +972,56 @@ int UArray_compare_(const UArray *self, const UArray *other) {
return 0;
}

int UArray_equals_(const UArray *self, const UArray *other) {
bool UArray_equals_(const UArray *self, const UArray *other) {
if (self->size != other->size)
return 0;
return false;
DUARRAY_OP(UARRAY_EQ_TYPES, NULL, self, other);
return 0;
return false;
}

int UArray_greaterThan_(const UArray *self, const UArray *other) {
bool UArray_greaterThan_(const UArray *self, const UArray *other) {
if (self->encoding == CENCODING_NUMBER) {
DUARRAY_OP(UARRAY_GT_TYPES, NULL, self, other);
}

return UArray_compare_(self, other) > 0;
}

int UArray_lessThan_(const UArray *self, const UArray *other) {
bool UArray_lessThan_(const UArray *self, const UArray *other) {
if (self->encoding == CENCODING_NUMBER) {
DUARRAY_OP(UARRAY_LT_TYPES, NULL, self, other);
}

return UArray_compare_(self, other) < 0;
}

int UArray_greaterThanOrEqualTo_(const UArray *self, const UArray *other) {
bool UArray_greaterThanOrEqualTo_(const UArray *self, const UArray *other) {
if (self->encoding == CENCODING_NUMBER) {
if (UArray_greaterThan_(self, other) | UArray_equals_(self, other)) {
return 1;
if (UArray_greaterThan_(self, other) || UArray_equals_(self, other)) {
return true;
} else {
return 0;
return false;
}
}

return UArray_compare_(self, other) >= 0;
}

int UArray_lessThanOrEqualTo_(const UArray *self, const UArray *other) {
bool UArray_lessThanOrEqualTo_(const UArray *self, const UArray *other) {
if (self->encoding == CENCODING_NUMBER) {
if (UArray_lessThan_(self, other) | UArray_equals_(self, other)) {
return 1;
if (UArray_lessThan_(self, other) || UArray_equals_(self, other)) {
return true;
} else {
return 0;
return false;
}
}

return UArray_compare_(self, other) <= 0;
}

int UArray_isZero(const UArray *self) {
UARRAY_FOREACH(self, i, v, if (v) return 0;)
return 1;
bool UArray_isZero(const UArray *self) {
UARRAY_FOREACH(self, i, v, if (v) return false;)
return true;
}

// find
Expand Down
17 changes: 9 additions & 8 deletions libs/basekit/source/UArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "Common.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stddef.h>

Expand Down Expand Up @@ -165,14 +166,14 @@ BASEKIT_API UArray *UArray_slice(const UArray *self, long start, long end);
// compare

BASEKIT_API int UArray_compare_(const UArray *self, const UArray *other);
BASEKIT_API int UArray_equals_(const UArray *self, const UArray *other);
BASEKIT_API int UArray_greaterThan_(const UArray *self, const UArray *other);
BASEKIT_API int UArray_lessThan_(const UArray *self, const UArray *other);
BASEKIT_API int UArray_greaterThanOrEqualTo_(const UArray *self,
const UArray *other);
BASEKIT_API int UArray_lessThanOrEqualTo_(const UArray *self,
const UArray *other);
BASEKIT_API int UArray_isZero(const UArray *self);
BASEKIT_API bool UArray_equals_(const UArray *self, const UArray *other);
BASEKIT_API bool UArray_greaterThan_(const UArray *self, const UArray *other);
BASEKIT_API bool UArray_lessThan_(const UArray *self, const UArray *other);
BASEKIT_API bool UArray_greaterThanOrEqualTo_(const UArray *self,
const UArray *other);
BASEKIT_API bool UArray_lessThanOrEqualTo_(const UArray *self,
const UArray *other);
BASEKIT_API bool UArray_isZero(const UArray *self);

// contains

Expand Down