diff options
author | Ryan Harrison <rharrison@chromium.org> | 2018-01-26 17:11:51 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-26 17:11:51 +0000 |
commit | 4b9d69806c30775f55563e72b0842daa06483f99 (patch) | |
tree | de54ec0133b6ad5ee625060adbfb02c45a0b9c83 /testing/libfuzzer | |
parent | 49363202ce06ca9ff418b4df384cffadf924303c (diff) | |
download | pdfium-4b9d69806c30775f55563e72b0842daa06483f99.tar.xz |
Clean up construction of CFX_Barcode
Because certain enum values can cause the initialization of the class
to fail there is a seperate init method from the constructor. This CL
is converting the code to use a standard factory pattern for this,
instead of the existing implementation.
Change-Id: Ia2293ce94ad0db5862db9796aeb8a224fd2b45f9
Reviewed-on: https://pdfium-review.googlesource.com/24230
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'testing/libfuzzer')
-rw-r--r-- | testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc b/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc index 3334e86bfc..aaeebf3ace 100644 --- a/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc +++ b/testing/libfuzzer/pdf_cfx_barcode_fuzzer.cc @@ -17,20 +17,20 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { data += sizeof(wchar_t); size -= sizeof(wchar_t); - CFX_Barcode barcode; - if (!barcode.Create(type)) + auto barcode = CFX_Barcode::Create(type); + if (!barcode) return 0; // TODO(tsepez): Setup more options from |data|. - barcode.SetModuleHeight(300); - barcode.SetModuleWidth(420); - barcode.SetHeight(298); - barcode.SetWidth(418); + barcode->SetModuleHeight(300); + barcode->SetModuleWidth(420); + barcode->SetHeight(298); + barcode->SetWidth(418); WideStringView content(reinterpret_cast<const wchar_t*>(data), size / sizeof(wchar_t)); - if (!barcode.Encode(content)) + if (!barcode->Encode(content)) return 0; // TODO(tsepez): Output to device. |