wstring allocations waste up to 7 wasted bytes.
authorTom Sepez <tsepez@chromium.org>
Tue, 13 Oct 2015 19:02:11 +0000 (12:02 -0700)
committerTom Sepez <tsepez@chromium.org>
Tue, 13 Oct 2015 19:02:11 +0000 (12:02 -0700)
Consequence of having the same code in two places;
fx_basic_bstring.cpp is correct, but fx_basic_wstring.cpp
is missing one small change.

Noticed while working on 542403, but this will not fix that
issue. It is just a space savings.

R=thestig@chromium.org

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

core/src/fxcrt/fx_basic_wstring.cpp

index e7f8c01..c097e1f 100644 (file)
@@ -32,7 +32,7 @@ CFX_WideString::StringData* CFX_WideString::StringData::Create(int nLen) {
   int usableLen = (totalSize - overhead) / sizeof(FX_WCHAR);
   FXSYS_assert(usableLen >= nLen);
 
-  void* pData = FX_Alloc(uint8_t, iSize.ValueOrDie());
+  void* pData = FX_Alloc(uint8_t, totalSize);
   return new (pData) StringData(nLen, usableLen);
 }
 CFX_WideString::~CFX_WideString() {