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

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

Issue 1862953004: Make CFX_WideString::FromLocal() take a CFX_ByteStringC arg (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use GetConstStringBy(). 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 | « core/fpdfdoc/doc_form.cpp ('k') | core/fxcrt/fx_basic_wstring.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cctype> 10 #include <cctype>
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 817
818 // static 818 // static
819 CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str, 819 CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str,
820 FX_STRSIZE len) { 820 FX_STRSIZE len) {
821 FX_STRSIZE str_len = len >= 0 ? len : FXSYS_wcslen(str); 821 FX_STRSIZE str_len = len >= 0 ? len : FXSYS_wcslen(str);
822 return FromUnicode(CFX_WideString(str, str_len)); 822 return FromUnicode(CFX_WideString(str, str_len));
823 } 823 }
824 824
825 // static 825 // static
826 CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) { 826 CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) {
827 return CFX_CharMap::GetByteString(0, str); 827 return CFX_CharMap::GetByteString(0, str.AsWideStringC());
828 } 828 }
829 829
830 int CFX_ByteString::Compare(const CFX_ByteStringC& str) const { 830 int CFX_ByteString::Compare(const CFX_ByteStringC& str) const {
831 if (!m_pData) { 831 if (!m_pData) {
832 return str.IsEmpty() ? 0 : -1; 832 return str.IsEmpty() ? 0 : -1;
833 } 833 }
834 int this_len = m_pData->m_nDataLength; 834 int this_len = m_pData->m_nDataLength;
835 int that_len = str.GetLength(); 835 int that_len = str.GetLength();
836 int min_len = this_len < that_len ? this_len : that_len; 836 int min_len = this_len < that_len ? this_len : that_len;
837 for (int i = 0; i < min_len; i++) { 837 for (int i = 0; i < min_len; i++) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 fraction %= scale; 988 fraction %= scale;
989 scale /= 10; 989 scale /= 10;
990 } 990 }
991 return buf_size; 991 return buf_size;
992 } 992 }
993 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { 993 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) {
994 FX_CHAR buf[32]; 994 FX_CHAR buf[32];
995 FX_STRSIZE len = FX_ftoa(d, buf); 995 FX_STRSIZE len = FX_ftoa(d, buf);
996 return CFX_ByteString(buf, len); 996 return CFX_ByteString(buf, len);
997 } 997 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/doc_form.cpp ('k') | core/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698