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

Side by Side Diff: xfa/fgas/crt/fgas_stream.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.h ('k') | xfa/fxfa/app/xfa_ffapp.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 "xfa/fgas/crt/fgas_stream.h" 7 #include "xfa/fgas/crt/fgas_stream.h"
8 8
9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
10 _FX_OS_ == _FX_WIN64_ 10 _FX_OS_ == _FX_WIN64_
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 uint8_t* m_pBuf; 284 uint8_t* m_pBuf;
285 int32_t m_iBufSize; 285 int32_t m_iBufSize;
286 FX_BOOL m_bDelStream; 286 FX_BOOL m_bDelStream;
287 IFX_Stream* m_pStreamImp; 287 IFX_Stream* m_pStreamImp;
288 int32_t m_iRefCount; 288 int32_t m_iRefCount;
289 void InitStream(); 289 void InitStream();
290 }; 290 };
291 291
292 class CFGAS_FileRead : public IFX_SeekableReadStream { 292 class CFGAS_FileRead : public IFX_SeekableReadStream {
293 public: 293 public:
294 CFGAS_FileRead(IFX_Stream* pStream, FX_BOOL bReleaseStream); 294 CFGAS_FileRead(IFX_Stream* pStream, bool bReleaseStream);
295 ~CFGAS_FileRead() override; 295 ~CFGAS_FileRead() override;
296 296
297 // IFX_SeekableReadStream 297 // IFX_SeekableReadStream
298 void Release() override; 298 void Release() override;
299 FX_FILESIZE GetSize() override; 299 FX_FILESIZE GetSize() override;
300 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; 300 bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
301 301
302 protected: 302 protected:
303 FX_BOOL m_bReleaseStream; 303 bool m_bReleaseStream;
304 IFX_Stream* m_pStream; 304 IFX_Stream* m_pStream;
305 }; 305 };
306 306
307 int32_t FileLength(FXSYS_FILE* file) { 307 int32_t FileLength(FXSYS_FILE* file) {
308 ASSERT(file); 308 ASSERT(file);
309 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ 309 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
310 return _filelength(_fileno(file)); 310 return _filelength(_fileno(file));
311 #else 311 #else
312 int32_t iPos = FXSYS_ftell(file); 312 int32_t iPos = FXSYS_ftell(file);
313 FXSYS_fseek(file, 0, FXSYS_SEEK_END); 313 FXSYS_fseek(file, 0, FXSYS_SEEK_END);
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 pShared->m_dwAccess = dwAccess; 1462 pShared->m_dwAccess = dwAccess;
1463 pShared->m_iTotalSize = iLength; 1463 pShared->m_iTotalSize = iLength;
1464 pShared->m_iPosition = iStart; 1464 pShared->m_iPosition = iStart;
1465 pShared->m_iStart = iStart; 1465 pShared->m_iStart = iStart;
1466 pShared->m_iLength = (dwAccess & FX_STREAMACCESS_Write) != 0 ? 0 : iLength; 1466 pShared->m_iLength = (dwAccess & FX_STREAMACCESS_Write) != 0 ? 0 : iLength;
1467 if (dwAccess & FX_STREAMACCESS_Text) { 1467 if (dwAccess & FX_STREAMACCESS_Text) {
1468 return IFX_Stream::CreateTextStream(pShared, TRUE); 1468 return IFX_Stream::CreateTextStream(pShared, TRUE);
1469 } 1469 }
1470 return pShared; 1470 return pShared;
1471 } 1471 }
1472
1472 IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream, 1473 IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream,
1473 FX_BOOL bReleaseStream) { 1474 bool bReleaseStream) {
1474 ASSERT(pBaseStream); 1475 ASSERT(pBaseStream);
1475 return new CFGAS_FileRead(pBaseStream, bReleaseStream); 1476 return new CFGAS_FileRead(pBaseStream, bReleaseStream);
1476 } 1477 }
1477 CFGAS_FileRead::CFGAS_FileRead(IFX_Stream* pStream, FX_BOOL bReleaseStream) 1478
1479 CFGAS_FileRead::CFGAS_FileRead(IFX_Stream* pStream, bool bReleaseStream)
1478 : m_bReleaseStream(bReleaseStream), m_pStream(pStream) { 1480 : m_bReleaseStream(bReleaseStream), m_pStream(pStream) {
1479 ASSERT(m_pStream); 1481 ASSERT(m_pStream);
1480 } 1482 }
1481 CFGAS_FileRead::~CFGAS_FileRead() { 1483 CFGAS_FileRead::~CFGAS_FileRead() {
1482 if (m_bReleaseStream) { 1484 if (m_bReleaseStream) {
1483 m_pStream->Release(); 1485 m_pStream->Release();
1484 } 1486 }
1485 } 1487 }
1486 FX_FILESIZE CFGAS_FileRead::GetSize() { 1488 FX_FILESIZE CFGAS_FileRead::GetSize() {
1487 return (FX_FILESIZE)m_pStream->GetLength(); 1489 return (FX_FILESIZE)m_pStream->GetLength();
1488 } 1490 }
1489 FX_BOOL CFGAS_FileRead::ReadBlock(void* buffer, 1491
1490 FX_FILESIZE offset, 1492 bool CFGAS_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) {
1491 size_t size) {
1492 m_pStream->Seek(FX_STREAMSEEK_Begin, (int32_t)offset); 1493 m_pStream->Seek(FX_STREAMSEEK_Begin, (int32_t)offset);
1493 int32_t iLen = m_pStream->ReadData((uint8_t*)buffer, (int32_t)size); 1494 int32_t iLen = m_pStream->ReadData((uint8_t*)buffer, (int32_t)size);
1494 return iLen == (int32_t)size; 1495 return iLen == (int32_t)size;
1495 } 1496 }
1496 1497
1497 void CFGAS_FileRead::Release() { 1498 void CFGAS_FileRead::Release() {
1498 delete this; 1499 delete this;
1499 } 1500 }
OLDNEW
« no previous file with comments | « xfa/fgas/crt/fgas_stream.h ('k') | xfa/fxfa/app/xfa_ffapp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698