From 955d1422bc614871e99943b80c4a6c8c5fdef8b4 Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Wed, 21 May 2003 02:03:59 +0000 Subject: [PATCH] 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 --- .../translators/tgatranslator/TGATranslator.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/add-ons/translators/tgatranslator/TGATranslator.cpp b/src/add-ons/translators/tgatranslator/TGATranslator.cpp index bc88d35892..10b3305d20 100644 --- a/src/add-ons/translators/tgatranslator/TGATranslator.cpp +++ b/src/add-ons/translators/tgatranslator/TGATranslator.cpp @@ -34,6 +34,7 @@ #include "TGAView.h" #include "StreamBuffer.h" #include +#include // for min()/max() // The input formats that this translator supports. @@ -2329,12 +2330,13 @@ translate_from_tga(BPositionIO *inSource, ssize_t amtread, uint8 *read, // if the user only wants the header, // bail before it is written return result; - - uint8 buf[1024]; - ssize_t rd = inSource->Read(buf, rd); + + const int32 kbuflen = 1024; + uint8 buf[kbuflen]; + ssize_t rd = inSource->Read(buf, kbuflen); while (rd > 0) { outDestination->Write(buf, rd); - rd = inSource->Read(buf, rd); + rd = inSource->Read(buf, kbuflen); } if (rd == 0) return B_OK;