From 1ddf056da74de0a34631b8a719f4f02b4ec82144 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 22 Apr 2015 12:04:14 -0700 Subject: Add missing operators for CFX_ByteStringC. Removing the implicit cast operator forces a build breakage should we use ByteStringC in STL containers. Adding an operator< restores correct behaviour. Adding an operator[] avoids re-writing some code to call GetPtr() prior to array indexing. Part 1 of 4. R=thestig@chromium.org TBR=brucedawson@chromium.org BUG=pdfium:142. Review URL: https://codereview.chromium.org/1090303003 --- core/src/fxcrt/fx_basic_buffer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'core/src/fxcrt/fx_basic_buffer.cpp') diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index bb8466debe..eb5246acec 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -143,7 +143,7 @@ CFX_ByteStringC CFX_BinaryBuf::GetByteString() const } CFX_ByteTextBuf& CFX_ByteTextBuf::operator << (FX_BSTR lpsz) { - AppendBlock((FX_LPCBYTE)lpsz, lpsz.GetLength()); + AppendBlock(lpsz.GetPtr(), lpsz.GetLength()); return *this; } CFX_ByteTextBuf& CFX_ByteTextBuf::operator << (int i) @@ -174,7 +174,7 @@ CFX_ByteTextBuf& CFX_ByteTextBuf::operator << (const CFX_ByteTextBuf& buf) } void CFX_ByteTextBuf::operator =(const CFX_ByteStringC& str) { - CopyData((FX_LPCBYTE)str, str.GetLength()); + CopyData(str.GetPtr(), str.GetLength()); } void CFX_WideTextBuf::AppendChar(FX_WCHAR ch) { @@ -285,10 +285,10 @@ CFX_ArchiveSaver& CFX_ArchiveSaver::operator << (FX_BSTR bstr) int len = bstr.GetLength(); if (m_pStream) { m_pStream->WriteBlock(&len, sizeof(int)); - m_pStream->WriteBlock(bstr, len); + m_pStream->WriteBlock(bstr.GetPtr(), len); } else { m_SavingBuf.AppendBlock(&len, sizeof(int)); - m_SavingBuf.AppendBlock(bstr, len); + m_SavingBuf.AppendBlock(bstr.GetPtr(), len); } return *this; } @@ -488,7 +488,7 @@ FX_INT32 IFX_BufferArchive::AppendDWord(FX_DWORD i) } FX_INT32 IFX_BufferArchive::AppendString(FX_BSTR lpsz) { - return AppendBlock((FX_LPCBYTE)lpsz, lpsz.GetLength()); + return AppendBlock(lpsz.GetPtr(), lpsz.GetLength()); } CFX_FileBufferArchive::CFX_FileBufferArchive(FX_STRSIZE size) : IFX_BufferArchive(size) -- cgit v1.2.3