Files
MINGW-packages/mingw-w64-libgda/008-lemon-fix-segfault.patch
Biswapriyo Nath 52ab54422e libgda: Fix ucrt build
Changes:
  * Check for goocanvas 3.0
  * Replace old gtksourceview headers
  * Fix segfault in lemon
2021-07-24 09:50:05 +05:30

103 lines
2.8 KiB
Diff

From 6430e6cd34984e3849454b457a05f7b303df02f1 Mon Sep 17 00:00:00 2001
From: taozuhong <taozuhong@gmail.com>
Date: Thu, 3 Jun 2021 11:23:10 +0800
Subject: [PATCH 15/15] fixed: pointer size warning
---
libgda/sql-parser/lemon.c | 38 ++++++++++++++++++--------------------
1 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/libgda/sql-parser/lemon.c b/libgda/sql-parser/lemon.c
index cf0f3b3eb..2bf0787b8 100644
--- a/libgda/sql-parser/lemon.c
+++ b/libgda/sql-parser/lemon.c
@@ -52,7 +52,7 @@
made_files = NULL;
}
-static char *msort(char*,char**,int(*)(const char*,const char*));
+static uintptr_t msort(uintptr_t, uintptr_t*, int(*)(const uintptr_t, const uintptr_t));
/*
** Compilers are getting increasingly pedantic about type conversions
@@ -408,8 +408,7 @@
static struct action *Action_sort(
struct action *ap
){
- ap = (struct action *)msort((char *)ap,(char **)&ap->next,
- (int(*)(const char*,const char*))actioncmp);
+ ap = (struct action *)msort(ap, &ap->next, actioncmp);
return ap;
}
@@ -1289,14 +1288,14 @@
/* Sort the configuration list */
void Configlist_sort(){
- current = (struct config *)msort((char *)current,(char **)&(current->next),Configcmp);
+ current = (struct config *)msort(current, &(current->next), Configcmp);
currentend = 0;
return;
}
/* Sort the basis configuration list */
void Configlist_sortbasis(){
- basis = (struct config *)msort((char *)current,(char **)&(current->bp),Configcmp);
+ basis = (struct config *)msort(current, &(current->bp), Configcmp);
basisend = 0;
return;
}
@@ -1565,7 +1564,7 @@
/*
** Return a pointer to the next structure in the linked list.
*/
-#define NEXT(A) (*(char**)(((unsigned long)A)+offset))
+#define NEXT(A) (*(uintptr_t *)(((uintptr_t)A)+offset))
/*
** Inputs:
@@ -1582,13 +1581,13 @@
** The "next" pointers for elements in the lists a and b are
** changed.
*/
-static char *merge(
- char *a,
- char *b,
- int (*cmp)(const char*,const char*),
- int offset
+static uintptr_t merge(
+ uintptr_t a,
+ uintptr_t b,
+ int (*cmp)(const uintptr_t, const uintptr_t),
+ uintptr_t offset
){
- char *ptr, *head;
+ uintptr_t ptr, *head;
if( a==0 ){
head = b;
@@ -1634,16 +1633,15 @@
** The "next" pointers for elements in list are changed.
*/
#define LISTSIZE 30
-static char *msort(
- char *list,
- char **next,
- int (*cmp)(const char*,const char*)
+static uintptr_t msort(
+ uintptr_t list,
+ uintptr_t *next,
+ int (*cmp)(const uintptr_t, const uintptr_t)
){
- unsigned long offset;
- char *ep;
- char *set[LISTSIZE];
+ uintptr_t ep;
+ uintptr_t set[LISTSIZE];
int i;
- offset = (unsigned long)next - (unsigned long)list;
+ uintptr_t offset = (uintptr_t)next - (uintptr_t)list;
for(i=0; i<LISTSIZE; i++) set[i] = 0;
while( list ){
ep = list;