diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-12-11 16:26:00 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-12-11 16:26:00 -0800 |
commit | f75bdb181576e4a4cf8291706a0db86c687e5fc3 (patch) | |
tree | 4440158d95c723b1ef02753b4dfa9d1a598e1a87 /xfa/src/fxbarcode/common | |
parent | 74aa4e19a332436ff3bcf539c905e992b1d3ac4e (diff) | |
download | pdfium-f75bdb181576e4a4cf8291706a0db86c687e5fc3.tar.xz |
XFA: avoid multiplications in FX_Allocs
In some cases, we can use the safe FX_Alloc2D, in others
there's an extra multiplication by the size of the type.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1519233002 .
Diffstat (limited to 'xfa/src/fxbarcode/common')
-rw-r--r-- | xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp | 4 | ||||
-rw-r--r-- | xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp b/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp index 0a0930d97c..ec2706b122 100644 --- a/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonBitMatrix.cpp @@ -34,7 +34,7 @@ void CBC_CommonBitMatrix::Init(int32_t dimension) { m_height = dimension;
int32_t rowSize = (m_height + 31) >> 5;
m_rowSize = rowSize;
- m_bits = FX_Alloc(int32_t, m_rowSize * m_height);
+ m_bits = FX_Alloc2D(int32_t, m_rowSize, m_height);
FXSYS_memset(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
}
void CBC_CommonBitMatrix::Init(int32_t width, int32_t height) {
@@ -42,7 +42,7 @@ void CBC_CommonBitMatrix::Init(int32_t width, int32_t height) { m_height = height;
int32_t rowSize = (width + 31) >> 5;
m_rowSize = rowSize;
- m_bits = FX_Alloc(int32_t, m_rowSize * m_height);
+ m_bits = FX_Alloc2D(int32_t, m_rowSize, m_height);
FXSYS_memset(m_bits, 0, m_rowSize * m_height * sizeof(int32_t));
}
CBC_CommonBitMatrix::~CBC_CommonBitMatrix() {
diff --git a/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp b/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp index ee4eee26a9..d6208d41b5 100644 --- a/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp +++ b/xfa/src/fxbarcode/common/BC_CommonByteMatrix.cpp @@ -28,7 +28,7 @@ CBC_CommonByteMatrix::CBC_CommonByteMatrix(int32_t width, int32_t height) { m_bytes = NULL;
}
void CBC_CommonByteMatrix::Init() {
- m_bytes = FX_Alloc(uint8_t, m_height * m_width);
+ m_bytes = FX_Alloc2D(uint8_t, m_height, m_width);
FXSYS_memset(m_bytes, 0xff, m_height * m_width);
}
CBC_CommonByteMatrix::~CBC_CommonByteMatrix() {
|