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

Side by Side Diff: core/fxcrt/fx_extension.cpp

Issue 2450183003: Fix some FX_BOOL / int noise in fxcrt. (Closed)
Patch Set: 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
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 <utility> 7 #include <utility>
8 8
9 #include "core/fxcrt/extension.h" 9 #include "core/fxcrt/extension.h"
10 #include "core/fxcrt/fx_basic.h" 10 #include "core/fxcrt/fx_basic.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 return GetPosition() >= GetSize(); 301 return GetPosition() >= GetSize();
302 } 302 }
303 303
304 FX_FILESIZE CFX_CRTFileStream::GetPosition() { 304 FX_FILESIZE CFX_CRTFileStream::GetPosition() {
305 return m_pFile->GetPosition(); 305 return m_pFile->GetPosition();
306 } 306 }
307 307
308 FX_BOOL CFX_CRTFileStream::ReadBlock(void* buffer, 308 FX_BOOL CFX_CRTFileStream::ReadBlock(void* buffer,
309 FX_FILESIZE offset, 309 FX_FILESIZE offset,
310 size_t size) { 310 size_t size) {
311 return (FX_BOOL)m_pFile->ReadPos(buffer, size, offset); 311 return m_pFile->ReadPos(buffer, size, offset) > 0;
312 } 312 }
313 313
314 size_t CFX_CRTFileStream::ReadBlock(void* buffer, size_t size) { 314 size_t CFX_CRTFileStream::ReadBlock(void* buffer, size_t size) {
315 return m_pFile->Read(buffer, size); 315 return m_pFile->Read(buffer, size);
316 } 316 }
317 317
318 FX_BOOL CFX_CRTFileStream::WriteBlock(const void* buffer, 318 FX_BOOL CFX_CRTFileStream::WriteBlock(const void* buffer,
319 FX_FILESIZE offset, 319 FX_FILESIZE offset,
320 size_t size) { 320 size_t size) {
321 return (FX_BOOL)m_pFile->WritePos(buffer, size, offset); 321 return m_pFile->WritePos(buffer, size, offset) == size;
npm 2016/10/26 18:26:04 Is WritePos guaranteed to return either 0 or size?
Tom Sepez 2016/10/26 20:47:03 reverted to old behaviour via !!
322 } 322 }
323 323
324 FX_BOOL CFX_CRTFileStream::Flush() { 324 FX_BOOL CFX_CRTFileStream::Flush() {
325 return m_pFile->Flush(); 325 return m_pFile->Flush();
326 } 326 }
327 327
328 #ifdef PDF_ENABLE_XFA 328 #ifdef PDF_ENABLE_XFA
329 IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) { 329 IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) {
330 if (wsPath.GetLength() == 0) 330 if (wsPath.GetLength() == 0)
331 return nullptr; 331 return nullptr;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 b = ((const uint8_t*)pGUID)[i]; 610 b = ((const uint8_t*)pGUID)[i];
611 *pBuf++ = gs_FX_pHexChars[b >> 4]; 611 *pBuf++ = gs_FX_pHexChars[b >> 4];
612 *pBuf++ = gs_FX_pHexChars[b & 0x0F]; 612 *pBuf++ = gs_FX_pHexChars[b & 0x0F];
613 if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) { 613 if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) {
614 *pBuf++ = L'-'; 614 *pBuf++ = L'-';
615 } 615 }
616 } 616 }
617 bsStr.ReleaseBuffer(bSeparator ? 36 : 32); 617 bsStr.ReleaseBuffer(bSeparator ? 36 : 32);
618 } 618 }
619 #endif // PDF_ENABLE_XFA 619 #endif // PDF_ENABLE_XFA
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698