Last active
March 31, 2025 01:34
-
-
Save runlevel5/36ce1c3898c425e44fbf000a20f68df4 to your computer and use it in GitHub Desktop.
Common Desktop Environment: Fix Issort compare function definition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cde/lib/tt/mini_isam/isam_impl.h b/cde/lib/tt/mini_isam/isam_impl.h | |
index 8172077da..c11ac7820 100644 | |
--- a/cde/lib/tt/mini_isam/isam_impl.h | |
+++ b/cde/lib/tt/mini_isam/isam_impl.h | |
@@ -381,7 +381,7 @@ typedef struct issort { | |
/* many records */ | |
int ist_nrecs; /* number of records inserted */ | |
int ist_currec; /* current position */ | |
- int (*ist_compf) (); /* comparison function */ | |
+ int (*ist_compf) (const void *, const void *); /* comparison function */ | |
char *ist_array; /* array of records */ | |
} Issort; | |
diff --git a/cde/lib/tt/mini_isam/isam_prototypes.h b/cde/lib/tt/mini_isam/isam_prototypes.h | |
index 7e91e409d..a13eaac6c 100644 | |
--- a/cde/lib/tt/mini_isam/isam_prototypes.h | |
+++ b/cde/lib/tt/mini_isam/isam_prototypes.h | |
@@ -76,7 +76,7 @@ int _isapplmw(int isfd, char *magicstring); | |
/* isbsearch.c */ | |
char *_isbsearch(char *key, char *table, int nelems, int keylen, | |
- int (*cmpf)(char *, char *)); | |
+ int (*cmpf)(const void *, const void *)); | |
/* isbtree2.c */ | |
void _isbtree_insert(Btree *btree, char *key); | |
@@ -253,7 +253,7 @@ int le_odd(int n); | |
/* iskeycmp.c */ | |
void _iskeycmp_set(Keydesc2 *pkeydesc2, int nparts); | |
-int _iskeycmp(char *lkey, char *rkey); | |
+int _iskeycmp(const void *lkey, const void *rkey); | |
/* iskeyconv.c */ | |
void _iskey_itox(struct keydesc2 *pikdesc, struct keydesc *pxkdesc); | |
@@ -305,7 +305,7 @@ void _issignals_mask(void); | |
void _issignals_unmask(void); | |
/* issort.c */ | |
-Issort *_issort_create(int reclen, int nrecs, int (*compfunc)(char *, char *)); | |
+Issort *_issort_create(int reclen, int nrecs, int (*compfunc)(const void *, const void *)); | |
void _issort_destroy(Issort *srt); | |
void _issort_insert(Issort *srt, char *record); | |
void _issort_sort(Issort *srt); | |
diff --git a/cde/lib/tt/mini_isam/isbsearch.c b/cde/lib/tt/mini_isam/isbsearch.c | |
index 2fae98df9..c72c62ab4 100644 | |
--- a/cde/lib/tt/mini_isam/isbsearch.c | |
+++ b/cde/lib/tt/mini_isam/isbsearch.c | |
@@ -42,7 +42,7 @@ | |
*/ | |
-char *_isbsearch (char *key, char *table, int nelems, int keylen, int (*cmpf) ()) | |
+char *_isbsearch (char *key, char *table, int nelems, int keylen, int (*cmpf) (const void *, const void *)) | |
{ | |
int len,l1,result; /* current length of array to search */ | |
char *p,*low; | |
diff --git a/cde/lib/tt/mini_isam/iskeycmp.c b/cde/lib/tt/mini_isam/iskeycmp.c | |
index 486683adc..a250e4ca3 100644 | |
--- a/cde/lib/tt/mini_isam/iskeycmp.c | |
+++ b/cde/lib/tt/mini_isam/iskeycmp.c | |
@@ -65,7 +65,7 @@ _iskeycmp_set (Keydesc2 *pkeydesc2, int nparts) | |
*/ | |
int | |
-_iskeycmp(char *lkey, char *rkey) | |
+_iskeycmp(const void *lkey, const void *rkey) | |
{ | |
int i, ret; | |
struct keypart2 *p; | |
@@ -73,11 +73,14 @@ _iskeycmp(char *lkey, char *rkey) | |
long llong, rlong; | |
double ldouble, rdouble; | |
+ const char* charLkey = *(const char**)lkey; | |
+ const char* charRkey = *(const char**)rkey; | |
+ | |
ret = 0; | |
for (i = 0, p = _curtab; ret == 0 && i < _ncurtab;i++, p++) { | |
- l = lkey + p->kp2_offset; | |
- r = rkey + p->kp2_offset; | |
+ l = charLkey + p->kp2_offset; | |
+ r = charRkey + p->kp2_offset; | |
switch (p->kp2_type) { | |
case CHARTYPE: | |
diff --git a/cde/lib/tt/mini_isam/issort.c b/cde/lib/tt/mini_isam/issort.c | |
index f5a3e43d9..5edbe7661 100644 | |
--- a/cde/lib/tt/mini_isam/issort.c | |
+++ b/cde/lib/tt/mini_isam/issort.c | |
@@ -49,7 +49,7 @@ extern char *_isunix_malloc(); | |
*/ | |
Issort * | |
-_issort_create(int reclen, int nrecs, int (*compfunc)(char *, char *)) | |
+_issort_create(int reclen, int nrecs, int (*compfunc)(const void *, const void *)) | |
{ | |
Issort *p; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment