Get rid of FX_LPCSTR cast.

Follow up on https://codereview.chromium.org/733693003

R=brucedawson@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/809993004
diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h
index 44c6fc5..91032f9 100644
--- a/core/include/fxcrt/fx_string.h
+++ b/core/include/fxcrt/fx_string.h
@@ -184,6 +184,13 @@
 
     static CFX_ByteString	FromUnicode(const CFX_WideString& str);
 
+    // Explicit conversion to raw string
+    FX_LPCSTR c_str() const
+    {
+        return m_pData ? m_pData->m_String : "";
+    }
+
+    // Implicit conversion to C-style string -- deprecated
     operator				FX_LPCSTR() const
     {
         return m_pData ? m_pData->m_String : "";
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 4a34de1..7795f1f 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -1107,7 +1107,7 @@
                     break;
                 }
                 CPDF_Encryptor encryptor;
-                encryptor.Initialize(m_pCryptoHandler, objnum, (FX_LPBYTE)(FX_LPCSTR)str, str.GetLength());
+                encryptor.Initialize(m_pCryptoHandler, objnum, (FX_LPBYTE)str.c_str(), str.GetLength());
                 CFX_ByteString content = PDF_EncodeString(CFX_ByteString((FX_LPCSTR)encryptor.m_pData, encryptor.m_dwSize), bHex);
                 if ((len = m_File.AppendString(content)) < 0) {
                     return -1;
@@ -1665,12 +1665,12 @@
             } else {
                 str.Format("%d %d\r\n", i, j - i);
             }
-            if (m_File.AppendBlock((FX_LPCSTR)str, str.GetLength()) < 0) {
+            if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) {
                 return -1;
             }
             while (i < j) {
                 str.Format("%010d 00000 n\r\n", m_ObjectOffset[i ++]);
-                if (m_File.AppendBlock((FX_LPCSTR)str, str.GetLength()) < 0) {
+                if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) {
                     return -1;
                 }
             }
@@ -1707,13 +1707,13 @@
             } else {
                 str.Format("%d %d\r\n", objnum, j - i);
             }
-            if (m_File.AppendBlock((FX_LPCSTR)str, str.GetLength()) < 0) {
+            if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) {
                 return -1;
             }
             while (i < j) {
                 objnum = m_NewObjNumArray.ElementAt(i++);
                 str.Format("%010d 00000 n\r\n", m_ObjectOffset[objnum]);
-                if (m_File.AppendBlock((FX_LPCSTR)str, str.GetLength()) < 0) {
+                if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) {
                     return -1;
                 }
             }
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 19786f7..b6c1dff 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -223,7 +223,7 @@
     if (face.GetLength() >= LF_FACESIZE) {
         return NULL;
     }
-    FXSYS_strcpy(lfa.lfFaceName, (FX_LPCSTR)face);
+    FXSYS_strcpy(lfa.lfFaceName, face.c_str());
     return AddWindowsFont(&lfa, bVert, bTranslateName);
 }
 extern CFX_ByteString _FPDF_GetNameFromTT(FX_LPCBYTE name_table, FX_DWORD name);
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp
index 5c4852d..08aada2 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp
@@ -16,7 +16,7 @@
 } FXFC_PACKAGE;
 FX_LPVOID FXFC_LoadPackage(FX_LPCSTR name)
 {
-    FXSYS_FILE* file = FXSYS_fopen(name, (FX_LPCSTR)"rb");
+    FXSYS_FILE* file = FXSYS_fopen(name, "rb");
     if (file == NULL) {
         return NULL;
     }
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index 99bb5b8..559d850 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -355,7 +355,7 @@
 CPDF_GeneralStateData::CPDF_GeneralStateData()
 {
     FXSYS_memset32(this, 0, sizeof(CPDF_GeneralStateData));
-    FXSYS_strcpy((FX_LPSTR)m_BlendMode, (FX_LPCSTR)"Normal");
+    FXSYS_strcpy((FX_LPSTR)m_BlendMode, "Normal");
     m_StrokeAlpha = 1.0f;
     m_FillAlpha = 1.0f;
     m_Flatness = 1.0f;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 879c2f3..deb7127 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -126,7 +126,7 @@
             m_ParamBuf1[index].m_Name.m_Len = len;
         } else {
             CFX_ByteString str = PDF_NameDecode(CFX_ByteStringC(name, len));
-            FXSYS_memcpy32(m_ParamBuf1[index].m_Name.m_Buffer, (FX_LPCSTR)str, str.GetLength());
+            FXSYS_memcpy32(m_ParamBuf1[index].m_Name.m_Buffer, str.c_str(), str.GetLength());
             m_ParamBuf1[index].m_Name.m_Len = str.GetLength();
         }
     }
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index f6daf40..9514065 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -438,7 +438,7 @@
 }
 CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr, CFX_CharMap* pCharMap)
 {
-    return PDF_DecodeText((FX_LPCBYTE)(FX_LPCSTR)bstr, bstr.GetLength(), pCharMap);
+    return PDF_DecodeText((FX_LPCBYTE)bstr.c_str(), bstr.GetLength(), pCharMap);
 }
 CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap)
 {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index 3dc0e55..b6d6dc7 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -25,12 +25,12 @@
     CRYPT_MD5Start(md5);
     CRYPT_MD5Update(md5, passcode, 32);
     CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O"));
-    CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)okey, okey.GetLength());
+    CRYPT_MD5Update(md5, (FX_LPBYTE)okey.c_str(), okey.GetLength());
     FX_DWORD perm = pEncrypt->GetInteger(FX_BSTRC("P"));
     CRYPT_MD5Update(md5, (FX_LPBYTE)&perm, 4);
     if (pIdArray) {
         CFX_ByteString id = pIdArray->GetString(0);
-        CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)id, id.GetLength());
+        CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength());
     }
     if (!bIgnoreMeta && revision >= 3 && !pEncrypt->GetInteger(FX_BSTRC("EncryptMetadata"), 1)) {
         FX_DWORD tag = (FX_DWORD) - 1;
@@ -406,7 +406,7 @@
         }
         FXSYS_memset32(test, 0, sizeof(test));
         FXSYS_memset32(tmpkey, 0, sizeof(tmpkey));
-        FXSYS_memcpy32(test, (FX_LPCSTR)ukey, copy_len);
+        FXSYS_memcpy32(test, ukey.c_str(), copy_len);
         for (int i = 19; i >= 0; i --) {
             for (int j = 0; j < key_len; j ++) {
                 tmpkey[j] = key[j] ^ i;
@@ -419,12 +419,12 @@
         CPDF_Array* pIdArray = m_pParser->GetIDArray();
         if (pIdArray) {
             CFX_ByteString id = pIdArray->GetString(0);
-            CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)id, id.GetLength());
+            CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength());
         }
         CRYPT_MD5Finish(md5, ukeybuf);
         return FXSYS_memcmp32(test, ukeybuf, 16) == 0;
     }
-    if (FXSYS_memcmp32((FX_LPVOID)(FX_LPCSTR)ukey, ukeybuf, 16) == 0) {
+    if (FXSYS_memcmp32((FX_LPVOID)ukey.c_str(), ukeybuf, 16) == 0) {
         return TRUE;
     }
     return FALSE;
@@ -461,7 +461,7 @@
     }
     FX_BYTE okeybuf[64];
     FXSYS_memset32(okeybuf, 0, sizeof(okeybuf));
-    FXSYS_memcpy32(okeybuf, (FX_LPCSTR)okey, okeylen);
+    FXSYS_memcpy32(okeybuf, okey.c_str(), okeylen);
     if (m_Revision == 2) {
         CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len);
     } else {
@@ -566,7 +566,7 @@
         CRYPT_MD5Update(md5, defpasscode, 32);
         if (pIdArray) {
             CFX_ByteString id = pIdArray->GetString(0);
-            CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)id, id.GetLength());
+            CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength());
         }
         FX_BYTE digest[32];
         CRYPT_MD5Finish(md5, digest);
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index 07b447b..c477ba6 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -328,7 +328,7 @@
         ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len);
     } else if (m_Type == PDFOBJ_STREAM) {
         CFX_ByteString result = PDF_EncodeText(pUnicodes, len);
-        ((CPDF_Stream*)this)->SetData((FX_LPBYTE)(FX_LPCSTR)result, result.GetLength(), FALSE, FALSE);
+        ((CPDF_Stream*)this)->SetData((FX_LPBYTE)result.c_str(), result.GetLength(), FALSE, FALSE);
     }
 }
 CPDF_Number::CPDF_Number(int value)
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 9fa26d8..08cc9e5 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -2194,9 +2194,9 @@
             }
             if (key.GetLength() >= 1) {
                 if (nKeys < 32) {
-                    pDict->SetAt(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj);
+                    pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj);
                 } else {
-                    pDict->AddValue(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj);
+                    pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj);
                 }
             }
         }
@@ -2380,9 +2380,9 @@
                 return NULL;
             }
             if (key.GetLength() == 1) {
-                pDict->SetAt(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj);
+                pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj);
             } else {
-                pDict->AddValue(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj);
+                pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj);
             }
         }
         if (pContext) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index 7559bce..e5e68c2 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -284,14 +284,14 @@
 }
 CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig)
 {
-    if (FXSYS_memchr((FX_LPCSTR)orig, '#', orig.GetLength()) == NULL) {
+    if (FXSYS_memchr(orig.c_str(), '#', orig.GetLength()) == NULL) {
         return orig;
     }
     return PDF_NameDecode(CFX_ByteStringC(orig));
 }
 CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig)
 {
-    FX_LPBYTE src_buf = (FX_LPBYTE)(FX_LPCSTR)orig;
+    FX_LPBYTE src_buf = (FX_LPBYTE)orig.c_str();
     int src_len = orig.GetLength();
     int dest_len = 0;
     int i;
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 6b7e6bf..d695cb9 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -446,7 +446,7 @@
     if (iCharSet == 1) {
         iCharSet = GetNativeCharSet();
     }
-    HFONT hFont = ::CreateFontA(0, 0, 0, 0, 0, 0, 0, 0, iCharSet, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, (FX_LPCSTR)csFontName);
+    HFONT hFont = ::CreateFontA(0, 0, 0, 0, 0, 0, 0, 0, iCharSet, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, csFontName.c_str());
     if (hFont != NULL) {
         LOGFONTA lf;
         memset(&lf, 0, sizeof(LOGFONTA));
diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp
index b208142..bb8466d 100644
--- a/core/src/fxcrt/fx_basic_buffer.cpp
+++ b/core/src/fxcrt/fx_basic_buffer.cpp
@@ -371,7 +371,7 @@
 {
     CFX_ByteString encoded;
     operator >> (encoded);
-    str = CFX_WideString::FromUTF16LE((const unsigned short*)(FX_LPCSTR)encoded, encoded.GetLength());
+    str = CFX_WideString::FromUTF16LE((const unsigned short*)encoded.c_str(), encoded.GetLength());
     return *this;
 }
 FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize)
diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp
index 1c47ee6..cdf3d42 100644
--- a/core/src/fxcrt/fxcrt_platforms.cpp
+++ b/core/src/fxcrt/fxcrt_platforms.cpp
@@ -46,7 +46,7 @@
     }
     CFX_ByteString strMode;
     FXCRT_GetFileModeString(dwMode, strMode);
-    m_hFile = FXSYS_fopen(fileName.GetCStr(), (FX_LPCSTR)strMode);
+    m_hFile = FXSYS_fopen(fileName.GetCStr(), strMode.c_str());
     return m_hFile != NULL;
 }
 FX_BOOL CFXCRT_FileAccess_CRT::Open(FX_WSTR fileName, FX_DWORD dwMode)
diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp
index 1525293..a9bef8a 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.cpp
+++ b/core/src/fxge/android/fpf_skiafontmgr.cpp
@@ -208,7 +208,7 @@
         bsFont += "Serif";
     }
     bsFont += uCharset;
-    return FPF_GetHashCode_StringA((FX_LPCSTR)bsFont, bsFont.GetLength(), TRUE);
+    return FPF_GetHashCode_StringA(bsFont.c_str(), bsFont.GetLength(), TRUE);
 }
 static FX_BOOL FPF_SkiaIsCJK(FX_BYTE uCharset)
 {
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index 36f28f3..22c3991 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -287,7 +287,7 @@
 }
 int _PDF_GetStandardFontName(CFX_ByteString& name)
 {
-    _AltFontName* found = (_AltFontName*)FXSYS_bsearch((FX_LPCSTR)name, g_AltFontNames,
+    _AltFontName* found = (_AltFontName*)FXSYS_bsearch(name.c_str(), g_AltFontNames,
                           sizeof g_AltFontNames / sizeof (_AltFontName), sizeof (_AltFontName), compareString);
     if (found == NULL) {
         return -1;
@@ -838,7 +838,7 @@
         }
         return fontName;
     }
-    _AltFontFamily* found = (_AltFontFamily*)FXSYS_bsearch((FX_LPCSTR)fontName, g_AltFontFamilies,
+    _AltFontFamily* found = (_AltFontFamily*)FXSYS_bsearch(fontName.c_str(), g_AltFontFamilies,
                             sizeof g_AltFontFamilies / sizeof (_AltFontFamily), sizeof (_AltFontFamily), compareFontFamilyString);
     if (found == NULL) {
         return fontName;
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index 06e9777..debf94d 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -214,7 +214,7 @@
 {
     int size = sizeof g_JpFontNameMap;
     void* pFontnameMap = (void*)g_JpFontNameMap;
-    _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch((FX_LPCSTR)name, pFontnameMap,
+    _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch(name.c_str(), pFontnameMap,
                           size / sizeof (_FontNameMap), sizeof (_FontNameMap), compareString);
     if (found == NULL) {
         return FALSE;
@@ -483,13 +483,13 @@
         int pitch = pBitmap->GetPitch();
         LPBYTE pBuffer = pBitmap->GetBuffer();
         CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
-        ((BITMAPINFOHEADER*)(FX_LPCSTR)info)->biHeight *= -1;
+        ((BITMAPINFOHEADER*)info.c_str())->biHeight *= -1;
         FX_RECT dst_rect(0, 0, width, height);
         dst_rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
         int dst_width = dst_rect.Width();
         int dst_height = dst_rect.Height();
         ::StretchDIBits(m_hDC, left, top, dst_width, dst_height,
-                        0, 0, dst_width, dst_height, pBuffer, (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS, SRCCOPY);
+            0, 0, dst_width, dst_height, pBuffer, (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS, SRCCOPY);
         delete pBitmap;
     } else {
         CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1;
@@ -502,7 +502,7 @@
         LPBYTE pBuffer = pBitmap->GetBuffer();
         CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
         ::SetDIBitsToDevice(m_hDC, left, top, width, height, pSrcRect->left, pBitmap->GetHeight() - pSrcRect->bottom,
-                            0, pBitmap->GetHeight(), pBuffer, (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS);
+            0, pBitmap->GetHeight(), pBuffer, (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
         if (pBitmap != pBitmap1) {
             delete pBitmap;
         }
@@ -536,7 +536,7 @@
     CFX_ByteString toStrechBitmapInfo = CFX_WindowsDIB::GetBitmapInfo(pToStrechBitmap);
     ::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height,
                     0, 0, pToStrechBitmap->GetWidth(), pToStrechBitmap->GetHeight(), pToStrechBitmap->GetBuffer(),
-                    (BITMAPINFO*)(FX_LPCSTR)toStrechBitmapInfo, DIB_RGB_COLORS, SRCCOPY);
+                    (BITMAPINFO*)toStrechBitmapInfo.c_str(), DIB_RGB_COLORS, SRCCOPY);
     if (del) {
         delete pToStrechBitmap;
     }
diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp
index e369073..2ecf539 100644
--- a/core/src/fxge/win32/fx_win32_dib.cpp
+++ b/core/src/fxge/win32/fx_win32_dib.cpp
@@ -108,8 +108,8 @@
 {
     CFX_ByteString info = GetBitmapInfo(pBitmap);
     HBITMAP hBitmap = NULL;
-    hBitmap = CreateDIBitmap(hDC, (BITMAPINFOHEADER*)(FX_LPCSTR)info, CBM_INIT,
-                             pBitmap->GetBuffer(), (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS);
+    hBitmap = CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT,
+        pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
     return hBitmap;
 }
 void GetBitmapSize(HBITMAP hBitmap, int& w, int& h)
@@ -146,7 +146,7 @@
         return NULL;
     }
     CFX_ByteString info = GetBitmapInfo(pDIBitmap);
-    int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS);
+    int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
     if (!ret) {
         if (pDIBitmap) {
             delete pDIBitmap;
@@ -182,7 +182,7 @@
         return NULL;
     }
     CFX_ByteString info = GetBitmapInfo(pDIBitmap);
-    int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS);
+    int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
     if (!ret) {
         if (pDIBitmap) {
             delete pDIBitmap;
diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
index ee6b7bd..9e58c95 100644
--- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
@@ -364,7 +364,7 @@
 		CFX_WideString wsText = pEdit->GetText();
 		int nCharacters = wsText.GetLength();
 		CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
-		unsigned short* pBuffer = (unsigned short*)(FX_LPCSTR)bsUTFText;
+		unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
 		m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE);
 
  		pEdit->SetEditNotify(this);
diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp
index 45c7162..6a70981 100644
--- a/fpdfsdk/src/formfiller/FFL_TextField.cpp
+++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp
@@ -364,7 +364,7 @@
 		CFX_WideString wsText = pEdit->GetText();
 		int nCharacters = wsText.GetLength();
 		CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
-		unsigned short* pBuffer = (unsigned short*)(FX_LPCSTR)bsUTFText;
+		unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
 		m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE);
  
  		pEdit->SetEditNotify(this);
diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp
index 6d3440f..6c2d05c 100644
--- a/fpdfsdk/src/fpdf_flatten.cpp
+++ b/fpdfsdk/src/fpdf_flatten.cpp
@@ -220,7 +220,7 @@
 			pPage->SetAtReference("Contents", pDocument, pDocument->AddIndirectObject(pNewContents));
 			
 			CFX_ByteString sStream;
-			sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", (FX_LPCSTR)key);
+			sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
 			pNewContents->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE);
 		}
 		return;
@@ -267,7 +267,7 @@
 		pContentsArray->AddReference(pDocument, dwObjNum);
 		
 		CFX_ByteString sStream;
-		sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", (FX_LPCSTR)key);
+		sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
 		pNewContents->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE);
 	}
 }
@@ -547,7 +547,7 @@
 		}
 
 		CFX_AffineMatrix m = GetMatrix(rcAnnot, rcStream, matrix);
-		sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, (FX_LPCSTR)sFormName);
+		sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, sFormName.c_str());
 		sStream += sTemp;
 
 		pNewXObject->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE);
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp
index e974ffb..19ca06c 100644
--- a/fpdfsdk/src/fpdfdoc.cpp
+++ b/fpdfsdk/src/fpdfdoc.cpp
@@ -107,7 +107,7 @@
 	CFX_ByteString path = Action.GetURI(pDoc);
 	unsigned long len = path.GetLength() + 1;
 	if (buffer != NULL && buflen >= len)
-		FXSYS_memcpy(buffer, (FX_LPCSTR)path, len);
+		FXSYS_memcpy(buffer, path.c_str(), len);
 	return len;
 }
 
@@ -251,7 +251,7 @@
 	CFX_ByteString bstr = text.UTF16LE_Encode();
 	unsigned long len = bstr.GetLength();
 	if (buffer != NULL && buflen >= len+2) {
-		FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len);
+		FXSYS_memcpy(buffer, bstr.c_str(), len);
 		// use double zero as trailer
 		((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0;
 	}
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index ff054c8..2b8cee9 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -1062,7 +1062,7 @@
 		pStreamDict->SetAtRect("BBox", rcBBox);		
 	}
 	
-	pStream->SetData((FX_BYTE*)(FX_LPCSTR)sContents, sContents.GetLength(), FALSE, FALSE);
+	pStream->SetData((FX_BYTE*)sContents.c_str(), sContents.GetLength(), FALSE, FALSE);
 }
 
 #define BA_ANNOT_MINWIDTH			1
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index e73bd32..37caf2d 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -1916,7 +1916,7 @@
 			pRetStream = new CPDF_Stream(NULL, 0, NULL);
 			CFX_ByteString csStream;
 			csStream.Format("q\n%d 0 0 %d 0 0 cm\n/Img Do\nQ", nWidth, nHeight);
