OLD | NEW |
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/include/fxcodec/fx_codec.h" | 8 #include "core/include/fxcodec/fx_codec.h" |
9 #include "core/include/fxge/fx_dib.h" | 9 #include "core/include/fxge/fx_dib.h" |
10 | 10 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 switch (whence) { | 115 switch (whence) { |
116 case 0: | 116 case 0: |
117 pTiffContext->offset = (FX_DWORD)offset; | 117 pTiffContext->offset = (FX_DWORD)offset; |
118 break; | 118 break; |
119 case 1: | 119 case 1: |
120 pTiffContext->offset += (FX_DWORD)offset; | 120 pTiffContext->offset += (FX_DWORD)offset; |
121 break; | 121 break; |
122 case 2: | 122 case 2: |
123 if (pTiffContext->isDecoder) { | 123 if (pTiffContext->isDecoder) { |
124 if (pTiffContext->io.in->GetSize() < (FX_FILESIZE)offset) { | 124 if (pTiffContext->io.in->GetSize() < (FX_FILESIZE)offset) { |
125 return -1; | 125 return static_cast<toff_t>(-1); |
126 } | 126 } |
127 pTiffContext->offset = | 127 pTiffContext->offset = |
128 (FX_DWORD)(pTiffContext->io.in->GetSize() - offset); | 128 (FX_DWORD)(pTiffContext->io.in->GetSize() - offset); |
129 } else { | 129 } else { |
130 if (pTiffContext->io.out->GetSize() < (FX_FILESIZE)offset) { | 130 if (pTiffContext->io.out->GetSize() < (FX_FILESIZE)offset) { |
131 return -1; | 131 return static_cast<toff_t>(-1); |
132 } | 132 } |
133 pTiffContext->offset = | 133 pTiffContext->offset = |
134 (FX_DWORD)(pTiffContext->io.out->GetSize() - offset); | 134 (FX_DWORD)(pTiffContext->io.out->GetSize() - offset); |
135 } | 135 } |
136 break; | 136 break; |
137 default: | 137 default: |
138 return -1; | 138 return static_cast<toff_t>(-1); |
139 } | 139 } |
140 ASSERT(pTiffContext->isDecoder ? (pTiffContext->offset <= | 140 ASSERT(pTiffContext->isDecoder ? (pTiffContext->offset <= |
141 (FX_DWORD)pTiffContext->io.in->GetSize()) | 141 (FX_DWORD)pTiffContext->io.in->GetSize()) |
142 : TRUE); | 142 : TRUE); |
143 return pTiffContext->offset; | 143 return pTiffContext->offset; |
144 } | 144 } |
145 static int _tiff_close(thandle_t context) { | 145 static int _tiff_close(thandle_t context) { |
146 return 0; | 146 return 0; |
147 } | 147 } |
148 static toff_t _tiff_get_size(thandle_t context) { | 148 static toff_t _tiff_get_size(thandle_t context) { |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return pDecoder->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute); | 535 return pDecoder->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute); |
536 } | 536 } |
537 FX_BOOL CCodec_TiffModule::Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) { | 537 FX_BOOL CCodec_TiffModule::Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) { |
538 CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx; | 538 CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx; |
539 return pDecoder->Decode(pDIBitmap); | 539 return pDecoder->Decode(pDIBitmap); |
540 } | 540 } |
541 void CCodec_TiffModule::DestroyDecoder(void* ctx) { | 541 void CCodec_TiffModule::DestroyDecoder(void* ctx) { |
542 CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx; | 542 CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx; |
543 delete pDecoder; | 543 delete pDecoder; |
544 } | 544 } |
OLD | NEW |