Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: core/fxcodec/codec/fx_codec_tiff.cpp

Issue 2430743003: in the attempt to fix 627393, changed IFX_FileRead's readBlock to return the length it reads
Patch Set: remove .tmp files Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fxcodec/codec/codec_int.h" 7 #include "core/fxcodec/codec/codec_int.h"
8 #include "core/fxcodec/include/fx_codec.h" 8 #include "core/fxcodec/include/fx_codec.h"
9 #include "core/fxge/include/fx_dib.h" 9 #include "core/fxge/include/fx_dib.h"
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return op1 > std::numeric_limits<tmsize_t>::max() / op2; 83 return op1 > std::numeric_limits<tmsize_t>::max() / op2;
84 } 84 }
85 85
86 TIFFErrorHandler _TIFFwarningHandler = nullptr; 86 TIFFErrorHandler _TIFFwarningHandler = nullptr;
87 TIFFErrorHandler _TIFFerrorHandler = nullptr; 87 TIFFErrorHandler _TIFFerrorHandler = nullptr;
88 88
89 namespace { 89 namespace {
90 90
91 tsize_t tiff_read(thandle_t context, tdata_t buf, tsize_t length) { 91 tsize_t tiff_read(thandle_t context, tdata_t buf, tsize_t length) {
92 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; 92 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context;
93 if (!pTiffContext->io_in()->ReadBlock(buf, pTiffContext->offset(), length)) 93 size_t readSize =
94 pTiffContext->io_in()->ReadBlock(buf, pTiffContext->offset(), length);
95 if (readSize != static_cast<size_t>(length) &&
96 !pTiffContext->io_in()->IsEOF())
94 return 0; 97 return 0;
95 98
96 pTiffContext->increment_offset(length); 99 pTiffContext->increment_offset(readSize);
97 return length; 100 return readSize;
98 } 101 }
99 102
100 tsize_t tiff_write(thandle_t context, tdata_t buf, tsize_t length) { 103 tsize_t tiff_write(thandle_t context, tdata_t buf, tsize_t length) {
101 ASSERT(false); 104 ASSERT(false);
102 return 0; 105 return 0;
103 } 106 }
104 107
105 toff_t tiff_seek(thandle_t context, toff_t offset, int whence) { 108 toff_t tiff_seek(thandle_t context, toff_t offset, int whence) {
106 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; 109 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context;
107 switch (whence) { 110 switch (whence) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 458 }
456 459
457 bool CCodec_TiffModule::Decode(CCodec_TiffContext* ctx, 460 bool CCodec_TiffModule::Decode(CCodec_TiffContext* ctx,
458 class CFX_DIBitmap* pDIBitmap) { 461 class CFX_DIBitmap* pDIBitmap) {
459 return ctx->Decode(pDIBitmap); 462 return ctx->Decode(pDIBitmap);
460 } 463 }
461 464
462 void CCodec_TiffModule::DestroyDecoder(CCodec_TiffContext* ctx) { 465 void CCodec_TiffModule::DestroyDecoder(CCodec_TiffContext* ctx) {
463 delete ctx; 466 delete ctx;
464 } 467 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698