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

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

Issue 2060913003: Make code compile with clang_use_chrome_plugin (part II) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 6 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 | « core/fxcrt/fx_basic_util.cpp ('k') | core/fxcrt/fx_bidi.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cctype> 10 #include <cctype>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 haystack++; 56 haystack++;
57 } 57 }
58 return nullptr; 58 return nullptr;
59 } 59 }
60 60
61 } // namespace 61 } // namespace
62 62
63 static_assert(sizeof(CFX_WideString) <= sizeof(FX_WCHAR*), 63 static_assert(sizeof(CFX_WideString) <= sizeof(FX_WCHAR*),
64 "Strings must not require more space than pointers"); 64 "Strings must not require more space than pointers");
65 65
66 CFX_WideString::CFX_WideString() {}
67
68 CFX_WideString::CFX_WideString(const CFX_WideString& other)
69 : m_pData(other.m_pData) {}
70
71 CFX_WideString::CFX_WideString(CFX_WideString&& other) {
72 m_pData.Swap(other.m_pData);
73 }
74
66 CFX_WideString::CFX_WideString(const FX_WCHAR* pStr, FX_STRSIZE nLen) { 75 CFX_WideString::CFX_WideString(const FX_WCHAR* pStr, FX_STRSIZE nLen) {
67 if (nLen < 0) 76 if (nLen < 0)
68 nLen = pStr ? FXSYS_wcslen(pStr) : 0; 77 nLen = pStr ? FXSYS_wcslen(pStr) : 0;
69 78
70 if (nLen) 79 if (nLen)
71 m_pData.Reset(StringData::Create(pStr, nLen)); 80 m_pData.Reset(StringData::Create(pStr, nLen));
72 } 81 }
73 82
74 CFX_WideString::CFX_WideString(FX_WCHAR ch) { 83 CFX_WideString::CFX_WideString(FX_WCHAR ch) {
75 m_pData.Reset(StringData::Create(1)); 84 m_pData.Reset(StringData::Create(1));
76 m_pData->m_String[0] = ch; 85 m_pData->m_String[0] = ch;
77 } 86 }
78 87
88 CFX_WideString::CFX_WideString(const FX_WCHAR* ptr)
89 : CFX_WideString(ptr, ptr ? FXSYS_wcslen(ptr) : 0) {}
90
79 CFX_WideString::CFX_WideString(const CFX_WideStringC& stringSrc) { 91 CFX_WideString::CFX_WideString(const CFX_WideStringC& stringSrc) {
80 if (!stringSrc.IsEmpty()) { 92 if (!stringSrc.IsEmpty()) {
81 m_pData.Reset(StringData::Create(stringSrc.c_str(), stringSrc.GetLength())); 93 m_pData.Reset(StringData::Create(stringSrc.c_str(), stringSrc.GetLength()));
82 } 94 }
83 } 95 }
84 96
85 CFX_WideString::CFX_WideString(const CFX_WideStringC& str1, 97 CFX_WideString::CFX_WideString(const CFX_WideStringC& str1,
86 const CFX_WideStringC& str2) { 98 const CFX_WideStringC& str2) {
87 int nNewLen = str1.GetLength() + str2.GetLength(); 99 int nNewLen = str1.GetLength() + str2.GetLength();
88 if (nNewLen == 0) 100 if (nNewLen == 0)
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, nullptr, 0); 1000 FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, nullptr, 0);
989 CFX_WideString wstr; 1001 CFX_WideString wstr;
990 if (dest_len) { 1002 if (dest_len) {
991 FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len); 1003 FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len);
992 FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, dest_buf, 1004 FXSYS_MultiByteToWideChar(codepage, 0, bstr.c_str(), src_len, dest_buf,
993 dest_len); 1005 dest_len);
994 wstr.ReleaseBuffer(dest_len); 1006 wstr.ReleaseBuffer(dest_len);
995 } 1007 }
996 return wstr; 1008 return wstr;
997 } 1009 }
OLDNEW
« no previous file with comments | « core/fxcrt/fx_basic_util.cpp ('k') | core/fxcrt/fx_bidi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698