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/page/cpdf_streamcontentparser.h" | 7 #include "core/fpdfapi/page/cpdf_streamcontentparser.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 m_ParamCount++; | 317 m_ParamCount++; |
318 return index; | 318 return index; |
319 } | 319 } |
320 | 320 |
321 void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) { | 321 void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) { |
322 CFX_ByteStringC bsName(name, len); | 322 CFX_ByteStringC bsName(name, len); |
323 ContentParam& param = m_ParamBuf[GetNextParamPos()]; | 323 ContentParam& param = m_ParamBuf[GetNextParamPos()]; |
324 if (len > 32) { | 324 if (len > 32) { |
325 param.m_Type = ContentParam::OBJECT; | 325 param.m_Type = ContentParam::OBJECT; |
326 param.m_pObject = new CPDF_Name( | 326 param.m_pObject = |
327 m_pDocument->GetByteStringPool()->Intern(PDF_NameDecode(bsName))); | 327 new CPDF_Name(m_pDocument->GetByteStringPool(), PDF_NameDecode(bsName)); |
328 } else { | 328 } else { |
329 param.m_Type = ContentParam::NAME; | 329 param.m_Type = ContentParam::NAME; |
330 if (bsName.Find('#') == -1) { | 330 if (bsName.Find('#') == -1) { |
331 FXSYS_memcpy(param.m_Name.m_Buffer, name, len); | 331 FXSYS_memcpy(param.m_Name.m_Buffer, name, len); |
332 param.m_Name.m_Len = len; | 332 param.m_Name.m_Len = len; |
333 } else { | 333 } else { |
334 CFX_ByteString str = PDF_NameDecode(bsName); | 334 CFX_ByteString str = PDF_NameDecode(bsName); |
335 FXSYS_memcpy(param.m_Name.m_Buffer, str.c_str(), str.GetLength()); | 335 FXSYS_memcpy(param.m_Name.m_Buffer, str.c_str(), str.GetLength()); |
336 param.m_Name.m_Len = str.GetLength(); | 336 param.m_Name.m_Len = str.GetLength(); |
337 } | 337 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 if (param.m_Type == ContentParam::NUMBER) { | 378 if (param.m_Type == ContentParam::NUMBER) { |
379 CPDF_Number* pNumber = param.m_Number.m_bInteger | 379 CPDF_Number* pNumber = param.m_Number.m_bInteger |
380 ? new CPDF_Number(param.m_Number.m_Integer) | 380 ? new CPDF_Number(param.m_Number.m_Integer) |
381 : new CPDF_Number(param.m_Number.m_Float); | 381 : new CPDF_Number(param.m_Number.m_Float); |
382 | 382 |
383 param.m_Type = ContentParam::OBJECT; | 383 param.m_Type = ContentParam::OBJECT; |
384 param.m_pObject = pNumber; | 384 param.m_pObject = pNumber; |
385 return pNumber; | 385 return pNumber; |
386 } | 386 } |
387 if (param.m_Type == ContentParam::NAME) { | 387 if (param.m_Type == ContentParam::NAME) { |
388 CPDF_Name* pName = new CPDF_Name(m_pDocument->GetByteStringPool()->Intern( | 388 CPDF_Name* pName = new CPDF_Name( |
389 CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len))); | 389 m_pDocument->GetByteStringPool(), |
| 390 CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len)); |
390 param.m_Type = ContentParam::OBJECT; | 391 param.m_Type = ContentParam::OBJECT; |
391 param.m_pObject = pName; | 392 param.m_pObject = pName; |
392 return pName; | 393 return pName; |
393 } | 394 } |
394 if (param.m_Type == ContentParam::OBJECT) { | 395 if (param.m_Type == ContentParam::OBJECT) { |
395 return param.m_pObject; | 396 return param.m_pObject; |
396 } | 397 } |
397 ASSERT(false); | 398 ASSERT(false); |
398 return nullptr; | 399 return nullptr; |
399 } | 400 } |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 } | 1662 } |
1662 default: | 1663 default: |
1663 bProcessed = false; | 1664 bProcessed = false; |
1664 } | 1665 } |
1665 if (!bProcessed) { | 1666 if (!bProcessed) { |
1666 m_pSyntax->SetPos(last_pos); | 1667 m_pSyntax->SetPos(last_pos); |
1667 return; | 1668 return; |
1668 } | 1669 } |
1669 } | 1670 } |
1670 } | 1671 } |
OLD | NEW |