Don't bother passing -1 as the length to the CFX_ByteString ctor.
authorLei Zhang <thestig@chromium.org>
Fri, 16 Oct 2015 23:21:58 +0000 (16:21 -0700)
committerLei Zhang <thestig@chromium.org>
Fri, 16 Oct 2015 23:21:58 +0000 (16:21 -0700)
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1406363002 .

core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
core/src/fpdfapi/fpdf_font/fpdf_font_charset.cpp
core/src/fpdftext/fpdf_text.cpp
core/src/fxge/ge/fx_ge_fontmap.cpp
core/src/fxge/win32/fx_win32_device.cpp

index dc79de6..9c1c292 100644 (file)
@@ -1108,7 +1108,7 @@ CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) {
 
 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font,
                                           CPDF_FontEncoding* pEncoding) {
-  CFX_ByteString name(font, -1);
+  CFX_ByteString name(font);
   if (PDF_GetStandardFontName(&name) < 0)
     return nullptr;
   return GetPageData()->GetStandardFont(name, pEncoding);
index 308dac9..92d1719 100644 (file)
@@ -1778,5 +1778,5 @@ FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name) {
 CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode) {
   char glyph_name[64];
   FXFT_adobe_name_from_unicode(glyph_name, unicode);
-  return CFX_ByteString(glyph_name, -1);
+  return CFX_ByteString(glyph_name);
 }
index 40f5dd4..9ecbc21 100644 (file)
@@ -22,10 +22,7 @@ CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode,
       return CFX_ByteString((char)unicode);
     }
     const FX_CHAR* altstr = FCS_GetAltStr(unicode);
-    if (altstr) {
-      return CFX_ByteString(altstr, -1);
-    }
-    return CFX_ByteString(defchar, -1);
+    return CFX_ByteString(altstr ? altstr : defchar);
   }
   char buf[10];
   int iDef = 0;
@@ -35,10 +32,7 @@ CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode,
     return CFX_ByteString(buf, ret);
   }
   const FX_CHAR* altstr = FCS_GetAltStr(unicode);
-  if (altstr) {
-    return CFX_ByteString(altstr, -1);
-  }
-  return CFX_ByteString(defchar, -1);
+  return CFX_ByteString(altstr ? altstr : defchar);
 }
 CTextPage::CTextPage() {}
 CTextPage::~CTextPage() {
index 061ad66..e88791a 100644 (file)
@@ -455,7 +455,7 @@ void CFX_FontMapper::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) {
   m_pFontInfo = pFontInfo;
 }
 static CFX_ByteString _TT_NormalizeName(const FX_CHAR* family) {
-  CFX_ByteString norm(family, -1);
+  CFX_ByteString norm(family);
   norm.Remove(' ');
   norm.Remove('-');
   norm.Remove(',');
index a40e79b..93c2fd6 100644 (file)
@@ -122,7 +122,7 @@ FX_BOOL CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) {
 }
 void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf,
                                          FX_DWORD FontType) {
-  CFX_ByteString name(plf->lfFaceName, -1);
+  CFX_ByteString name(plf->lfFaceName);
   if (name[0] == '@') {
     return;
   }