fixed TGA to TGA translation so that it no longer fails to write the entire file

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3274 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber 2003-05-21 02:03:59 +00:00
parent 59cd2ee4ef
commit 955d1422bc

View File

@ -34,6 +34,7 @@
#include "TGAView.h" #include "TGAView.h"
#include "StreamBuffer.h" #include "StreamBuffer.h"
#include <SupportDefs.h> #include <SupportDefs.h>
#include <OS.h>
// for min()/max() // for min()/max()
// The input formats that this translator supports. // The input formats that this translator supports.
@ -2330,11 +2331,12 @@ translate_from_tga(BPositionIO *inSource, ssize_t amtread, uint8 *read,
// bail before it is written // bail before it is written
return result; return result;
uint8 buf[1024]; const int32 kbuflen = 1024;
ssize_t rd = inSource->Read(buf, rd); uint8 buf[kbuflen];
ssize_t rd = inSource->Read(buf, kbuflen);
while (rd > 0) { while (rd > 0) {
outDestination->Write(buf, rd); outDestination->Write(buf, rd);
rd = inSource->Read(buf, rd); rd = inSource->Read(buf, kbuflen);
} }
if (rd == 0) if (rd == 0)
return B_OK; return B_OK;