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

Side by Side Diff: xfa/fgas/crt/fgas_stream.cpp

Issue 1885973002: Remove implicit cast from CFX_ByteString to (const char*). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Typo 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 | « xfa/fgas/crt/fgas_codepage.cpp ('k') | xfa/fgas/font/fgas_stdfontmgr.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 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 return FALSE; 413 return FALSE;
414 414
415 if (dwAccess & FX_STREAMACCESS_Truncate) 415 if (dwAccess & FX_STREAMACCESS_Truncate)
416 FX_fsetsize(m_hFile, 0); 416 FX_fsetsize(m_hFile, 0);
417 } 417 }
418 } else { 418 } else {
419 return FALSE; 419 return FALSE;
420 } 420 }
421 } 421 }
422 #else 422 #else
423 CFX_ByteString wsMode; 423 const FX_CHAR* wsMode = "rb";
424 if (dwAccess & FX_STREAMACCESS_Write) { 424 if (dwAccess & FX_STREAMACCESS_Write) {
425 if (dwAccess & FX_STREAMACCESS_Append) { 425 if (dwAccess & FX_STREAMACCESS_Append) {
426 wsMode = "a+b"; 426 wsMode = "a+b";
427 } else if (dwAccess & FX_STREAMACCESS_Truncate) { 427 } else if (dwAccess & FX_STREAMACCESS_Truncate) {
428 wsMode = "w+b"; 428 wsMode = "w+b";
429 } else { 429 } else {
430 wsMode = "r+b"; 430 wsMode = "r+b";
431 } 431 }
432 } else {
433 wsMode = "rb";
434 } 432 }
435 CFX_ByteString szFileName = CFX_ByteString::FromUnicode(pszSrcFileName); 433 CFX_ByteString szFileName = CFX_ByteString::FromUnicode(pszSrcFileName);
436 m_hFile = FXSYS_fopen(szFileName, wsMode); 434 m_hFile = FXSYS_fopen(szFileName.c_str(), wsMode);
437 if (m_hFile == NULL) { 435 if (m_hFile == NULL) {
438 if (dwAccess & FX_STREAMACCESS_Write) { 436 if (dwAccess & FX_STREAMACCESS_Write) {
439 if (dwAccess & FX_STREAMACCESS_Create) { 437 if (dwAccess & FX_STREAMACCESS_Create) {
440 m_hFile = FXSYS_fopen(szFileName, "w+b"); 438 m_hFile = FXSYS_fopen(szFileName.c_str(), "w+b");
441 } 439 }
442 if (m_hFile == NULL) { 440 if (m_hFile == NULL) {
443 m_hFile = FXSYS_fopen(szFileName, "r+b"); 441 m_hFile = FXSYS_fopen(szFileName.c_str(), "r+b");
444 if (m_hFile == NULL) { 442 if (m_hFile == NULL) {
445 return FALSE; 443 return FALSE;
446 } 444 }
447 if (dwAccess & FX_STREAMACCESS_Truncate) { 445 if (dwAccess & FX_STREAMACCESS_Truncate) {
448 FX_fsetsize(m_hFile, 0); 446 FX_fsetsize(m_hFile, 0);
449 } 447 }
450 } 448 }
451 } else { 449 } else {
452 return FALSE; 450 return FALSE;
453 } 451 }
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 return m_pStream->WriteData((const uint8_t*)pData, (int32_t)size) == 1617 return m_pStream->WriteData((const uint8_t*)pData, (int32_t)size) ==
1620 (int32_t)size; 1618 (int32_t)size;
1621 } 1619 }
1622 FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, 1620 FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData,
1623 FX_FILESIZE offset, 1621 FX_FILESIZE offset,
1624 size_t size) { 1622 size_t size) {
1625 m_pStream->Seek(FX_STREAMSEEK_Begin, offset); 1623 m_pStream->Seek(FX_STREAMSEEK_Begin, offset);
1626 int32_t iLen = m_pStream->WriteData((uint8_t*)pData, (int32_t)size); 1624 int32_t iLen = m_pStream->WriteData((uint8_t*)pData, (int32_t)size);
1627 return iLen == (int32_t)size; 1625 return iLen == (int32_t)size;
1628 } 1626 }
OLDNEW
« no previous file with comments | « xfa/fgas/crt/fgas_codepage.cpp ('k') | xfa/fgas/font/fgas_stdfontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698