* Use buffered I/O instead of stream directly since you cannot know the

caller does it for you (ShowImage apparently does).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28663 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-11-16 21:25:07 +00:00
parent 1b21be7091
commit 554bfd699c
@@ -1,5 +1,5 @@
/* /*
* Copyright 2007, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2007-2008, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -8,6 +8,7 @@
#include "ConfigView.h" #include "ConfigView.h"
#include "RAW.h" #include "RAW.h"
#include <BufferIO.h>
#include <Messenger.h> #include <Messenger.h>
#include <TranslatorRoster.h> #include <TranslatorRoster.h>
@@ -117,7 +118,8 @@ RAWTranslator::DerivedIdentify(BPositionIO *stream,
if (outType != B_TRANSLATOR_BITMAP) if (outType != B_TRANSLATOR_BITMAP)
return B_NO_TRANSLATOR; return B_NO_TRANSLATOR;
DCRaw raw(*stream); BBufferIO io(stream, 128 * 1024, false);
DCRaw raw(io);
status_t status; status_t status;
try { try {
@@ -177,7 +179,7 @@ RAWTranslator::_ProgressMonitor(const char* message, float percentage,
status_t status_t
RAWTranslator::DerivedTranslate(BPositionIO* source, RAWTranslator::DerivedTranslate(BPositionIO* stream,
const translator_info* info, BMessage* settings, const translator_info* info, BMessage* settings,
uint32 outType, BPositionIO* target, int32 baseType) uint32 outType, BPositionIO* target, int32 baseType)
{ {
@@ -186,7 +188,8 @@ RAWTranslator::DerivedTranslate(BPositionIO* source,
if (outType != B_TRANSLATOR_BITMAP || baseType != 0) if (outType != B_TRANSLATOR_BITMAP || baseType != 0)
return B_NO_TRANSLATOR; return B_NO_TRANSLATOR;
DCRaw raw(*source); BBufferIO io(stream, 1024 * 1024, false);
DCRaw raw(io);
bool headerOnly = false; bool headerOnly = false;
@@ -280,7 +283,7 @@ RAWTranslator::DerivedTranslate(BPositionIO* source,
header.null = 0; header.null = 0;
memcpy(exifBuffer, &header, sizeof(header)); memcpy(exifBuffer, &header, sizeof(header));
if (source->ReadAt(exifOffset, exifBuffer + 16, exifLength) if (io.ReadAt(exifOffset, exifBuffer + 16, exifLength)
== (ssize_t)exifLength) == (ssize_t)exifLength)
settings->AddData("exif", B_RAW_TYPE, exifBuffer, exifLength + 16); settings->AddData("exif", B_RAW_TYPE, exifBuffer, exifLength + 16);