fix possibility of saving incomplete .tga screenshots if the entire thing wasn't...
authorBradley Bell <btb@icculus.org>
Sat, 22 May 2004 07:55:34 +0000 (07:55 +0000)
committerBradley Bell <btb@icculus.org>
Sat, 22 May 2004 07:55:34 +0000 (07:55 +0000)
ChangeLog
arch/ogl/gr.c

index c482bb9..45d4140 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2004-05-22  Matthew Mueller  <donut@dakotacom.net>
 
+       * arch/ogl/gr.c: fix possibility of saving incomplete .tga
+       screenshots if the entire thing wasn't written in one call to
+       write() (d1x r1.35)
+
        * arch/win32/digi.c: fix persistent sounds (fans, etc) volume/pan
        info not being updated on win32 (d1x r1.11)
 
index 1f8a113..a3d278f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: gr.c,v 1.25 2004-05-20 23:38:18 btb Exp $ */
+/* $Id: gr.c,v 1.26 2004-05-22 07:55:34 btb Exp $ */
 /*
  *
  * OGL video functions. - Added 9/15/99 Matthew Mueller
@@ -713,7 +713,8 @@ void write_bmp(char *savename,int w,int h,unsigned char *buf){
                        }
                }
                x=0;y=w*h*3;
-               while (x<y){
+               while (y > 0)
+               {
                        r=write(f,buf+x,y);
                        if (r<=0){
                                mprintf((0,"screenshot error, couldn't write to %s (err %i)\n",savename,errno));