Remove three args from FX_WideCharToMultiByte()
These are always passed as nullptr or 0.
Change-Id: I0dc714071098d2a62336a45c8cfa418103a50ad4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83562
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 0717795..79e5e6a 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -373,9 +373,9 @@
return 0;
#if defined(OS_WIN)
uint8_t buffer[32];
- int ret = FX_WideCharToMultiByte(kCharsetCodePages[m_pCMap->GetCoding()], 0,
- &unicode, 1, reinterpret_cast<char*>(buffer),
- 4, nullptr, nullptr);
+ int ret =
+ FX_WideCharToMultiByte(kCharsetCodePages[m_pCMap->GetCoding()], &unicode,
+ 1, reinterpret_cast<char*>(buffer), 4);
if (ret == 1)
return buffer[0];
if (ret == 2)
diff --git a/core/fxcrt/fx_codepage.cpp b/core/fxcrt/fx_codepage.cpp
index f4a22ba..e7f6eb5 100644
--- a/core/fxcrt/fx_codepage.cpp
+++ b/core/fxcrt/fx_codepage.cpp
@@ -291,16 +291,13 @@
}
int FX_WideCharToMultiByte(FX_CodePage codepage,
- uint32_t dwFlags,
const wchar_t* wstr,
int wlen,
char* buf,
- int buflen,
- const char* default_str,
- int* pUseDefault) {
+ int buflen) {
#if defined(OS_WIN)
- return WideCharToMultiByte(static_cast<UINT>(codepage), dwFlags, wstr, wlen,
- buf, buflen, default_str, pUseDefault);
+ return WideCharToMultiByte(static_cast<UINT>(codepage), 0, wstr, wlen, buf,
+ buflen, nullptr, nullptr);
#else
int len = 0;
for (int i = 0; i < wlen; i++) {
diff --git a/core/fxcrt/fx_codepage.h b/core/fxcrt/fx_codepage.h
index e8f7d18..265587e 100644
--- a/core/fxcrt/fx_codepage.h
+++ b/core/fxcrt/fx_codepage.h
@@ -112,13 +112,10 @@
FX_Charset FX_GetCharsetFromInt(int value);
bool FX_CharSetIsCJK(FX_Charset uCharset);
int FX_WideCharToMultiByte(FX_CodePage codepage,
- uint32_t dwFlags,
const wchar_t* wstr,
int wlen,
char* buf,
- int buflen,
- const char* default_str,
- int* pUseDefault);
+ int buflen);
int FX_MultiByteToWideChar(FX_CodePage codepage,
uint32_t dwFlags,
const char* bstr,
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp
index c3ec07f..84dfe95 100644
--- a/core/fxcrt/widestring.cpp
+++ b/core/fxcrt/widestring.cpp
@@ -658,8 +658,8 @@
ByteString WideString::ToDefANSI() const {
int src_len = GetLength();
- int dest_len = FX_WideCharToMultiByte(FX_CodePage::kDefANSI, 0, c_str(),
- src_len, nullptr, 0, nullptr, nullptr);
+ int dest_len = FX_WideCharToMultiByte(FX_CodePage::kDefANSI, c_str(), src_len,
+ nullptr, 0);
if (!dest_len)
return ByteString();
@@ -667,8 +667,8 @@
{
// Span's lifetime must end before ReleaseBuffer() below.
pdfium::span<char> dest_buf = bstr.GetBuffer(dest_len);
- FX_WideCharToMultiByte(FX_CodePage::kDefANSI, 0, c_str(), src_len,
- dest_buf.data(), dest_len, nullptr, nullptr);
+ FX_WideCharToMultiByte(FX_CodePage::kDefANSI, c_str(), src_len,
+ dest_buf.data(), dest_len);
}
bstr.ReleaseBuffer(dest_len);
return bstr;