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

Side by Side Diff: fpdfsdk/fpdfformfill.cpp

Issue 1849443003: Re-enable all the windows warnings except 4267 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Address comments Created 4 years, 8 months 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 | « core/fxge/ge/fx_ge_fontmap.cpp ('k') | fpdfsdk/fpdfview.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_formfill.h" 7 #include "public/fpdf_formfill.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 473
474 IXFA_MenuHandler* pXFAMenuHander = 474 IXFA_MenuHandler* pXFAMenuHander =
475 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); 475 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
476 if (pXFAMenuHander == NULL) 476 if (pXFAMenuHander == NULL)
477 return; 477 return;
478 478
479 CFX_WideString wsCpText; 479 CFX_WideString wsCpText;
480 pXFAMenuHander->Copy((IXFA_Widget*)hWidget, wsCpText); 480 pXFAMenuHander->Copy((IXFA_Widget*)hWidget, wsCpText);
481 481
482 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); 482 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
483 int len = bsCpText.GetLength() / sizeof(unsigned short); 483 uint32_t len = bsCpText.GetLength() / sizeof(unsigned short);
484 if (wsText == NULL) { 484 if (wsText == NULL) {
485 *size = len; 485 *size = len;
486 return; 486 return;
487 } 487 }
488 488
489 int real_size = len < *size ? len : *size; 489 uint32_t real_size = len < *size ? len : *size;
490 if (real_size > 0) { 490 if (real_size > 0) {
491 FXSYS_memcpy((void*)wsText, 491 FXSYS_memcpy((void*)wsText,
492 bsCpText.GetBuffer(real_size * sizeof(unsigned short)), 492 bsCpText.GetBuffer(real_size * sizeof(unsigned short)),
493 real_size * sizeof(unsigned short)); 493 real_size * sizeof(unsigned short));
494 bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short)); 494 bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short));
495 } 495 }
496 *size = real_size; 496 *size = real_size;
497 } 497 }
498 498
499 DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, 499 DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document,
500 FPDF_WIDGET hWidget, 500 FPDF_WIDGET hWidget,
501 FPDF_WIDESTRING wsText, 501 FPDF_WIDESTRING wsText,
502 FPDF_DWORD* size) { 502 FPDF_DWORD* size) {
503 if (NULL == hWidget || NULL == document) 503 if (NULL == hWidget || NULL == document)
504 return; 504 return;
505 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document; 505 CPDFXFA_Document* pDocument = (CPDFXFA_Document*)document;
506 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic && 506 if (pDocument->GetDocType() != XFA_DOCTYPE_Dynamic &&
507 pDocument->GetDocType() != XFA_DOCTYPE_Static) 507 pDocument->GetDocType() != XFA_DOCTYPE_Static)
508 return; 508 return;
509 509
510 IXFA_MenuHandler* pXFAMenuHander = 510 IXFA_MenuHandler* pXFAMenuHander =
511 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler(); 511 CPDFXFA_App::GetInstance()->GetXFAApp()->GetMenuHandler();
512 if (pXFAMenuHander == NULL) 512 if (pXFAMenuHander == NULL)
513 return; 513 return;
514 514
515 CFX_WideString wsCpText; 515 CFX_WideString wsCpText;
516 pXFAMenuHander->Cut((IXFA_Widget*)hWidget, wsCpText); 516 pXFAMenuHander->Cut((IXFA_Widget*)hWidget, wsCpText);
517 517
518 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); 518 CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode();
519 int len = bsCpText.GetLength() / sizeof(unsigned short); 519 uint32_t len = bsCpText.GetLength() / sizeof(unsigned short);
520 if (wsText == NULL) { 520 if (wsText == NULL) {
521 *size = len; 521 *size = len;
522 return; 522 return;
523 } 523 }
524 524
525 int real_size = len < *size ? len : *size; 525 uint32_t real_size = len < *size ? len : *size;
526 if (real_size > 0) { 526 if (real_size > 0) {
527 FXSYS_memcpy((void*)wsText, 527 FXSYS_memcpy((void*)wsText,
528 bsCpText.GetBuffer(real_size * sizeof(unsigned short)), 528 bsCpText.GetBuffer(real_size * sizeof(unsigned short)),
529 real_size * sizeof(unsigned short)); 529 real_size * sizeof(unsigned short));
530 bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short)); 530 bsCpText.ReleaseBuffer(real_size * sizeof(unsigned short));
531 } 531 }
532 *size = real_size; 532 *size = real_size;
533 } 533 }
534 534
535 DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, 535 DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 FPDF_BYTESTRING bsText, 618 FPDF_BYTESTRING bsText,
619 FPDF_DWORD* size) { 619 FPDF_DWORD* size) {
620 if (!sHandle || !size) 620 if (!sHandle || !size)
621 return FALSE; 621 return FALSE;
622 622
623 int count = FPDF_StringHandleCounts(sHandle); 623 int count = FPDF_StringHandleCounts(sHandle);
624 if (index < 0 || index >= count) 624 if (index < 0 || index >= count)
625 return FALSE; 625 return FALSE;
626 626
627 std::vector<CFX_ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle); 627 std::vector<CFX_ByteString>* sSuggestWords = FromFPDFStringHandle(sHandle);
628 int len = (*sSuggestWords)[index].GetLength(); 628 uint32_t len = (*sSuggestWords)[index].GetLength();
629 if (!bsText) { 629 if (!bsText) {
630 *size = len; 630 *size = len;
631 return TRUE; 631 return TRUE;
632 } 632 }
633 633
634 int real_size = len < *size ? len : *size; 634 uint32_t real_size = len < *size ? len : *size;
635 if (real_size > 0) 635 if (real_size > 0)
636 FXSYS_memcpy((void*)bsText, (const FX_CHAR*)(*sSuggestWords)[index], 636 FXSYS_memcpy((void*)bsText, (const FX_CHAR*)(*sSuggestWords)[index],
637 real_size); 637 real_size);
638 *size = real_size; 638 *size = real_size;
639 return TRUE; 639 return TRUE;
640 } 640 }
641 641
642 DLLEXPORT void STDCALL 642 DLLEXPORT void STDCALL
643 FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle) { 643 FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle) {
644 delete FromFPDFStringHandle(stringHandle); 644 delete FromFPDFStringHandle(stringHandle);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); 755 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc);
756 } 756 }
757 } else { 757 } else {
758 if (aa.ActionExist(CPDF_AAction::ClosePage)) { 758 if (aa.ActionExist(CPDF_AAction::ClosePage)) {
759 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); 759 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage);
760 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); 760 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc);
761 } 761 }
762 } 762 }
763 } 763 }
764 } 764 }
OLDNEW
« no previous file with comments | « core/fxge/ge/fx_ge_fontmap.cpp ('k') | fpdfsdk/fpdfview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698