Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: fpdfsdk/fpdfdoc.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fpdf_transformpage.cpp ('k') | fpdfsdk/fpdfeditimg.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "public/fpdf_doc.h" 7 #include "public/fpdf_doc.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 return nullptr; 265 return nullptr;
266 266
267 CPDF_Link link(ToDictionary(static_cast<CPDF_Object*>(pDict))); 267 CPDF_Link link(ToDictionary(static_cast<CPDF_Object*>(pDict)));
268 return link.GetAction().GetDict(); 268 return link.GetAction().GetDict();
269 } 269 }
270 270
271 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, 271 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page,
272 int* startPos, 272 int* startPos,
273 FPDF_LINK* linkAnnot) { 273 FPDF_LINK* linkAnnot) {
274 if (!startPos || !linkAnnot) 274 if (!startPos || !linkAnnot)
275 return FALSE; 275 return false;
276 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 276 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
277 if (!pPage || !pPage->m_pFormDict) 277 if (!pPage || !pPage->m_pFormDict)
278 return FALSE; 278 return false;
279 CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots"); 279 CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots");
280 if (!pAnnots) 280 if (!pAnnots)
281 return FALSE; 281 return false;
282 for (size_t i = *startPos; i < pAnnots->GetCount(); i++) { 282 for (size_t i = *startPos; i < pAnnots->GetCount(); i++) {
283 CPDF_Dictionary* pDict = 283 CPDF_Dictionary* pDict =
284 ToDictionary(static_cast<CPDF_Object*>(pAnnots->GetDirectObjectAt(i))); 284 ToDictionary(static_cast<CPDF_Object*>(pAnnots->GetDirectObjectAt(i)));
285 if (!pDict) 285 if (!pDict)
286 continue; 286 continue;
287 if (pDict->GetStringFor("Subtype") == "Link") { 287 if (pDict->GetStringFor("Subtype") == "Link") {
288 *startPos = static_cast<int>(i + 1); 288 *startPos = static_cast<int>(i + 1);
289 *linkAnnot = static_cast<FPDF_LINK>(pDict); 289 *linkAnnot = static_cast<FPDF_LINK>(pDict);
290 return TRUE; 290 return true;
291 } 291 }
292 } 292 }
293 return FALSE; 293 return false;
294 } 294 }
295 295
296 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, 296 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot,
297 FS_RECTF* rect) { 297 FS_RECTF* rect) {
298 if (!linkAnnot || !rect) 298 if (!linkAnnot || !rect)
299 return FALSE; 299 return false;
300 CPDF_Dictionary* pAnnotDict = 300 CPDF_Dictionary* pAnnotDict =
301 ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); 301 ToDictionary(static_cast<CPDF_Object*>(linkAnnot));
302 CFX_FloatRect rt = pAnnotDict->GetRectFor("Rect"); 302 CFX_FloatRect rt = pAnnotDict->GetRectFor("Rect");
303 rect->left = rt.left; 303 rect->left = rt.left;
304 rect->bottom = rt.bottom; 304 rect->bottom = rt.bottom;
305 rect->right = rt.right; 305 rect->right = rt.right;
306 rect->top = rt.top; 306 rect->top = rt.top;
307 return TRUE; 307 return true;
308 } 308 }
309 309
310 DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) { 310 DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) {
311 if (!linkAnnot) 311 if (!linkAnnot)
312 return 0; 312 return 0;
313 CPDF_Dictionary* pAnnotDict = 313 CPDF_Dictionary* pAnnotDict =
314 ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); 314 ToDictionary(static_cast<CPDF_Object*>(linkAnnot));
315 CPDF_Array* pArray = pAnnotDict->GetArrayFor("QuadPoints"); 315 CPDF_Array* pArray = pAnnotDict->GetArrayFor("QuadPoints");
316 if (!pArray) 316 if (!pArray)
317 return 0; 317 return 0;
318 return static_cast<int>(pArray->GetCount() / 8); 318 return static_cast<int>(pArray->GetCount() / 8);
319 } 319 }
320 320
321 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, 321 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
322 int quadIndex, 322 int quadIndex,
323 FS_QUADPOINTSF* quadPoints) { 323 FS_QUADPOINTSF* quadPoints) {
324 if (!linkAnnot || !quadPoints) 324 if (!linkAnnot || !quadPoints)
325 return FALSE; 325 return false;
326 CPDF_Dictionary* pAnnotDict = 326 CPDF_Dictionary* pAnnotDict =
327 ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); 327 ToDictionary(static_cast<CPDF_Object*>(linkAnnot));
328 CPDF_Array* pArray = pAnnotDict->GetArrayFor("QuadPoints"); 328 CPDF_Array* pArray = pAnnotDict->GetArrayFor("QuadPoints");
329 if (pArray) { 329 if (pArray) {
330 if (quadIndex < 0 || 330 if (quadIndex < 0 ||
331 static_cast<size_t>(quadIndex) >= pArray->GetCount() / 8 || 331 static_cast<size_t>(quadIndex) >= pArray->GetCount() / 8 ||
332 (static_cast<size_t>(quadIndex * 8 + 7) >= pArray->GetCount())) 332 (static_cast<size_t>(quadIndex * 8 + 7) >= pArray->GetCount()))
333 return FALSE; 333 return false;
334 quadPoints->x1 = pArray->GetNumberAt(quadIndex * 8); 334 quadPoints->x1 = pArray->GetNumberAt(quadIndex * 8);
335 quadPoints->y1 = pArray->GetNumberAt(quadIndex * 8 + 1); 335 quadPoints->y1 = pArray->GetNumberAt(quadIndex * 8 + 1);
336 quadPoints->x2 = pArray->GetNumberAt(quadIndex * 8 + 2); 336 quadPoints->x2 = pArray->GetNumberAt(quadIndex * 8 + 2);
337 quadPoints->y2 = pArray->GetNumberAt(quadIndex * 8 + 3); 337 quadPoints->y2 = pArray->GetNumberAt(quadIndex * 8 + 3);
338 quadPoints->x3 = pArray->GetNumberAt(quadIndex * 8 + 4); 338 quadPoints->x3 = pArray->GetNumberAt(quadIndex * 8 + 4);
339 quadPoints->y3 = pArray->GetNumberAt(quadIndex * 8 + 5); 339 quadPoints->y3 = pArray->GetNumberAt(quadIndex * 8 + 5);
340 quadPoints->x4 = pArray->GetNumberAt(quadIndex * 8 + 6); 340 quadPoints->x4 = pArray->GetNumberAt(quadIndex * 8 + 6);
341 quadPoints->y4 = pArray->GetNumberAt(quadIndex * 8 + 7); 341 quadPoints->y4 = pArray->GetNumberAt(quadIndex * 8 + 7);
342 return TRUE; 342 return true;
343 } 343 }
344 return FALSE; 344 return false;
345 } 345 }
346 346
347 DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, 347 DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc,
348 FPDF_BYTESTRING tag, 348 FPDF_BYTESTRING tag,
349 void* buffer, 349 void* buffer,
350 unsigned long buflen) { 350 unsigned long buflen) {
351 if (!tag) 351 if (!tag)
352 return 0; 352 return 0;
353 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc); 353 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc);
354 if (!pDoc) 354 if (!pDoc)
355 return 0; 355 return 0;
356 CPDF_Dictionary* pInfo = pDoc->GetInfo(); 356 CPDF_Dictionary* pInfo = pDoc->GetInfo();
357 if (!pInfo) 357 if (!pInfo)
358 return 0; 358 return 0;
359 CFX_WideString text = pInfo->GetUnicodeTextFor(tag); 359 CFX_WideString text = pInfo->GetUnicodeTextFor(tag);
360 // Use UTF-16LE encoding 360 // Use UTF-16LE encoding
361 CFX_ByteString encodedText = text.UTF16LE_Encode(); 361 CFX_ByteString encodedText = text.UTF16LE_Encode();
362 unsigned long len = encodedText.GetLength(); 362 unsigned long len = encodedText.GetLength();
363 if (buffer && buflen >= len) { 363 if (buffer && buflen >= len) {
364 FXSYS_memcpy(buffer, encodedText.c_str(), len); 364 FXSYS_memcpy(buffer, encodedText.c_str(), len);
365 } 365 }
366 return len; 366 return len;
367 } 367 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_transformpage.cpp ('k') | fpdfsdk/fpdfeditimg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698