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 "../../../include/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
8 extern const FX_LPCSTR _PDF_CharType = | 8 extern const FX_LPCSTR _PDF_CharType = |
9 "WRRRRRRRRWWRWWRRRRRRRRRRRRRRRRRR" | 9 "WRRRRRRRRWWRWWRRRRRRRRRRRRRRRRRR" |
10 "WRRRRDRRDDRNRNNDNNNNNNNNNNRRDRDR" | 10 "WRRRRDRRDDRNRNNDNNNNNNNNNNRRDRDR" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 i += 2; | 277 i += 2; |
278 } else { | 278 } else { |
279 *pDest ++ = pSrc[i]; | 279 *pDest ++ = pSrc[i]; |
280 } | 280 } |
281 } | 281 } |
282 result.ReleaseBuffer((FX_STRSIZE)(pDest - pDestStart)); | 282 result.ReleaseBuffer((FX_STRSIZE)(pDest - pDestStart)); |
283 return result; | 283 return result; |
284 } | 284 } |
285 CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) | 285 CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) |
286 { | 286 { |
287 if (FXSYS_memchr((FX_LPCSTR)orig, '#', orig.GetLength()) == NULL) { | 287 if (FXSYS_memchr(orig.c_str(), '#', orig.GetLength()) == NULL) { |
288 return orig; | 288 return orig; |
289 } | 289 } |
290 return PDF_NameDecode(CFX_ByteStringC(orig)); | 290 return PDF_NameDecode(CFX_ByteStringC(orig)); |
291 } | 291 } |
292 CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) | 292 CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) |
293 { | 293 { |
294 FX_LPBYTE src_buf = (FX_LPBYTE)(FX_LPCSTR)orig; | 294 FX_LPBYTE src_buf = (FX_LPBYTE)orig.c_str(); |
295 int src_len = orig.GetLength(); | 295 int src_len = orig.GetLength(); |
296 int dest_len = 0; | 296 int dest_len = 0; |
297 int i; | 297 int i; |
298 for (i = 0; i < src_len; i ++) { | 298 for (i = 0; i < src_len; i ++) { |
299 FX_BYTE ch = src_buf[i]; | 299 FX_BYTE ch = src_buf[i]; |
300 if (ch >= 0x80 || _PDF_CharType[ch] == 'W' || ch == '#' || | 300 if (ch >= 0x80 || _PDF_CharType[ch] == 'W' || ch == '#' || |
301 _PDF_CharType[ch] == 'D') { | 301 _PDF_CharType[ch] == 'D') { |
302 dest_len += 3; | 302 dest_len += 3; |
303 } else { | 303 } else { |
304 dest_len ++; | 304 dest_len ++; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 if (pFound) { | 444 if (pFound) { |
445 return pFound; | 445 return pFound; |
446 } | 446 } |
447 } | 447 } |
448 return NULL; | 448 return NULL; |
449 } | 449 } |
450 CPDF_Object* CPDF_NumberTree::LookupValue(int num) | 450 CPDF_Object* CPDF_NumberTree::LookupValue(int num) |
451 { | 451 { |
452 return SearchNumberNode(m_pRoot, num); | 452 return SearchNumberNode(m_pRoot, num); |
453 } | 453 } |
OLD | NEW |