diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-01 16:12:48 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-01 16:12:48 -0700 |
commit | 0b36bb48bd2e8c0a24505521e267cdd52a1dd683 (patch) | |
tree | 167ca97ac7598b2cc4d92b30f9ecc2ac1979470c /core/src/fxcrt/fx_basic_bstring.cpp | |
parent | 7f840ae069b677360a7f96a7abd5e2903d302bdd (diff) | |
download | pdfium-0b36bb48bd2e8c0a24505521e267cdd52a1dd683.tar.xz |
Merge to XFA: CFX_ByteString/WideString header changes
Original Review URL: https://codereview.chromium.org/1117413002
Original Review URL: https://codereview.chromium.org/1118983003
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1125493002
Diffstat (limited to 'core/src/fxcrt/fx_basic_bstring.cpp')
-rw-r--r-- | core/src/fxcrt/fx_basic_bstring.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp index 2c8f7a766b..9cf084c2fb 100644 --- a/core/src/fxcrt/fx_basic_bstring.cpp +++ b/core/src/fxcrt/fx_basic_bstring.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <stddef.h> // For offsetof(). + #include "../../include/fxcrt/fx_basic.h" #include "../../../third_party/base/numerics/safe_math.h" @@ -53,7 +55,9 @@ static CFX_StringData* FX_AllocString(int nLen) return NULL; } - int overhead = sizeof(long) * 3 + 1; // 3 longs in header plus 1 for NUL. + // Fixed portion of header plus a NUL char not included in m_nAllocLength. + // sizeof(FX_CHAR) is always 1, used for consistency with CFX_Widestring. + int overhead = offsetof(CFX_StringData, m_String) + sizeof(FX_CHAR); pdfium::base::CheckedNumeric<int> nSize = nLen; nSize += overhead; |