On 29 Apr 2000, Marcus Sundberg wrote:

> Andrew Apted <[EMAIL PROTECTED]> writes:
> 
> > That's what the code does (see defaults/stubs/gtext.c).  It could be a
> > doc error.  Personally I think this return value is pretty non-useful,
> > and it should just return 0 when successful.
> 
> Well, it could be useful to do:
> while (str < strend) {
>         cnt = ggiPuts(vis, x, y, str);
>         y += fontheight;
>         str += cnt;
> }
> But on the other hand the performance hit if we implement it to make
> the above possible will be noticable if you have HW clipping, so I
> also think we should just make it return 0.

OK - I have made a patch (attached). Is it ok?


Christoph Egger
E-Mail: [EMAIL PROTECTED]
--- gtext.c.old Sat Apr 29 17:38:20 2000
+++ gtext.c     Sat Apr 29 17:40:12 2000
@@ -74,20 +74,20 @@
 
 int GGI_stubs_puts(ggi_visual *vis, int x, int y, const char *str)
 {
-       int count;
+       int err = 0;
        int char_w, char_h;
 
-       ggiGetCharSize(vis, &char_w, &char_h);
+       err = ggiGetCharSize(vis, &char_w, &char_h);
        
        /* vertically out of the clipping area ? */
 
        if ((y+char_h < LIBGGI_GC(vis)->cliptl.y) ||
            (y >= LIBGGI_GC(vis)->clipbr.y)) {
 
-               return 0;
+               return err;
        }
            
-       for (count=0; *str && (x < LIBGGI_VIRTX(vis));
+       for (*str && (x < LIBGGI_VIRTX(vis));
             str++, x += char_w) {
 
                /* horizontally within the clipping area ? */
@@ -95,10 +95,9 @@
                if ((x+char_w >= LIBGGI_GC(vis)->cliptl.x) &&
                    (x < LIBGGI_GC(vis)->clipbr.x)) {
 
-                       ggiPutc(vis, x, y, *str); 
-                       count++;
+                       err = ggiPutc(vis, x, y, *str); 
                }
        }
 
-       return count;
+       return err;
 }

Reply via email to