-			pRetStream->InitStream((FX_BYTE*)(FX_LPCSTR)csStream, csStream.GetLength(), pStreamDict);
+			pRetStream->InitStream((FX_BYTE*)csStream.c_str(), csStream.GetLength(), pStreamDict);
 			pDocument->AddIndirectObject(pRetStream);
 		}
 
diff --git a/fpdfsdk/src/javascript/JS_Value.cpp b/fpdfsdk/src/javascript/JS_Value.cpp
index 93da9be..9279ff5 100644
--- a/fpdfsdk/src/javascript/JS_Value.cpp
+++ b/fpdfsdk/src/javascript/JS_Value.cpp
@@ -400,7 +400,7 @@
 void CJS_PropValue::operator <<(CFX_ByteString string)
 {
 	ASSERT(!m_bIsSetting);
-	CJS_Value::operator =((FX_LPCSTR)string);
+	CJS_Value::operator = (string.c_str());
 }
 
 void CJS_PropValue::operator >>(CFX_ByteString &string) const
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp
index b29a5b4..3eb8a09 100644
--- a/fpdfsdk/src/javascript/PublicMethods.cpp
+++ b/fpdfsdk/src/javascript/PublicMethods.cpp
@@ -443,7 +443,7 @@
 		const char * pTemp = strchr(p, ch);
 		if (pTemp == NULL)
 		{
-			StrArray.SetElement(nIndex, CJS_Value(isolate,(FX_LPCSTR)StrTrim(p)));
+			StrArray.SetElement(nIndex, CJS_Value(isolate, StrTrim(p).c_str()));
 			break;
 		}
 		else
@@ -452,7 +452,7 @@
 			strncpy(pSub, p, pTemp - p);
 			*(pSub + (pTemp - p)) = '\0';
 
-			StrArray.SetElement(nIndex, CJS_Value(isolate,(FX_LPCSTR)StrTrim(pSub)));
+			StrArray.SetElement(nIndex, CJS_Value(isolate, StrTrim(pSub).c_str()));
 			delete []pSub;
 			
 			nIndex ++;
@@ -1807,7 +1807,7 @@
 	if(!pEvent->m_pValue)
 		return FALSE;
 	CFX_WideString& Value = pEvent->Value();	
