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/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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 } | 72 } |
73 | 73 |
74 void _TIFFmemcpy(void* des, const void* src, tmsize_t size) { | 74 void _TIFFmemcpy(void* des, const void* src, tmsize_t size) { |
75 FXSYS_memcpy(des, src, (size_t)size); | 75 FXSYS_memcpy(des, src, (size_t)size); |
76 } | 76 } |
77 | 77 |
78 int _TIFFmemcmp(const void* ptr1, const void* ptr2, tmsize_t size) { | 78 int _TIFFmemcmp(const void* ptr1, const void* ptr2, tmsize_t size) { |
79 return FXSYS_memcmp(ptr1, ptr2, (size_t)size); | 79 return FXSYS_memcmp(ptr1, ptr2, (size_t)size); |
80 } | 80 } |
81 | 81 |
82 int _TIFFIfMultiplicationOverflow(tmsize_t op1, tmsize_t op2) { | |
Tom Sepez
2016/08/26 23:05:28
Should be bool return value. Also, we return true
tracy_jiang
2016/08/26 23:44:16
We will change the naming logic. It made sense to
| |
83 return op1 <= std::numeric_limits<tmsize_t>::max() / op2; | |
84 } | |
85 | |
82 TIFFErrorHandler _TIFFwarningHandler = nullptr; | 86 TIFFErrorHandler _TIFFwarningHandler = nullptr; |
83 TIFFErrorHandler _TIFFerrorHandler = nullptr; | 87 TIFFErrorHandler _TIFFerrorHandler = nullptr; |
84 | 88 |
85 namespace { | 89 namespace { |
86 | 90 |
87 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) { |
88 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; | 92 CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; |
89 if (!pTiffContext->io_in()->ReadBlock(buf, pTiffContext->offset(), length)) | 93 if (!pTiffContext->io_in()->ReadBlock(buf, pTiffContext->offset(), length)) |
90 return 0; | 94 return 0; |
91 | 95 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 } | 455 } |
452 | 456 |
453 bool CCodec_TiffModule::Decode(CCodec_TiffContext* ctx, | 457 bool CCodec_TiffModule::Decode(CCodec_TiffContext* ctx, |
454 class CFX_DIBitmap* pDIBitmap) { | 458 class CFX_DIBitmap* pDIBitmap) { |
455 return ctx->Decode(pDIBitmap); | 459 return ctx->Decode(pDIBitmap); |
456 } | 460 } |
457 | 461 |
458 void CCodec_TiffModule::DestroyDecoder(CCodec_TiffContext* ctx) { | 462 void CCodec_TiffModule::DestroyDecoder(CCodec_TiffContext* ctx) { |
459 delete ctx; | 463 delete ctx; |
460 } | 464 } |
OLD | NEW |