summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-25 09:43:52 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-25 16:58:04 +0000
commitd524e4bf80314ade4a6aedf77b8b4adaa96bfcee (patch)
tree8ced866d27eca1c14c060b1c4b538fbcba2b6179 /core/fxcrt
parent49f8dc5b1afc4f92110bf40b7639ee1138aa7240 (diff)
downloadpdfium-d524e4bf80314ade4a6aedf77b8b4adaa96bfcee.tar.xz
Delete some CFX string ctors.
Prevent implicit construction of CFX_WideString from non-wchar_t variables. Similarly prevent implicit construction of CFX_ByteString from non-char variables. Fix up CBC_OnedCodaBarWriter which tries to do the above, and simplify code there using pdfium::ContainsValue(). Same for CPDF_FileSpec. Change-Id: I3db7125a68ef3f64c2f235d38e974767cd083dc3 Reviewed-on: https://pdfium-review.googlesource.com/4478 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/cfx_bytestring.h4
-rw-r--r--core/fxcrt/cfx_widestring.h4
2 files changed, 8 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_bytestring.h b/core/fxcrt/cfx_bytestring.h
index 0ffe92936a..c4d48954ba 100644
--- a/core/fxcrt/cfx_bytestring.h
+++ b/core/fxcrt/cfx_bytestring.h
@@ -35,6 +35,10 @@ class CFX_ByteString {
// NOLINTNEXTLINE(runtime/explicit)
CFX_ByteString(const char* ptr);
+ // No implicit conversions from wide strings.
+ // NOLINTNEXTLINE(runtime/explicit)
+ CFX_ByteString(wchar_t) = delete;
+
CFX_ByteString(const char* ptr, FX_STRSIZE len);
CFX_ByteString(const uint8_t* ptr, FX_STRSIZE len);
diff --git a/core/fxcrt/cfx_widestring.h b/core/fxcrt/cfx_widestring.h
index fd3c92a15e..977114816d 100644
--- a/core/fxcrt/cfx_widestring.h
+++ b/core/fxcrt/cfx_widestring.h
@@ -35,6 +35,10 @@ class CFX_WideString {
// NOLINTNEXTLINE(runtime/explicit)
CFX_WideString(const wchar_t* ptr);
+ // No implicit conversions from byte strings.
+ // NOLINTNEXTLINE(runtime/explicit)
+ CFX_WideString(char) = delete;
+
CFX_WideString(const wchar_t* ptr, FX_STRSIZE len);
explicit CFX_WideString(const CFX_WideStringC& str);