tt/mini_isam: explicitly declare compfunc parameters
qsort() needs compfunc(const void *, const void *) instead of (char *, char *)
This commit is contained in:
parent
f0be964d6c
commit
37aaaf424e
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue