OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" | 7 #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 } | 914 } |
915 | 915 |
916 std::vector<SearchTagRecord> patterns(ntags); | 916 std::vector<SearchTagRecord> patterns(ntags); |
917 uint32_t start = 0; | 917 uint32_t start = 0; |
918 uint32_t itag = 0; | 918 uint32_t itag = 0; |
919 uint32_t max_len = 0; | 919 uint32_t max_len = 0; |
920 for (int i = 0; i <= tags.GetLength(); ++i) { | 920 for (int i = 0; i <= tags.GetLength(); ++i) { |
921 if (tags[i] == 0) { | 921 if (tags[i] == 0) { |
922 uint32_t len = i - start; | 922 uint32_t len = i - start; |
923 max_len = std::max(len, max_len); | 923 max_len = std::max(len, max_len); |
924 patterns[itag].m_pTag = tags.GetCStr() + start; | 924 patterns[itag].m_pTag = tags.c_str() + start; |
925 patterns[itag].m_Len = len; | 925 patterns[itag].m_Len = len; |
926 patterns[itag].m_Offset = 0; | 926 patterns[itag].m_Offset = 0; |
927 start = i + 1; | 927 start = i + 1; |
928 ++itag; | 928 ++itag; |
929 } | 929 } |
930 } | 930 } |
931 | 931 |
932 const FX_FILESIZE pos_limit = m_Pos + limit; | 932 const FX_FILESIZE pos_limit = m_Pos + limit; |
933 for (FX_FILESIZE pos = m_Pos; !limit || pos < pos_limit; ++pos) { | 933 for (FX_FILESIZE pos = m_Pos; !limit || pos < pos_limit; ++pos) { |
934 uint8_t byte; | 934 uint8_t byte; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 if (limit && m_Pos == limit) | 981 if (limit && m_Pos == limit) |
982 return -1; | 982 return -1; |
983 } | 983 } |
984 return -1; | 984 return -1; |
985 } | 985 } |
986 | 986 |
987 void CPDF_SyntaxParser::SetEncrypt( | 987 void CPDF_SyntaxParser::SetEncrypt( |
988 std::unique_ptr<IPDF_CryptoHandler> pCryptoHandler) { | 988 std::unique_ptr<IPDF_CryptoHandler> pCryptoHandler) { |
989 m_pCryptoHandler = std::move(pCryptoHandler); | 989 m_pCryptoHandler = std::move(pCryptoHandler); |
990 } | 990 } |
OLD | NEW |