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/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
8 #include "../../public/fpdf_doc.h" | 8 #include "../../public/fpdf_doc.h" |
9 | 9 |
10 static int THISMODULE = 0; | 10 static int THISMODULE = 0; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 | 243 |
244 DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) | 244 DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) |
245 { | 245 { |
246 if(!linkAnnot) | 246 if(!linkAnnot) |
247 return 0; | 247 return 0; |
248 CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; | 248 CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; |
249 CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints")); | 249 CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints")); |
250 if (!pArray) | 250 if (!pArray) |
251 return 0; | 251 return 0; |
252 » else | 252 return pArray->GetCount() / 8; |
253 » » return pArray->GetCount() / 8; | |
254 } | 253 } |
255 | 254 |
256 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quad
Index, FS_QUADPOINTSF* quadPoints) | 255 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quad
Index, FS_QUADPOINTSF* quadPoints) |
257 { | 256 { |
258 if(!linkAnnot || !quadPoints) | 257 if(!linkAnnot || !quadPoints) |
259 return FALSE; | 258 return FALSE; |
260 CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; | 259 CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; |
261 CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints")); | 260 CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints")); |
262 if (pArray) { | 261 if (pArray) { |
263 if (quadIndex < 0 || quadIndex >= (int)pArray->GetCount()/8 || (
(quadIndex*8+7) >= (int)pArray->GetCount())) | 262 if (quadIndex < 0 || quadIndex >= (int)pArray->GetCount()/8 || (
(quadIndex*8+7) >= (int)pArray->GetCount())) |
(...skipping 23 matching lines...) Expand all Loading... |
287 return 0; | 286 return 0; |
288 CFX_WideString text = pInfo->GetUnicodeText(tag); | 287 CFX_WideString text = pInfo->GetUnicodeText(tag); |
289 // Use UTF-16LE encoding | 288 // Use UTF-16LE encoding |
290 CFX_ByteString encodedText = text.UTF16LE_Encode(); | 289 CFX_ByteString encodedText = text.UTF16LE_Encode(); |
291 unsigned long len = encodedText.GetLength(); | 290 unsigned long len = encodedText.GetLength(); |
292 if (buffer && buflen >= len) { | 291 if (buffer && buflen >= len) { |
293 FXSYS_memcpy(buffer, encodedText.c_str(), len); | 292 FXSYS_memcpy(buffer, encodedText.c_str(), len); |
294 } | 293 } |
295 return len; | 294 return len; |
296 } | 295 } |
OLD | NEW |