Index:
[thread]
[date]
[subject]
[author]
From: Andrew Apted <ajapted@netspace.net.au>
To : ggi-develop@eskimo.com
Date: Fri, 17 Jul 1998 23:20:20 +1000
Re: display-tile buglet
Hartmut writes:
> Hi!
> I tried againa wrong display, tile, this time:
>
> export LIBGGI_DISPLAY="tile:0,0,600,300,(x):0,300,600,300,(x):600,0,300,600"
> > a.out
> display-tile: Opening of target rox/mystique-8-15-16-32.so failed.
Same problem here (same name too: rox/mystique... !).
The problem appears to be something not-nice about sscanf. In
display/tile/visual.c there is :
if(sscanf(args, "%d,%d,%d,%d,%n", &sx, &sy, &vx, &vy, &n)!=4)
The manpage for sscanf says that the number of successful conversions is
returned. What happens (I suspect) is that even missing the last comma
still returns 4 -- but there really was an error and the %n never gets
set (which shoots us off into lala land).
Checking it now...
Yep, that was it. Below is a patch that fixes the problem. Steve, look
alright to you ?
Cheers,
_____________________________________________ ____
\ /
Andrew Apted <andrew@ggi-project.org> \/
--- display/tile/visual.c.old Fri Jul 17 23:05:31 1998
+++ display/tile/visual.c Fri Jul 17 23:06:12 1998
@@ -63,7 +63,9 @@
sx = sy = vx = vy = 0;
- if(sscanf(args, "%d,%d,%d,%d,%n", &sx, &sy, &vx, &vy, &n)!=4) {
+ if ((sscanf(args, "%d,%d,%d,%d%n", &sx, &sy,
+ &vx, &vy, &n) != 4) || (args+=n, *args != ',')) {
+
fprintf(stderr, "display-tile: The argument format is \"offx,offy,sizex,sizey,(subdisplay):...\",\n"
" where offx and offy are the tile's offset from the main display,\n"
" sizex and sizey are the size of the tile,\n"
@@ -72,7 +74,7 @@
return GGI_DL_ERROR;
}
- args+=n;
+ args++; /* skip comma */
tilehook->vis_origins[i].x = sx;
tilehook->vis_origins[i].y = sy;
--- display/common/parsing.inc.old Fri Jul 17 23:09:35 1998
+++ display/common/parsing.inc Fri Jul 17 23:11:43 1998
@@ -38,6 +38,12 @@
int bracketized=0;
int bracket_count=0;
+ if (*str == 0) {
+ fprintf(stderr, "libggi: Missing target descriptor !\n");
+ *target = 0;
+ return NULL;
+ }
+
if (*str == '(') {
bracketized=1;
bracket_count++;
Index:
[thread]
[date]
[subject]
[author]