-	std::string strSrc = (FX_LPCSTR)CFX_ByteString::FromUnicode(Value);
+	std::string strSrc = CFX_ByteString::FromUnicode(Value).c_str();
 	
 	switch (iIndex) 
 	{
@@ -1962,7 +1962,7 @@
 		return FALSE;
 	//CJS_Value val = pEvent->Value();
 	CFX_WideString& val = pEvent->Value();
-	std::string strSrc = (FX_LPCSTR)CFX_ByteString::FromUnicode(val);
+	std::string strSrc = CFX_ByteString::FromUnicode(val).c_str();
 	std::wstring wstrChange(pEvent->Change());
 	
 	switch (iIndex) 
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
index d2813f5..83fb32c 100644
--- a/fpdfsdk/src/javascript/util.cpp
+++ b/fpdfsdk/src/javascript/util.cpp
@@ -471,8 +471,8 @@
 		return FALSE;
 	CFX_WideString sFormat = params[0].operator CFX_WideString();
 	CFX_WideString sSource = params[1].operator CFX_WideString();
-	std::string cFormat = (FX_LPCSTR)CFX_ByteString::FromUnicode(sFormat);
-	std::string cSource = (FX_LPCSTR)CFX_ByteString::FromUnicode(sSource);
+	std::string cFormat = CFX_ByteString::FromUnicode(sFormat).c_str();
+	std::string cSource = CFX_ByteString::FromUnicode(sSource).c_str();
 	std::string cDest;
 	printx(cFormat,cSource,cDest);
 	vRet = cDest.c_str();
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp
index 1f47864..7d919a7 100644
--- a/fpdfsdk/src/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp
@@ -251,7 +251,7 @@
 		CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(i);
 		CFX_WideString ws = CFX_WideString(pObjDef->objName);
 		CFX_ByteString bs = ws.UTF8Encode();
-		v8::Handle<v8::String> objName = v8::String::NewFromUtf8(isolate,(FX_LPCSTR)bs, v8::String::kNormalString, bs.GetLength());
+		v8::Handle<v8::String> objName = v8::String::NewFromUtf8(isolate, bs.c_str(), v8::String::kNormalString, bs.GetLength());
 
 
 		if(pObjDef->objType == JS_DYNAMIC)
@@ -324,7 +324,7 @@
 	CFX_ByteString bsScript = wsScript.UTF8Encode();
 
 
-	v8::Handle<v8::Script> compiled_script = v8::Script::Compile(v8::String::NewFromUtf8(isolate,(FX_LPCSTR)bsScript,v8::String::kNormalString, bsScript.GetLength()));
+	v8::Handle<v8::Script> compiled_script = v8::Script::Compile(v8::String::NewFromUtf8(isolate, bsScript.c_str(), v8::String::kNormalString, bsScript.GetLength()));
 	if (compiled_script.IsEmpty()) {
 		v8::String::Utf8Value error(try_catch.Exception());
 		return -1;
@@ -341,7 +341,7 @@
 	CFX_WideString wsScript(script);
 	CFX_ByteString bsScript = wsScript.UTF8Encode();
 
-	v8::Handle<v8::Script> compiled_script = v8::Script::Compile(v8::String::NewFromUtf8(isolate,(FX_LPCSTR)bsScript,v8::String::kNormalString, bsScript.GetLength()));
+    v8::Handle<v8::Script> compiled_script = v8::Script::Compile(v8::String::NewFromUtf8(isolate, bsScript.c_str(), v8::String::kNormalString, bsScript.GetLength()));
 	if (compiled_script.IsEmpty()) {
 		v8::String::Utf8Value error(try_catch.Exception());
 		return -1;
@@ -553,7 +553,7 @@
 	CFX_WideString ws = CFX_WideString(PropertyName,Len);
 	CFX_ByteString bs = ws.UTF8Encode();
 	if(!pJSRuntime) pJSRuntime = v8::Isolate::GetCurrent();
-	return v8::String::NewFromUtf8(pJSRuntime, (FX_LPCSTR)bs);
+	return v8::String::NewFromUtf8(pJSRuntime, bs.c_str());
 }
 
 v8::Handle<v8::Value> JS_GetObjectElement(IJS_Runtime* pJSRuntime, v8::Handle<v8::Object> pObj,const wchar_t* PropertyName)
diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
index dfdbf64..bbac382 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
@@ -44,7 +44,7 @@
 	{		
 		CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText);
 		
-		if (CXML_Element * pXML = CXML_Element::Parse((FX_LPCSTR)sValue,sValue.GetLength()))
+		if (CXML_Element * pXML = CXML_Element::Parse(sValue.c_str(), sValue.GetLength()))
 		{
 			FX_INT32 nCount = pXML->CountChildren();
 			FX_BOOL bFirst = TRUE;