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

Side by Side Diff: xfa/fxfa/app/xfa_ffapp.cpp

Issue 2450183003: Fix some FX_BOOL / int noise in fxcrt. (Closed)
Patch Set: moar 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 | « xfa/fgas/crt/fgas_stream.cpp ('k') | xfa/fxfa/xfa_ffapp.h » ('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 "xfa/fxfa/xfa_ffapp.h" 7 #include "xfa/fxfa/xfa_ffapp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 19 matching lines...) Expand all
30 FX_FILESIZE CXFA_FileRead::GetSize() { 30 FX_FILESIZE CXFA_FileRead::GetSize() {
31 uint32_t dwSize = 0; 31 uint32_t dwSize = 0;
32 int32_t iCount = m_Data.GetSize(); 32 int32_t iCount = m_Data.GetSize();
33 for (int32_t i = 0; i < iCount; i++) { 33 for (int32_t i = 0; i < iCount; i++) {
34 CPDF_StreamAcc& acc = m_Data[i]; 34 CPDF_StreamAcc& acc = m_Data[i];
35 dwSize += acc.GetSize(); 35 dwSize += acc.GetSize();
36 } 36 }
37 return dwSize; 37 return dwSize;
38 } 38 }
39 39
40 FX_BOOL CXFA_FileRead::ReadBlock(void* buffer, 40 bool CXFA_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) {
41 FX_FILESIZE offset,
42 size_t size) {
43 int32_t iCount = m_Data.GetSize(); 41 int32_t iCount = m_Data.GetSize();
44 int32_t index = 0; 42 int32_t index = 0;
45 while (index < iCount) { 43 while (index < iCount) {
46 CPDF_StreamAcc& acc = m_Data[index]; 44 CPDF_StreamAcc& acc = m_Data[index];
47 FX_FILESIZE dwSize = acc.GetSize(); 45 FX_FILESIZE dwSize = acc.GetSize();
48 if (offset < dwSize) { 46 if (offset < dwSize) {
49 break; 47 break;
50 } 48 }
51 offset -= dwSize; 49 offset -= dwSize;
52 index++; 50 index++;
53 } 51 }
54 while (index < iCount) { 52 while (index < iCount) {
55 CPDF_StreamAcc& acc = m_Data[index]; 53 CPDF_StreamAcc& acc = m_Data[index];
56 uint32_t dwSize = acc.GetSize(); 54 uint32_t dwSize = acc.GetSize();
57 size_t dwRead = std::min(size, static_cast<size_t>(dwSize - offset)); 55 size_t dwRead = std::min(size, static_cast<size_t>(dwSize - offset));
58 FXSYS_memcpy(buffer, acc.GetData() + offset, dwRead); 56 FXSYS_memcpy(buffer, acc.GetData() + offset, dwRead);
59 size -= dwRead; 57 size -= dwRead;
60 if (size == 0) { 58 if (size == 0) {
61 return TRUE; 59 return true;
62 } 60 }
63 buffer = (uint8_t*)buffer + dwRead; 61 buffer = (uint8_t*)buffer + dwRead;
64 offset = 0; 62 offset = 0;
65 index++; 63 index++;
66 } 64 }
67 return FALSE; 65 return false;
68 } 66 }
69 67
70 void CXFA_FileRead::Release() { 68 void CXFA_FileRead::Release() {
71 delete this; 69 delete this;
72 } 70 }
73 71
74 CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) 72 CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider)
75 : m_pProvider(pProvider), 73 : m_pProvider(pProvider),
76 m_pWidgetMgrDelegate(nullptr), 74 m_pWidgetMgrDelegate(nullptr),
77 m_pFWLApp(new IFWL_App(this)) { 75 m_pFWLApp(new IFWL_App(this)) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread | 140 pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread |
143 FWL_WGTMGR_DisableForm); 141 FWL_WGTMGR_DisableForm);
144 m_pWidgetMgrDelegate = pDelegate; 142 m_pWidgetMgrDelegate = pDelegate;
145 } 143 }
146 return m_pAdapterWidgetMgr.get(); 144 return m_pAdapterWidgetMgr.get();
147 } 145 }
148 146
149 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const { 147 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const {
150 return m_pProvider->GetTimerMgr(); 148 return m_pProvider->GetTimerMgr();
151 } 149 }
OLDNEW
« no previous file with comments | « xfa/fgas/crt/fgas_stream.cpp ('k') | xfa/fxfa/xfa_ffapp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698