Re: Garnome-2.13.2 on Debian Sid



Now that is one piece of ugly code...

[from pan-0.14.2/pan/base/msort.c]
            ...
        
         char *tmp; 
         char *b1, *b2;
        
            ...

          if (s == opsiz && (b1 - (char *) 0) % opsiz == 0)
                /* operating on aligned words.  Use direct word stores. */
                while (n1 > 0 && n2 > 0)
                {
                        if ((*cmp) (b1, b2) <= 0)
                        {
                                --n1;
========>                       *((unsigned long int *) tmp)++ =
========>                              *((unsigned long int *) b1)++;
                        }
                        else
                        {
                                --n2;
========>                       *((unsigned long int *) tmp)++ =
========>                              *((unsigned long int *) b2)++;
                       }
                }
        else


What's going on???

        On each side of the '=' sign:
        * Start out with a pointer to a character.
        * Cast that pointer as a pointer to an unsigned long integer
        * increment the cast pointer
        * dereference the incremented pointer
        
        Now do an assignment

Hmmm... Probably made your compiler unhappy. What to do?  

Below is a patch for msort.c.  Let me know if it solves your problem.


-Joseph



 



On Sun, 2005-12-04 at 13:48 +0100, Olivier Lecarme wrote:
> Yet another error, in pan. Moreover, the Garnome list seems to be broken
> presently.
> 
> make
> [===== NOW BUILDING:	pan-0.14.2	=====]
[snip]

> make[3]: Entering directory `/reserve/garnome-2.13.2/fifth-toe/pan/work/main.d/pan-0.14.2/pan'
> Making all in base
> make[4]: Entering directory `/reserve/garnome-2.13.2/fifth-toe/pan/work/main.d/pan-0.14.2/pan/base'
> cc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -I/home/ol/garnome/include/pan -DGNOMELOCALEDIR=\""/home/ol/garnome/share/locale"\"  -DXTHREADS -I/home/ol/garnome/include/gtk-2.0 -I/home/ol/garnome/lib/gtk-2.0/include -I/home/ol/garnome/include/atk-1.0 -I/home/ol/garnome/include/cairo -I/home/ol/garnome/include/pango-1.0 -I/home/ol/garnome/include -I/home/ol/garnome/include/glib-2.0 -I/home/ol/garnome/lib/glib-2.0/include -I/usr/X11R6/include   -pthread -I/home/ol/garnome/include/glib-2.0 -I/home/ol/garnome/lib/glib-2.0/include   -I/home/ol/garnome/include/libxml2    -I/home/ol/garnome/include  -I/home/ol/garnome/include  -g -I/home/ol/garnome/include -L/home/ol/garnome/lib -O2 -pipe -I. -c msort.c
> msort.c: In function 'msort_with_tmp':
> msort.c:68: error: invalid lvalue in increment
> msort.c:69: error: invalid lvalue in increment
> msort.c:74: error: invalid lvalue in increment
> msort.c:75: error: invalid lvalue in increment
> make[4]: *** [msort.o] Erreur 1
> make[4]: Leaving directory `/reserve/garnome-2.13.2/fifth-toe/pan/work/main.d/pan-0.14.2/pan/base'
> make[3]: *** [all-recursive] Erreur 1
> make[3]: Leaving directory `/reserve/garnome-2.13.2/fifth-toe/pan/work/main.d/pan-0.14.2/pan'
> make[2]: *** [all-recursive] Erreur 1
> make[2]: Leaving directory `/reserve/garnome-2.13.2/fifth-toe/pan/work/main.d/pan-0.14.2'
> make[1]: *** [all-recursive-am] Erreur 2
> make[1]: Leaving directory `/reserve/garnome-2.13.2/fifth-toe/pan/work/main.d/pan-0.14.2'
> make: *** [build-work/main.d/pan-0.14.2/Makefile] Erreur 2
> zsh: exit 2     make
> 
> 
-- 
joseph_sacco [at] comcast [dot] net
--- pan-0.14.2/pan/base/msort.c-	2005-12-04 15:21:42.000000000 -0500
+++ pan-0.14.2/pan/base/msort.c	2005-12-04 15:29:46.000000000 -0500
@@ -43,6 +43,7 @@
 	char *tmp;
 	char *b1, *b2;
 	size_t n1, n2;
+	unsigned long *ul, *ul1;
 	const int opsiz = sizeof(unsigned long int);
 
 	if (n <= 1)
@@ -65,14 +66,20 @@
 			if ((*cmp) (b1, b2) <= 0)
 			{
 				--n1;
-				*((unsigned long int *) tmp)++ =
-					*((unsigned long int *) b1)++;
+				ul = (unsigned long *)tmp;
+				ul1 = (unsigned long *)b1;
+				ul++;
+				ul1++;
+				*ul = *ul1;
 			}
 			else
 			{
 				--n2;
-				*((unsigned long int *) tmp)++ =
-					*((unsigned long int *) b2)++;
+				ul = (unsigned long *)tmp;
+				ul1 = (unsigned long *)b2;
+				ul++;
+				ul1++;
+				*ul = *ul1;
 			}
 		}
 	else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]