summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec_jpx_unittest.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-08-07 11:44:42 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-08-07 19:26:09 +0000
commitae6c3444c268076a234b567c5d43f0b5363ae66a (patch)
tree2342ff907dd08a245c6d89333b9afe42af246c74 /core/fxcodec/codec/fx_codec_jpx_unittest.cpp
parentbd456561faf7de2d2756a350a9be0d10ce47c51c (diff)
downloadpdfium-ae6c3444c268076a234b567c5d43f0b5363ae66a.tar.xz
Fix PartitionAlloc vs. opj_malloc mismatch in fx_codec_jpx_opj.cpp
Apply patch suggestions from reporter. Move all FX_Alloc'd memory into unique_ptrs so that no bare FX_Alloc/Free_Free calls remain. Fix a realloc / opj_realloc mismatch. Remove unused functions color_apply_icc_profile() and color_apply_conversion(). Tidy along the way, add some missing statics, and fix a confusing (but not quite member shadowing) local name. Bug: 752829 Change-Id: Ibf2d108a857e3de39e752c2c553a31e002a07caf Reviewed-on: https://pdfium-review.googlesource.com/10230 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Chris Palmer <palmer@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/fx_codec_jpx_unittest.cpp')
-rw-r--r--core/fxcodec/codec/fx_codec_jpx_unittest.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/fxcodec/codec/fx_codec_jpx_unittest.cpp b/core/fxcodec/codec/fx_codec_jpx_unittest.cpp
index 7e2510546d..cc5c8601b1 100644
--- a/core/fxcodec/codec/fx_codec_jpx_unittest.cpp
+++ b/core/fxcodec/codec/fx_codec_jpx_unittest.cpp
@@ -8,6 +8,7 @@
#include "core/fxcodec/codec/codec_int.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/libopenjpeg20/opj_malloc.h"
static const OPJ_OFF_T kSkipError = static_cast<OPJ_OFF_T>(-1);
static const OPJ_SIZE_T kReadError = static_cast<OPJ_SIZE_T>(-1);
@@ -435,11 +436,11 @@ TEST(fxcodec, YUV420ToRGB) {
y.h = y.w;
img.x1 = y.w;
img.y1 = y.h;
- y.data = FX_Alloc(OPJ_INT32, y.w * y.h);
+ y.data = static_cast<OPJ_INT32*>(opj_calloc(y.w * y.h, sizeof(OPJ_INT32)));
+ v.data = static_cast<OPJ_INT32*>(opj_calloc(v.w * v.h, sizeof(OPJ_INT32)));
+ u.data = static_cast<OPJ_INT32*>(opj_calloc(u.w * u.h, sizeof(OPJ_INT32)));
memset(y.data, 1, y.w * y.h * sizeof(OPJ_INT32));
- u.data = FX_Alloc(OPJ_INT32, u.w * u.h);
memset(u.data, 0, u.w * u.h * sizeof(OPJ_INT32));
- v.data = FX_Alloc(OPJ_INT32, v.w * v.h);
memset(v.data, 0, v.w * v.h * sizeof(OPJ_INT32));
img.comps[0] = y;
img.comps[1] = u;
@@ -456,9 +457,9 @@ TEST(fxcodec, YUV420ToRGB) {
EXPECT_NE(img.comps[0].w, img.comps[2].w);
EXPECT_NE(img.comps[0].h, img.comps[2].h);
}
- FX_Free(img.comps[0].data);
- FX_Free(img.comps[1].data);
- FX_Free(img.comps[2].data);
+ opj_free(img.comps[0].data);
+ opj_free(img.comps[1].data);
+ opj_free(img.comps[2].data);
}
FX_Free(img.comps);
}